runExactSVD: Exact SVD

View source: R/runExactSVD.R

runExactSVDR Documentation

Exact SVD

Description

Perform an exact singular value decomposition.

Usage

runExactSVD(x, k=min(dim(x)), nu=k, nv=k, center=FALSE, scale=FALSE, 
    deferred=FALSE, 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".

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 any of k, nu or nv exceeds min(dim(x)), they will be capped and a warning will be raised. The exception is when they are explicitly set to Inf, in which case all singular values/vectors of x are returned without any warning.

Note that parallelization via BPPARAM is only applied to the calculation of the cross-product. It has no effect for near-square matrices where the SVD is computed directly.

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

svd for the underlying algorithm.

Examples

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

LTLA/BiocSingular documentation built on March 5, 2024, 5:19 a.m.