Skip to contents

SOMADenseNDArray is a dense, N-dimensional array of primitive type, with offset (zero-based) int64 integer indexing on each dimension with domain [0, maxInt64). The SOMADenseNDArray has a user-defined schema, which includes:

  • type: a primitive type, expressed as an Arrow type (e.g., int64, float32, etc), indicating the type of data contained within the array

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

All dimensions must have a positive, non-zero length, and there must be 1 or more dimensions.

The default "fill" value for SOMADenseNDArray is the zero or null value of the array type (e.g., Arrow.float32 defaults to 0.0).

The write method is currently limited to writing from 2-d matrices. (lifecycle: experimental)

Methods

Inherited methods


Method read_arrow_table()

Read as an 'arrow::Table' (lifecycle: experimental)

Usage

SOMADenseNDArray$read_arrow_table(
  coords = NULL,
  result_order = "auto",
  log_level = "warn"
)

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).

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".

Returns

An arrow::Table.


Method read_dense_matrix()

Read as a dense matrix (lifecycle: experimental)

Usage

SOMADenseNDArray$read_dense_matrix(
  coords = NULL,
  result_order = "ROW_MAJOR",
  log_level = "warn"
)

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).

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".

Returns

A matrix object


Method write()

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

More general write methods for higher-dimensional array could be added.

Usage

SOMADenseNDArray$write(values, coords = NULL)

Arguments

values

A matrix. Character dimension names are ignored because SOMANDArray's use integer indexing.

coords

A list of integer vectors, one for each dimension, with a length equal to the number of values to write. If NULL, the default, the values are taken from the row and column names of values.


Method clone()

The objects of this class are cloneable with this method.

Usage

SOMADenseNDArray$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.