Conjugate gradient solvers (dense and matrix-free)
Backend
Selects which backend handles a linalg operation.
constexpr T ipow(T x) noexcept
Compute x^N at compile time via repeated squaring.
void matvec(const Matrix &A, const Vector &x, Vector &y, Backend b=default_backend)
y = A * x
SolverResult gmres(MatVecFn matvec, idx n, const Vector &b, Vector &x, real tol=1e-6, idx max_iter=1000, idx restart=30)
Restarted GMRES(restart) – matrix-free interface.
BasicVector< real > Vector
Real-valued dense vector with full backend dispatch (CPU + GPU)
constexpr Backend default_backend
std::function< void(const Vector &, Vector &)> MatVecFn
Callable type for matrix-free matvec: computes y = A*x.
Backend enum for linear algebra operations.
Common result type shared by all iterative solvers.
Compressed Sparse Row (CSR) matrix and operations.