runIrlbaSVD: Approximate SVD with 'irlba'

View source: R/runIrlbaSVD.R

runIrlbaSVDR Documentation

Approximate SVD with irlba

Description

Perform an approximate singular value decomposition with the augmented implicitly restarted Lanczos bidiagonalization algorithm.

Usage

runIrlbaSVD(x, k=5, nu=k, nv=k, center=FALSE, scale=FALSE, deferred=FALSE,
    extra.work=7, ..., fold=Inf, BPPARAM=SerialParam())

Arguments

x

A numeric matrix-like object to use in the SVD.

k

Integer scalar specifying the number of singular values to return.

nu

Integer scalar specifying the number of left singular vectors to return.

nv

Integer scalar specifying the number of right singular vectors to return.

center

A logical scalar indicating whether columns should be centered. Alternatively, a numeric vector or NULL - see ?"BiocSingular-options".

scale

A logical scalar indicating whether columns should be scaled. Alternatively, a numeric vector or NULL - see ?"BiocSingular-options".

deferred

Logical scalar indicating whether centering/scaling should be deferred, see ?"BiocSingular-options".

extra.work

Integer scalar specifying the additional number of dimensions to use for the working subspace.

...

Further arguments to pass to irlba.

fold

Numeric scalar specifying the minimum fold difference between dimensions of x to compute the cross-product, see ?"BiocSingular-options".

BPPARAM

A BiocParallelParam object specifying how parallelization should be performed.

Details

If BPPARAM has only 1 worker and a cross-product is not being computed, this function will use irlba's own center and scale arguments. This is effectively equivalent to deferred centering and scaling, despite the setting of deferred=FALSE.

For multiple workers, this function will parallelize all multiplication operations involving x according to the supplied BPPARAM.

The total dimensionality of the working subspace is defined as the maximum of k, nu and nv, plus the extra.work.

Value

A list containing:

  • d, a numeric vector of the first k singular values.

  • u, a numeric matrix with nrow(x) rows and nu columns. Each column contains a left singular vector.

  • u, a numeric matrix with ncol(x) rows and nv columns. Each column contains a right singular vector.

Author(s)

Aaron Lun

See Also

irlba for the underlying algorithm.

Examples

a <- matrix(rnorm(100000), ncol=20)
out <- runIrlbaSVD(a)
str(out)

LTLA/BiocSingular documentation built on Sept. 26, 2024, 4:14 a.m.