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

Conjugate gradient solvers (dense and matrix-free) More...

#include "linalg/solvers/solver_result.hpp"
#include "core/matrix.hpp"
#include "core/vector.hpp"
#include "core/policy.hpp"
#include <functional>

Go to the source code of this file.

Namespaces

namespace  num
 

Typedefs

using num::MatVecFn = std::function< void(const Vector &, Vector &)>
 Callable type for matrix-free matvec: computes y = A*x.
 

Functions

SolverResult num::cg (const Matrix &A, const Vector &b, Vector &x, real tol=1e-10, idx max_iter=1000, Backend backend=default_backend)
 Conjugate gradient solver for Ax = b.
 
SolverResult num::cg_matfree (MatVecFn matvec, const Vector &b, Vector &x, real tol=1e-6, idx max_iter=1000)
 Matrix-free conjugate gradient for Ax = b where A is SPD.
 

Detailed Description

Conjugate gradient solvers (dense and matrix-free)

Definition in file cg.hpp.