Rodin/Solver/LeastSquaresCG.h file

Least-squares conjugate gradient solver.

This header provides the LeastSquaresCG solver class for solving least-squares problems using the conjugate gradient method applied to the normal equations.

Algorithm

Solves the least-squares problem:

\[ \min_x \|Ax - b\|^2 \]

by applying CG to the normal equations $ A^TAx = A^Tb $ .

Applicability

  • Overdetermined systems (more equations than unknowns)
  • Rectangular matrices
  • Least-squares fitting problems
  • Problems where $ A^TA $ is well-conditioned

Usage Example

Problem problem(u, v);
problem = Integral(Grad(u), Grad(v)) - Integral(f, v);

Solver::LeastSquaresCG solver(problem);
solver.setTolerance(1e-10).setMaxIterations(1000).solve();

Namespaces

namespace Rodin
The Rodin library for Shape and Topology Optimization.
namespace Rodin::Solver
Module for linear algebra systems.

Classes

template<class Scalar>
class Rodin::Solver::LeastSquaresCG<Math::LinearSystem<Math::SparseMatrix<Scalar>, Math::Vector<Scalar>>>
Least-squares conjugate gradient solver for sparse systems.
template<class Scalar>
class Rodin::Solver::LeastSquaresCG<Math::LinearSystem<Math::Matrix<Scalar>, Math::Vector<Scalar>>>
Least-squares conjugate gradient solver for dense systems.