SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
LinearOperator.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 LINEAR_OPERATOR_H_
11 #define LINEAR_OPERATOR_H_
12 
13 #include <shogun/lib/config.h>
14 #include <shogun/base/SGObject.h>
15 #include <shogun/base/Parameter.h>
16 
17 namespace shogun
18 {
19 template<class T> class SGVector;
20 
24 template<class RetType, class OperandType> class CLinearOperator : public CSGObject
25 {
26 public:
29  : CSGObject()
30  {
31  init();
32 
33  SG_GCDEBUG("%s created (%p)\n", this->get_name(), this)
34  }
35 
42  : CSGObject()
43  {
44  init();
45 
46  m_dimension=dimension;
47 
48  SG_GCDEBUG("%s created (%p)\n", this->get_name(), this)
49  }
50 
52  virtual ~CLinearOperator()
53  {
54  SG_GCDEBUG("%s destroyed (%p)\n", this->get_name(), this)
55  }
56 
58  const index_t get_dimension() const
59  {
60  return m_dimension;
61  }
62 
69  virtual RetType apply(OperandType b) const = 0;
70 
72  virtual const char* get_name() const
73  {
74  return "LinearOperator";
75  }
76 protected:
79 
80 private:
82  void init()
83  {
84  m_dimension=0;
85 
86  SG_ADD(&m_dimension, "dimension",
87  "Dimension of the vector on which linear operator can apply",
89  }
90 
91 };
92 }
93 
94 #endif // LINEAR_OPERATOR_H_

SHOGUN Machine Learning Toolbox - Documentation