numerics 0.1.0
Loading...
Searching...
No Matches
cg.hpp File Reference

Conjugate gradient solvers. More...

#include "core/matrix.hpp"
#include "core/policy.hpp"
#include "core/vector.hpp"
#include "linalg/solvers/solver_result.hpp"
#include "operator/concepts.hpp"
#include <cmath>
#include <stdexcept>

Go to the source code of this file.

Namespaces

namespace  num
 

Functions

SolverResult num::cg (const Matrix &A, const Vector &b, Vector &x, real tol=1e-10, idx max_iter=1000, Backend backend=default_backend)
 
template<class Op >
requires operators::LinearOperator<Op, Vector, Vector>
SolverResult num::cg (const Op &A, const Vector &b, Vector &x, real tol=1e-10, idx max_iter=1000, Backend backend=default_backend)
 Operator CG for any \(y=A x\) adapter.
 

Detailed Description

Conjugate gradient solvers.

Solves \(Ax=b\) for symmetric positive definite \(A\) using \(\mathcal{K}_k(A,r_0)=\mathrm{span}\{r_0,Ar_0,\ldots,A^{k-1}r_0\}\).

Definition in file cg.hpp.