rsvd: rsvd

Description Usage Arguments Details Value Communication References Examples

View source: R/rsvd.r

Description

Randomized singular value decomposition.

Usage

1
rsvd(x, k = 1, q = 2, retu = TRUE, retv = TRUE)

Arguments

x

The input data matrix.

k

The number of singular values and/or left/right singular vectors to estimate.

q

An integer exponent, say 1, 2, or 3. See the paper for details.

retu

Logical; should the left singular vectors ("U") be returned?

retv

Logical; should the right singular vectors ("V") be returned?

Details

A randomized SVD is an approximate method for computing using random projections to estimate singular values/vectors. It is usually faster than a full SVD (say via svd()) when only the first few singular values/vectors are needed.

Value

A list of elements d, u, and v, as with R's own svd(). The elements are, respectively, a regular vector, a shaq, and a regular matrix.

Communication

The operation is completely local except for forming the crossproduct, which is an allreduce() call, quadratic on the number of columns.

References

Halko, Martinsson, and Tropp. 2011. Finding structure with randomness: probabilistic algorithms for constructing approximate matrix decompositions. SIAM Review 53 217-288.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Not run: 
library(kazaam)
x = ranshaq(runif, 10, 3)

svd = rsvd(x)
comm.print(svd$d) # a globally owned vector
svd$u # a shaq
comm.print(svd$v) # a globally owned matrix

finalize()

## End(Not run)

RBigData/pbdSHAQ documentation built on Nov. 9, 2021, 9:10 a.m.