simple_sparse_array {slam} | R Documentation |
Data structures and operators for sparse arrays based on a representation by index matrix and value vector.
simple_sparse_array(i, v, dim = NULL, dimnames = NULL) as.simple_sparse_array(x) is.simple_sparse_array(x)
i |
Integer matrix of array indices. |
v |
Vector of values. |
dim |
Integer vector specifying the size of the dimensions. |
dimnames |
either |
x |
An R object. |
simple_sparse_array
is a generator for
a class of “lightweight” sparse arrays,
represented by index matrices and value vectors.
Currently, only methods for indexing and coercion are implemented.
simple_sparse_array
for sparse arrays.
x <- array(c(1, 0, 0, 2, 0, 0, 0, 3), dim = c(2, 2, 2)) s <- as.simple_sparse_array(x) identical(x, as.array(s)) simple_sparse_array(matrix(c(1, 1, 1, 3, 3, 3), nrow = 2), c(1, 2))