21 using namespace Eigen;
26 CConjugateGradientSolver::CConjugateGradientSolver()
46 SG_DEBUG(
"CConjugateGradientSolve::solve(): Entering..\n");
49 REQUIRE(A,
"Operator is NULL!\n");
50 REQUIRE(A->get_dimension()==b.
vlen,
"Dimension mismatch!\n");
54 result.set_const(0.0);
87 SG_DEBUG(
"CG iteration %d, residual norm %f\n",
134 SG_INFO(
"Iteration took %ld times, residual norm=%.20lf, time elapsed=%lf\n",
137 SG_DEBUG(
"CConjugateGradientSolve::solve(): Leaving..\n");
142 #endif // HAVE_EIGEN3
Class Time that implements a stopwatch based on either cpu time or wall clock time.
virtual SGVector< float64_t > solve(CLinearOperator< SGVector< float64_t >, SGVector< float64_t > > *A, SGVector< float64_t > b)
void begin(const VectorXt &residual)
CConjugateGradientSolver()
SGVector< float64_t > m_residuals
const bool end(const VectorXt &residual)
virtual const char * get_name() const
float64_t m_absolute_tolerence
float64_t cur_time_diff(bool verbose=false)
template class that is used as an iterator for an iterative linear solver. In the iteration of solvin...
abstract template base for all iterative linear solvers such as conjugate gradient (CG) solvers...
float64_t start(bool verbose=false)
const IterInfo get_iter_info() const
Abstract template base class that represents a linear operator, e.g. a matrix.
void set_const(T const_elem)
all of classes and functions are contained in the shogun namespace
index_t m_max_iteration_limit
const bool succeeded(const VectorXt &residual)
virtual ~CConjugateGradientSolver()
float64_t m_relative_tolerence