Description Usage Arguments Value Methods for DeferredMatrixSeed objects Methods for DeferredMatrix objects Author(s) See Also Examples

View source: R/DeferredMatrix.R

Definitions of the DeferredMatrixSeed and DeferredMatrix classes and their associated methods. These classes are designed to support deferred centering and scaling of the columns prior to a principal components analysis.

1 2 3 | ```
DeferredMatrixSeed(x, center=NULL, scale=NULL)
DeferredMatrix(x, center=NULL, scale=NULL)
``` |

`x` |
A matrix-like object. This can alternatively be a DeferredMatrixSeed, in which case any values of |

`center` |
A numeric vector of length equal to |

`scale` |
A numeric vector of length equal to |

The `DeferredMatrixSeed`

constructor will return a DeferredMatrixSeed object.

The `DeferredMatrix`

constructor will return a DeferredMatrix object equivalent to `t((t(x) - center)/scale)`

.

DeferredMatrixSeed objects are implemented as DelayedMatrix backends.
They support standard operations like `dim`

, `dimnames`

and `extract_array`

.

Passing a DeferredMatrixSeed object to the `DelayedArray`

constructor will create a DeferredMatrix object.

It is possible for `x`

to contain a DeferredMatrix, thus nesting one DeferredMatrix inside another.
This can occasionally be useful in combination with transposition to achieve centering/scaling in both dimensions.

DeferredMatrix objects are derived from DelayedMatrix objects and support all of valid operations on the latter. Several functions are specialized for greater efficiency when operating on DeferredMatrix instances, including:

Subsetting, transposition and replacement of row/column names. These will return a new DeferredMatrix rather than a DelayedMatrix.

Matrix multiplication via

`%*%`

,`crossprod`

and`tcrossprod`

. These functions will return a DelayedMatrix. Also see`?"BiocSingular-options"`

.Calculation of row and column sums and means by

`colSums`

,`rowSums`

, etc.

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

Tranposition can effectively be used to allow centering/scaling on the rows if the input `x`

is transposed.

Aaron Lun

`?"BiocSingular-options"`

for comments about numerical precision with deferred centering and scaling.

1 2 3 4 5 6 7 8 | ```
library(Matrix)
y <- DeferredMatrix(rsparsematrix(10, 20, 0.1),
center=rnorm(20), scale=1+runif(20))
y
crossprod(y)
tcrossprod(y)
y %*% rnorm(20)
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.