The SparseArray class

Description

This class represents an array with any number of dimensions, in which a significant proportion of entries are zero. The coordinates of nonzero entries are stored along with their values, with all remaining entries assumed to be zero. Methods are provided to index into the array in the standard way, using matrix or vector indices; and for coercing between SparseArray objects and standard (dense) arrays.

Fields

data

Vector of nonzero data values

coords

Integer matrix of nonzero data locations, one per row

dims

Integer vector of dimensions

Methods

aperm(perm)

Permute the dimensions of the array

apply(margin, fun, ...)

Apply a function to margins of the array

flip(dimsToFlip)

Flip the array along one or more directions

setCoordinatesAndData(newCoords, newData)

Update the nonzero locations and data values in the array

setDimensions(newDims)

Change the dimensions of the image

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.