65 idx max_sweeps = 100);
82 idx oversampling = 10,
Dense row-major matrix with optional GPU storage.
Backend enum for linear algebra operations.
Thin wrappers around C++17 <cmath> and <numeric> with readable names.
SVDResult svd_truncated(const Matrix &A, idx k, Backend backend=default_backend, idx oversampling=10, Rng *rng=nullptr)
Randomized truncated SVD – top-k singular triplets.
Backend
Selects which backend handles a linalg operation.
SVDResult svd(const Matrix &A, Backend backend=lapack_backend, real tol=1e-12, idx max_sweeps=100)
Full SVD of an mxn matrix.
constexpr Backend lapack_backend
constexpr Backend default_backend
QR factorization via Householder reflections.
Seeded pseudo-random number generator (Mersenne Twister). Pass a pointer to rng_* functions to draw s...
Result of a Singular Value Decomposition: A = U * diag(S) * V^T.
Matrix Vt
rxn right singular vectors (rows orthonormal)
Matrix U
mxr left singular vectors (columns orthonormal)
Vector S
r singular values in descending order
bool converged
Whether Jacobi converged (always true for randomized)
idx sweeps
Jacobi sweeps (full SVD only; 0 for randomized)