SHOGUN  4.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
IterativeLinearSolver.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 ITERATIVE_LINEAR_SOLVER_H_
11 #define ITERATIVE_LINEAR_SOLVER_H_
12 
13 #include <shogun/lib/config.h>
15 #include <shogun/lib/SGVector.h>
16 
17 namespace shogun
18 {
19 
25 template<class T, class ST=T> class CIterativeLinearSolver : public CLinearSolver<T, ST>
26 {
27 
28 public:
31 
33  CIterativeLinearSolver(bool store_residuals);
34 
36  virtual ~CIterativeLinearSolver();
37 
46 
48  void set_iteration_limit(index_t iteration_limit)
49  {
50  m_max_iteration_limit=iteration_limit;
52  {
55  }
56  }
57 
60  {
61  return m_max_iteration_limit;
62  }
63 
65  void set_relative_tolerence(float64_t relative_tolerence)
66  {
67  m_relative_tolerence=relative_tolerence;
68  }
69 
72  {
73  return m_relative_tolerence;
74  }
75 
77  void set_absolute_tolerence(float64_t absolute_tolerence)
78  {
79  m_absolute_tolerence=absolute_tolerence;
80  }
81 
84  {
85  return m_absolute_tolerence;
86  }
87 
90  {
91  return m_residuals;
92  }
93 
95  virtual const char* get_name() const
96  {
97  return "IterativeLinearSolver";
98  }
99 
100 protected:
101 
104 
107 
110 
113 
116 private:
118  void init();
119 
120 };
121 
122 }
123 
124 #endif // ITERATIVE_LINEAR_SOLVER_H_
virtual const char * get_name() const
int32_t index_t
Definition: common.h:62
const index_t get_iteration_limit() const
void set_relative_tolerence(float64_t relative_tolerence)
void set_iteration_limit(index_t iteration_limit)
abstract template base for all iterative linear solvers such as conjugate gradient (CG) solvers...
SGVector< float64_t > get_residuals() const
shogun vector
double float64_t
Definition: common.h:50
virtual SGVector< T > solve(CLinearOperator< T > *A, SGVector< ST > b)=0
void set_absolute_tolerence(float64_t absolute_tolerence)
Abstract template base class that provides an abstract solve method for linear systems, that takes a linear operator , a vector , solves the system and returns the vector .
Definition: LinearSolver.h:25
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
const float64_t get_absolute_tolerence() const
const float64_t get_relative_tolerence() const
Abstract template base class that represents a linear operator, e.g. a matrix.
void set_const(T const_elem)
Definition: SGVector.cpp:150

SHOGUN Machine Learning Toolbox - Documentation