View source: R/LowRankMatrix.R
LowRankMatrix | R Documentation |
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.
LowRankMatrixSeed(rotation, components)
LowRankMatrix(rotation, components)
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 |
A matrix-like object where each row corresponds to a column of the LowRankMatrix object. |
The LowRankMatrixSeed
constructor will return a LowRankMatrixSeed object.
The LowRankMatrix
constructor will return a LowRankMatrix object equivalent to tcrossprod(rotation, components)
.
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.
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.
Aaron Lun
runPCA
to generate the rotation and component matrices.
a <- matrix(rnorm(100000), ncol=20)
out <- runPCA(a, rank=10)
lr <- LowRankMatrix(out$rotation, out$x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.