33 throw std::invalid_argument(
"lanczos: k must satisfy 0 < k <= n");
47 for (
idx i = 0;
i < n; ++
i) V(
i, 0) = (
i == 0) ? 1.0 : 0.0;
97 idx m = std::min(steps,
k);
115 for (
idx r = 0;
r < n; ++
r)
131 for (
idx r = 0;
r < n; ++
r) {
Dense row-major matrix with optional GPU storage.
Full symmetric eigendecomposition via cyclic Jacobi sweeps.
Lanczos algorithm – k extreme eigenvalues of a large sparse matrix.
Backend
Selects which backend handles a linalg operation.
real beta(real a, real b)
B(a, b) – beta function.
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
EigenResult eig_sym(const Matrix &A, real tol=1e-12, idx max_sweeps=100, Backend backend=Backend::seq)
Full eigendecomposition of a real symmetric matrix.
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.
Full eigendecomposition result: A = V * diag(values) * V^T.
Result of a Lanczos eigensolver.