LowRankMatrix: The LowRankMatrix class

Description Usage Arguments Value Methods for LowRankMatrixSeed objects Methods for LowRankMatrix objects Author(s) See Also Examples

View source: R/LowRankMatrix.R

Description

Definitions of the LowRankMatrixSeed and LowRankMatrix classes and their associated methods. These classes are designed to provide a memory-efficient representation of a low-rank reconstruction, e.g., after a principal components analysis.

Usage

1
2
3
LowRankMatrixSeed(rotation, components)

LowRankMatrix(rotation, components)

Arguments

rotation

A matrix-like object where each row corresponds to a row of the LowRankMatrix object.

This can alternatively be a LowRankMatrixSeed, in which case any value of components is ignored.

components

A matrix-like object where each row corresponds to a column of the LowRankMatrix object.

Value

The LowRankMatrixSeed constructor will return a LowRankMatrixSeed object.

The LowRankMatrix constructor will return a LowRankMatrix object equivalent to tcrossprod(rotation, components).

Methods for LowRankMatrixSeed objects

LowRankMatrixSeed objects are implemented as DelayedMatrix backends. They support standard operations like dim, dimnames and extract_array.

Passing a LowRankMatrixSeed object to the DelayedArray constructor will create a LowRankMatrix object.

Methods for LowRankMatrix objects

LowRankMatrix objects are derived from DelayedMatrix objects and support all of valid operations on the latter. Subsetting, transposition and replacement of row/column names are specialized for greater efficiency when operating on LowRankMatrix instances, and will return a new LowRankMatrix rather than a DelayedMatrix.

All other operations applied to a LowRankMatrix will use the underlying DelayedArray machinery. Unary or binary operations will generally create a new DelayedMatrix instance containing a LowRankMatrixSeed.

Author(s)

Aaron Lun

See Also

runPCA to generate the rotation and component matrices.

Examples

1
2
3
4
a <- matrix(rnorm(100000), ncol=20)
out <- runPCA(a, rank=10)

lr <- LowRankMatrix(out$rotation, out$x)

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