runSVD {BiocSingular} | R Documentation

## Run SVD

### Description

Perform a singular value decomposition on an input matrix with a specified algorithm.

### Usage

    runSVD(x, k, nu=k, nv=k, center=FALSE, scale=FALSE,
        BPPARAM=SerialParam(), ..., BSPARAM=ExactParam())

### 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` | Numeric vector, logical scalar or `NULL`, specifying values to subtract from each column of `x` - see `?"BiocSingular-options"`.
`scale` | Numeric vector, logical scalar or `NULL`, specifying values to divide each column of `x` - see `?"BiocSingular-options"`.
`BPPARAM` | A BiocParallelParam object specifying how parallelization should be performed.
`...` | Further arguments to pass to specific methods.
`BSPARAM` | A BiocSingularParam object specifying the type of algorithm to run.

### Details

The class of `BSPARAM` will determine the algorithm that is used, see `?BiocSingularParam` for more details. The default is to use an exact SVD via `runExactSVD`.

### 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

`runExactSVD`, `runIrlbaSVD` and `runRandomSVD` for the specific functions.

### Examples

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

    out.exact0 <- runSVD(a, k=4)
    str(out.exact0)

    out.exact <- runSVD(a, k=4, BSPARAM=ExactParam())
    str(out.exact)

    out.irlba <- runSVD(a, k=4, BSPARAM=IrlbaParam())
    str(out.exact)

    out.random <- runSVD(a, k=4, BSPARAM=RandomParam())
    str(out.random)

[Package BiocSingular version 1.6.0 Index]