Skip to contents

SOMASparseNDArray is a sparse, N-dimensional array with offset (zero-based) integer indexing on each dimension. The SOMASparseNDArray has a user-defined schema, which includes:

  • type - a primitive type, expressed as an Arrow type (e.g., int64, float32, etc)

  • shape - the shape of the array, i.e., number and length of each dimension

All dimensions must have a positive, non-zero length.

Note - on TileDB this is an sparse array with N int64 dimensions of domain [0, maxInt64), and a single attribute.

Duplicate writes

As duplicate index values are not allowed, index values already present in the object are overwritten and new index values are added. (lifecycle: experimental)

Methods

Inherited methods


Method read()

Reads a user-defined slice of the SOMASparseNDArray

Usage

SOMASparseNDArray$read(
  coords = NULL,
  result_order = "auto",
  log_level = "auto"
)

Arguments

coords

Optional list of integer vectors, one for each dimension, with a length equal to the number of values to read. If NULL, all values are read. List elements can be named when specifying a subset of dimensions.

result_order

Optional order of read results. This can be one of either "ROW_MAJOR, "COL_MAJOR", or "auto"` (default).

log_level

Optional logging level with default value of "warn".

iterated

Option boolean indicated whether data is read in call (when FALSE, the default value) or in several iterated steps.


Method write()

Write matrix-like data to the array. (lifecycle: experimental)

Usage

SOMASparseNDArray$write(values, bbox = NULL)

Arguments

values

Any matrix-like object coercible to a TsparseMatrix. Character dimension names are ignored because SOMANDArray's use integer indexing.

bbox

A vector of integers describing the upper bounds of each dimension of values. Generally should be NULL.


Method nnz()

Retrieve number of non-zero elements (lifecycle: experimental)

Usage

SOMASparseNDArray$nnz()

Returns

A scalar with the number of non-zero elements


Method clone()

The objects of this class are cloneable with this method.

Usage

SOMASparseNDArray$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.