irlba

Fast and memory efficient methods for truncated singular value
decomposition and principal components analysis of large sparse and dense
matrices.

Implicitly-restarted Lanczos methods for fast truncated singular value
decomposition of sparse and dense matrices (also referred to as partial SVD).
IRLBA stands for Augmented, Implicitly Restarted Lanczos
Bidiagonalization Algorithm. The package provides the following
functions (see help on each for details and examples).

Added a version of Shen and Huang's Sparse PCA/SVD L1-penalized matrix decomposition (ssvd()).

Fixed valgrind errors.

Deprecated features

I will remove partial_eigen() in a future version. As its documentation
states, users are better off using the RSpectra package for eigenvalue
computations (although not generally for singular value computations).

The mult argument is deprecated and will be removed in a future version. We
now recommend simply defining a custom class with a custom multiplcation
operator. The example below illustrates the old and new approaches.

library(irlba)

set.seed(1)

A <- matrix(rnorm(100), 10)

# ------------------ old way ----------------------------------------------

# A custom matrix multiplication function that scales the columns of A

# (cf the scale option). This function scales the columns of A to unit norm.

col_scale <- sqrt(apply(A, 2, crossprod))

mult <- function(x, y)

{

# check if x is a vector

if (is.vector(x))

{

return((x %*% y) / col_scale)

}

# else x is the matrix

x %*% (y / col_scale)

}

irlba(A, 3, mult=mult)$d

## [1] 1.820227 1.622988 1.067185

# Compare with:

irlba(A, 3, scale=col_scale)$d

## [1] 1.820227 1.622988 1.067185

# Compare with:

svd(sweep(A, 2, col_scale, FUN=`/`))$d[1:3]

## [1] 1.820227 1.622988 1.067185

# ------------------ new way ----------------------------------------------

We have learned that using R's existing S4 system is simpler, easier, and more
flexible than using custom arguments with idiosyncratic syntax and behavior.
We've even used the new approach to implement distributed parallel matrix
products for very large problems with amazingly little code.

Wishlist / help wanted...

More Matrix classes supported in the fast code path

Help improving the solver for singular values in tricky cases (basically, for ill-conditioned problems and especially for the smallest singular values); in general this may require a combination of more careful convergence criteria and use of harmonic Ritz values; Dmitriy Selivanov has proposed alternative convergence criteria in https://github.com/bwlewis/irlba/issues/29 for example.