Skip to main content

Module lanczos

Module lanczos 

Source
Expand description

LAS2, from SVDLIBC. Deprecated and numerically unreliable — enable las2 only to keep a 1.x caller compiling while it moves to irlba. Single-vector Lanczos with selective reorthogonalization — a port of LAS2 from Doug Rohde’s SVDLIBC.

§⚠ This module is deprecated and numerically unreliable

LAS2 as implemented here does not agree with a dense LAPACK reference on any matrix class tested. The largest singular value comes back with 18%–100% relative error, including on diag(n, n-1, ..., 1) at full requested rank. The defect is inherited from published 1.x, not introduced by the sprs port — running single-svdlib 1.0.9 on identical fixtures reproduces the same wrong values.

Two causes are known:

  1. Fixed. imtqlb hoisted its shift origin out of the iteration loop, so every eigenvalue after the first used a stale shift. EISPACK IMTQL1 assigns p = d(l) inside the loop. This is what produced the “imtqlb had some convergence issues” warnings 1.x printed on nearly every input before continuing with corrupted Ritz values.
  2. Open. ritvec reads s[k*js + i] — row k — while imtql2 stores eigenvectors as columns. Transposing roughly halves the residual error but does not eliminate it, so at least one further defect remains.

Use crate::irlba instead: restarted Lanczos bidiagonalization, validated against LAPACK, with a Krylov basis bounded by the requested rank rather than growing to min(rows, cols).

The module is retained so 2.0 does not silently drop the API, and so the repair has a home. The accuracy tests are present but #[ignore]d, and report_accuracy_vs_lapack prints the current error profile.

Constants§

DEFAULT_END_INTERVAL
Default end interval: eigenvalues inside it are considered unwanted.
DEFAULT_KAPPA
Default relative accuracy for accepting a Ritz value as an eigenvalue.

Functions§

svdDeprecated
SVD at full dimensionality with default tolerances.
svd_dimDeprecated
SVD at the requested dimensionality with default tolerances.
svd_dim_seedDeprecated
SVD at the requested dimensionality with a fixed seed.
svd_las2Deprecated
Compute a singular value decomposition with full control.