emptySparse {MatrixExtra} | R Documentation |
Create Empty Sparse Matrix
Description
Creates an empty sparse matrix (all values being zeros) with the requested format and dimensions. This is a faster alternative to calling 'Matrix::Matrix(0, ...)'.
Usage
emptySparse(nrow = 0L, ncol = 0L, format = "R", dtype = "d")
Arguments
nrow |
Desired number of rows for the matrix. |
ncol |
Desired number of columns for the matrix. |
format |
Storage format for the matrix. Options are:
|
dtype |
Data type for the matrix. Options are:
|
Value
A sparse matrix of general type, with the specific class determined by 'format' and 'dtype'.
Examples
### This is very fast despite the large dimensions,
### as no data is held in the resulting object
library(MatrixExtra)
X <- emptySparse(nrow=2^20, ncol=2^25, format="T")
[Package MatrixExtra version 0.1.15 Index]