Conjugate gradient solvers (dense and matrix-free)
Dense row-major matrix with optional GPU storage.
Full symmetric eigendecomposition via cyclic Jacobi sweeps.
Backend
Selects which backend handles a linalg operation.
@ seq
Naive textbook loops – always available.
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
LanczosResult lanczos(MatVecFn matvec, idx n, idx k, real tol=1e-10, idx max_steps=0, Backend backend=Backend::seq)
Lanczos eigensolver for large sparse symmetric matrices.
std::function< void(const Vector &, Vector &)> MatVecFn
Callable type for matrix-free matvec: computes y = A*x.
Backend enum for linear algebra operations.
Result of a Lanczos eigensolver.
bool converged
Whether all requested Ritz pairs met the tolerance.
idx steps
Actual Lanczos steps taken.
Matrix ritz_vectors
nxk matrix – each column is a Ritz vector
Vector ritz_values
k Ritz values (approximate eigenvalues), ascending