SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
EigenSolver.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 EIGEN_SOLVER_H_
11 #define EIGEN_SOLVER_H_
12 
13 #include <shogun/lib/config.h>
14 #include <shogun/base/Parameter.h>
16 
17 namespace shogun
18 {
19 
24 class CEigenSolver : public CSGObject
25 {
26 public:
29  : CSGObject()
30  {
31  init();
32  }
33 
41  : CSGObject()
42  {
43  init();
44 
45  m_linear_operator=linear_operator;
47  }
49  virtual ~CEigenSolver()
50  {
52  }
53 
58  virtual void compute() = 0;
59 
61  void set_min_eigenvalue(float64_t min_eigenvalue)
62  {
63  m_min_eigenvalue=min_eigenvalue;
64  m_is_computed_min=true;
65  }
66 
69  {
70  return m_min_eigenvalue;
71  }
72 
74  void set_max_eigenvalue(float64_t max_eigenvalue)
75  {
76  m_max_eigenvalue=max_eigenvalue;
77  m_is_computed_max=true;
78  }
79 
82  {
83  return m_max_eigenvalue;
84  }
85 
87  virtual const char* get_name() const
88  {
89  return "EigenSolver";
90  }
91 protected:
94 
97 
100 
103 
106 
107 private:
109  void init()
110  {
111  m_min_eigenvalue=0.0;
112  m_max_eigenvalue=0.0;
113  m_linear_operator=NULL;
114  m_is_computed_min=false;
115  m_is_computed_max=false;
116 
117  SG_ADD(&m_min_eigenvalue, "min_eigenvalue",
118  "Minimum eigenvalue of a real valued self-adjoint linear operator",
120 
121  SG_ADD(&m_max_eigenvalue, "max_eigenvalue",
122  "Maximum eigenvalue of a real valued self-adjoint linear operator",
124 
125  SG_ADD((CSGObject**)&m_linear_operator, "linear_operator",
126  "Self-adjoint linear operator",
128 
129  SG_ADD(&m_is_computed_min, "is_computed_min",
130  "Flag denoting that the minimum eigenvalue has already been computed",
132 
133  SG_ADD(&m_max_eigenvalue, "is_computed_max",
134  "Flag denoting that the maximum eigenvalue has already been computed",
136 
137  }
138 };
139 
140 }
141 
142 #endif // EIGEN_SOLVER_H_
virtual void compute()=0
float64_t m_min_eigenvalue
Definition: EigenSolver.h:93
float64_t m_max_eigenvalue
Definition: EigenSolver.h:96
void set_min_eigenvalue(float64_t min_eigenvalue)
Definition: EigenSolver.h:61
const float64_t get_min_eigenvalue() const
Definition: EigenSolver.h:68
virtual const char * get_name() const
Definition: EigenSolver.h:87
#define SG_REF(x)
Definition: SGObject.h:54
virtual ~CEigenSolver()
Definition: EigenSolver.h:49
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:115
double float64_t
Definition: common.h:50
#define SG_UNREF(x)
Definition: SGObject.h:55
void set_max_eigenvalue(float64_t max_eigenvalue)
Definition: EigenSolver.h:74
Abstract base class that provides an abstract compute method for computing eigenvalues of a real valu...
Definition: EigenSolver.h:24
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
CEigenSolver(CLinearOperator< float64_t > *linear_operator)
Definition: EigenSolver.h:40
const float64_t get_max_eigenvalue() const
Definition: EigenSolver.h:81
#define SG_ADD(...)
Definition: SGObject.h:84
CLinearOperator< float64_t > * m_linear_operator
Definition: EigenSolver.h:99

SHOGUN Machine Learning Toolbox - Documentation