Learn R Programming

scidb (version 1.2-0)

tsvd: tsvd

Description

Compute a partial singular value decomposition or principal components of a sparse or dense SciDB matrix.

Usage

tsvd(x, nu, tol = 0.1, maxit = 20, tx, v, pca = FALSE)

Arguments

x
A scidb object representing a matrix.
nu
Optional number of singular values/vectors to compute. See notes below.
tol
(Optional) estimation error tolerance (see details).
maxit
(Optional) maximum number of iterations in the method.
tx
(Optional) pre-computed transpose of matrix x.
v
(Optional) iteration starting vector.
pca
Set to TRUE to compute principal components (singular vectors of the centered matrix).

Value

A list of three scidb objects corresponding to a matrix of left singular vectors, a vector of singular values, and a matrix of transposed right singular vectors, respectively.

Details

The tsvd method uses Baglama and Reichel's efficient agumented implicitly restarted Lanczos method for computing a truncated SVD of large dense or sparse matrices. The method works best for the hard case of close to square matrices. For matrices where the row and column dimensions are very different (tall, skinny or short, fat matrices), consider the computationally cheaper eigenvalue decomposition of the small matrix cross product instead.

The method is an iterative one. The tol parameter sets the error tolerance as defined in the paper and the irlba package vignette available on CRAN. Smaller values yield more accurate estimations at the cost of more iterations.

The method requires multiplication by the matrix x and its transpose. If you already have the transpose matrix stored in SciDB, you can optionally specify that in the tx argument.

The starting vector v defaults to a vector of ones. If this vector is near the matrix null space then the algorithm may not converge. Specify an alternate starting vector as required.

Set the pca argument to TRUE to indicate that you desire principal components. The method will efficiently compute the singular vectors of the centered matrix in that case, without explicitly forming it to preserve sparsity.

References

"Augmented Implicitly Restarted Lanczos Bidiagonalization Methods", J. Baglama and L. Reichel, SIAM J. Sci. Comput. 2005.

See Also

scidb

Examples

Run this code
## Not run: 
# x <- as.scidb(matrix(rnorm(500*500),500))
# y <- tsvd(x)
# print(y)
# ## End(Not run)

Run the code above in your browser using DataLab