An implementation of the randomized truncated SVD algorithm of Halko, Martinsson & Tropp (2009).
rsvd(M, n, q = 2, oversampling = 2, transpose = FALSE, verbose = FALSE)
A list with components
a matrix whose columns contain the first n
left singular vectors of M
a matrix whose columns contain the first n
right singular vectors of M
a vector containing the first n
singular values of M
a dense or sparse numeric matrix
an integer specifying the desired number of singular components. This argument must be specified and must satisfy n <= min(nrow(M), ncol(M))
.
number of power iterations (Halko et al. recommend q=1
or q=2
)
oversampling factor. The rSVD algorithm computes an approximate SVD factorization of rank n * oversampling
, which is then truncated to the first n
components.
if TRUE
, apply the rSVD algorithm to the transpose t(M)
, which may be more efficient depending on the dimensions of M
whether to display progress messages during execution
Stephanie Evert (https://purl.org/stephanie.evert)
This implementation of randomized truncated SVD is based on the randomized PCA algorithm (Halko et al. 2009, p. 9). The discussion in Sec. 4 and 5 of the paper shows that the same algorithm applies to the case where the columns of A are not centered (Algorithm 4.3 + Algorithm 5.1).
Halko, N., Martinsson, P. G., and Tropp, J. A. (2009). Finding structure with randomness: Stochastic algorithms for constructing approximate matrix decompositions. Technical Report 2009-05, ACM, California Institute of Technology.
svd
, dsm.projection
, sparsesvd