runExactSVD: Exact SVD

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/runExactSVD.R

Description

Perform an exact singular value decomposition.

Usage

1
2
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:

Author(s)

Aaron Lun

See Also

svd for the underlying algorithm.

Examples

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

Example output

List of 3
 $ d: num [1:20] 75.1 74.7 73.8 73.4 72.5 ...
 $ u: num [1:5000, 1:20] -0.019406 -0.023272 -0.008959 0.004626 0.000333 ...
 $ v: num [1:20, 1:20] -0.133 0.016 0.118 0.177 -0.216 ...

BiocSingular documentation built on Nov. 8, 2020, 10:59 p.m.