- A randomized blocked algorithm for efficiently computing rank-revealing factorizations of matrices Martinsson et al, 2015 https://arxiv.org/abs/1503.07157
- Efficient randomized algorithms for adaptive low-rank factorizations of large matrices Gu et al, 2016 https://www.researchgate.net/publication/304641525_Efficient_randomized_algorithms_for_adaptive_low-rank_factorizations_of_large_matrices
Procs
proc svd_randomized[T](A: Tensor[T]; n_components = 2; n_oversamples = 5; n_power_iters = 2): tuple[U, S, Vh: Tensor[T]]
-
Compute approximate nearly optimal truncated Singular Value Decomposition of an input matrix a.
Decomposition is truncated to nb_components.
Increasing nb_oversamples or nb_iter increases the accuracy of the approximation
Input:
- A, a matrix of shape M, N
- nb_components: rank/dimension of the approximation i.e. number of singular values and vectors to extract Must be lower than min(M, N) Default to 2 for 2D visualization
- nb_oversamples: Additional number of random projections in the sampling matrix Recommended range 2 .. 10
- nb_power_iter: Number of power iterations Power iterations enforce rapid decay of singular values and allow the algorithm to sample dominant singular values and suppress irrelevant information. Useful for noisy problems.
Returns: with K = nb_components
- U: Unitary matrix of shape M, K with rank-K approximation of left singular vectors as columns
- S: Rank-k approximation of singular values diagonal of length K in decreasing order
- Vh: Unitary matrix of shape K, N with rank-K approximation of right singular vectors as rows
This is an approximate solution of the equation: A = U S V.h
- with S being a diagonal matrix of singular values
- with V being the right singular vectors and V.h being the hermitian conjugate of V for real matrices, this is equivalent to V.t (transpose)
⚠️: Input must not contain NaN
Exception:
- This can throw if the algorithm did not converge.
References:
- A Randomized Algorithm for Principal Component Analysis Rockhlin et al, 2009 https://epubs.siam.org/doi/10.1137/080736417
- Finding structure with randomness, Probabilistic algorithms for constructing approximate matrix decomposition Halko et al, 2011 http://users.cms.caltech.edu/~jtropp/papers/HMT11-Finding-Structure-SIREV.pdf
- A randomized algorithm for the decomposition of matrices Martinsson et al, 2011 https://www.sciencedirect.com/science/article/pii/S1063520310000242
- Randomized Algorithms for Low-Rank Matrix Factorizations: Sharp performance bounds Witten et al, 2013 https://arxiv.org/abs/1308.5697
- Subspace Iteration Randomization and Singular Value Problems Gu, 2014 https://epubs.siam.org/doi/10.1137/130938700
- An implementation of a randomized algorithm for principal component analysis Szlam et al, 2014 https://arxiv.org/abs/1412.3510
- Randomized methods for matrix computations Martinsson, 2016 https://arxiv.org/abs/1607.01649
- RSVDPACK: An implementation of randomized algorithms for computing the singular value, interpolative, and CUR decompositions of matrices on multi-core and GPU architectures Voronin, 2016 https://arxiv.org/abs/1502.05366
- Randomized Matrix Decompositions using R Erichson, 2016 https://arxiv.org/abs/1608.02148