SHOGUN  4.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
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;
32 class CJobResultAggregator;
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_
COperatorFunction(CLinearOperator< T > *op, CIndependentComputationEngine *engine, EOperatorFunction type=OF_UNDEFINED)
CIndependentComputationEngine * m_computation_engine
virtual void precompute()=0
#define SG_REF(x)
Definition: SGObject.h:51
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:112
shogun vector
CLinearOperator< T > * get_operator() const
virtual const char * get_name() const
Abstract base class that provides an interface for computing an aggeregation of the job results of in...
#define SG_UNREF(x)
Definition: SGObject.h:52
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
CLinearOperator< T > * m_linear_operator
Abstract template base class that represents a linear operator, e.g. a matrix.
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.
#define SG_ADD(...)
Definition: SGObject.h:81
const EOperatorFunction m_function_type
virtual CJobResultAggregator * submit_jobs(SGVector< T > sample)=0

SHOGUN Machine Learning Toolbox - Documentation