This site is version 0.0.1. Most of the code on this site is drafted by an agent and needs review. I apologize for the AI-speak, we are working on rewriting it!
viv-lang.org

Notebooks · lib/randla/lowrank

Randomized low-rank approximation by range finder, SVD, Nystrom and RPCholesky

The idea of Halko, Martinsson and Tropp (SIAM Review 53, 2011): multiply A by a random matrix with a few more columns than the rank you want, and the product's columns span nearly all of A's dominant range. Everything after that is deterministic linear algebra on matrices with k columns.

  • range_finder(A, l, power, seed, stream): an m-by-l orthonormal Q with A ~ Q Q^T A (HMT Algorithm 4.4, with power rounds of subspace iteration, each re-orthonormalized).
  • qb(A, l, power, seed, stream): Q and B = Q^T A, so A ~ Q B (RandLAPACK's QB).
  • rsvd(A, k, oversample, power, seed): the rank-k truncated SVD, U s Vt, from the SVD of the small B (HMT Algorithm 5.1; RandLAPACK's RSVD).
  • nystrom(A, l, seed, stream) and nystrom_fn(apply, n, l, seed, stream): for A symmetric positive semidefinite, U and lam with A ~ U diag(lam) U^T, from one product A Omega, with the shift that keeps the Cholesky step stable in floating point (Tropp, Yurtsever, Udell and Cevher, "Fixed-rank approximation of a positive-semidefinite matrix from streaming data", NeurIPS 2017; Martinsson and Tropp, Acta Numerica 2020, Algorithm 16).
  • rpcholesky(A, k, seed, stream) and rpcholesky_fn(diag, column, k, seed, stream): randomly pivoted Cholesky (Chen, Epperly, Tropp and Webber 2022): F with A ~ F F^T after reading only k columns of A and its diagonal. Pivot i is drawn with probability proportional to the diagonal of what is left, A - F F^T.

Used with from randla.lowrank import ....

Look inside this program

  • Atlas

    The program’s map: every function and which calls which.

  • There’s no recorded run of this program yet.

Shift+Enter in a cell runs it and moves to the next. Running a cell runs every cell above it too, as one program.

[1]lines 32–226