
Last chance! 50% off unlimited learning
Sale ends in
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)
simplify_simple_sparse_array(x, higher = TRUE)
reduce_simple_sparse_array(x, strict = FALSE, order = FALSE)
drop_simple_sparse_array(x)
Integer matrix of array indices.
Vector of values.
Integer vector specifying the size of the dimensions.
either NULL
or the names for the dimensions.
This is a list
with one component for each dimension, either NULL
or a
character vector of the length given by dim
for that
dimension. The list can be named, and the list names will be
used as names for the dimensions. If the list is shorter
than the number of dimensions, it is extended by NULL
's to
the length required.
An R object; an object of class simple_sparse_array
(see Note).
Option to use the dimensions of the values (see Note).
Option to treat violations of sparse representation as error (see Note).
Option to reorder elements (see Note).
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_triplet_matrix
for sparse matrices.
slam_options
for options.
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, 3, 1, 3, 1, 3), nrow = 2), c(1, 2))
Run the code above in your browser using DataLab