Expand description
Thick-restarted Lanczos bidiagonalization.
Golub–Kahan–Lanczos bidiagonalization with augmented thick restarts, following
Baglama & Reichel (2005). This is the algorithm behind R’s irlba and, in spirit,
scipy.sparse.linalg.svds.
§Why this rather than crate::lanczos
LAS2 keeps every Lanczos vector it generates, so its basis grows with the iteration
count — unbounded in practice, since iterations defaults to min(rows, cols).
Here the basis is fixed at work vectors (rank + 7 by default) no matter how many
restarts are needed, so peak memory is known before the solve starts:
(work + 1) · cols + work · rows scalarsFor 200k × 30k at rank 50 that is about 95 MiB and it does not grow.
§Method
Each cycle extends the factorization
A·V = U·B
Aᵀ·U = V·Bᵀ + β·v_next·eᵀto work columns, where B is small and bidiagonal, then takes the SVD of B.
Its singular values are the Ritz estimates and |β · P[work-1, i]| is the residual
for triplet i. Unconverged cycles restart from the rank best Ritz vectors plus
the residual direction, which preserves the factorization’s structure — the restart
costs one extra column in B rather than throwing the subspace away.
Structs§
- Irlba
Config - Configuration for
svd_with.
Constants§
- DEFAULT_
EXTRA_ WORK - Default extra basis vectors beyond the requested rank.
- DEFAULT_
MAX_ RESTARTS - Default cap on restart cycles.
- DEFAULT_
TOL - Default relative residual tolerance.
Functions§
- svd
ranklargest singular triplets, defaults throughout.- svd_
centered - PCA:
ranklargest singular triplets of the implicitly mean-centered matrix. - svd_
seed ranklargest singular triplets with a fixed seed.- svd_
with - Compute a decomposition with explicit configuration.