SHOGUN  6.1.3
OperatorFunction.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 2013 Soumyajit De
8  */
9 
10 #ifndef OPERATOR_FUNCTION_H_
11 #define OPERATOR_FUNCTION_H_
12 
13 #include <shogun/lib/config.h>
14 #include <shogun/base/SGObject.h>
15 #include <shogun/base/Parameter.h>
18 
19 namespace shogun
20 {
21 
24 {
26  OF_LOG=1,
29 };
30 
31 template<class T> class SGVector;
33 template<class T> class CLinearOperator;
34 
40 template<class T> class COperatorFunction : public CSGObject
41 {
42 public:
45  : CSGObject(),
47  {
48  init();
49  }
50 
61  : CSGObject(),
62  m_function_type(type)
63  {
64  init();
65 
68 
69  m_computation_engine=engine;
71  }
72 
75  {
78  }
79 
82  {
83  return m_linear_operator;
84  }
85 
91  virtual void precompute() = 0;
92 
103  virtual CJobResultAggregator* submit_jobs(SGVector<T> sample) = 0;
104 
106  virtual const char* get_name() const
107  {
108  return "OperatorFunction";
109  }
110 protected:
113 
116 
119 
120 private:
122  void init()
123  {
124  m_linear_operator=NULL;
125  m_computation_engine=NULL;
126 
127  SG_ADD((CSGObject**)&m_linear_operator, "linear_operator",
128  "Linear operator of this operator function", MS_NOT_AVAILABLE);
129 
130  SG_ADD((CSGObject**)&m_computation_engine, "computation_engine",
131  "Computation engine for the jobs this will generate", MS_NOT_AVAILABLE);
132  }
133 };
134 }
135 
136 #endif // OPERATOR_FUCNTION_H_
CLinearOperator< T > * m_linear_operator
CLinearOperator< T > * get_operator() const
COperatorFunction(CLinearOperator< T > *op, CIndependentComputationEngine *engine, EOperatorFunction type=OF_UNDEFINED)
#define SG_REF(x)
Definition: SGObject.h:52
virtual const char * get_name() const
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:124
Abstract template base class for computing for a linear operator C and a vector s. submit_jobs method creates a bunch of jobs needed to solve for this particular and attaches one unique job aggregator to each of them, then submits them all to the computation engine.
shogun vector
virtual CJobResultAggregator * submit_jobs(SGVector< T > sample)=0
virtual void precompute()=0
Abstract base class that provides an interface for computing an aggeregation of the job results of in...
Abstract template base class that represents a linear operator, e.g. a matrix.
#define SG_UNREF(x)
Definition: SGObject.h:53
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
Abstract base class for solving multiple independent instances of CIndependentJob. It has one method, submit_job, which may add the job to an internal queue and might block if there is yet not space in the queue. After jobs are submitted, it might not yet be ready. wait_for_all waits until all jobs are completed, which *must be* called to guarantee that all jobs are finished.
const EOperatorFunction m_function_type
#define SG_ADD(...)
Definition: SGObject.h:93
CIndependentComputationEngine * m_computation_engine

SHOGUN Machine Learning Toolbox - Documentation