matter_arr-class: Out-of-Core Arrays

matter_arr-classR Documentation

Out-of-Core Arrays

Description

The matter_arr class implements out-of-core arrays.

Usage

## Instance creation
matter_arr(data, type = "double", path = NULL,
    dim = NA_integer_, dimnames = NULL, offset = 0, extent = NA_real_,
    readonly = NA, append = FALSE, rowMaj = FALSE, ...)

matter_mat(data, type = "double", path = NULL,
    nrow = NA_integer_, ncol = NA_integer_, dimnames = NULL,
    offset = 0, extent = NA_real_, readonly = NA,
    append = FALSE, rowMaj = FALSE, ...)

matter_vec(data, type = "double", path = NULL,
    length = NA_integer_, names = NULL, offset = 0, extent = NA_real_,
    readonly = NA, append = FALSE, rowMaj = FALSE, ...)

## Additional methods documented below

Arguments

data

An optional data vector which will be initially written to virtual memory if provided.

type

A 'character' vector giving the storage mode of the data in virtual memory. See ?"matter-types" for possible values.

path

A 'character' vector of the path(s) to the file(s) where the data are stored. If NULL, then a temporary file is created using tempfile, which will be managed according the getOption("matter.temp.gc").

dim, nrow, ncol, length

The dimensions of the array, or the number of rows and columns, or the length.

dimnames, names

The names of the matrix dimensions or vector elements.

offset

A vector giving the offsets in number of bytes from the beginning of each file in 'path', specifying the start of the data to be accessed for each file.

extent

A vector giving the length of the data for each file in 'path', specifying the number of elements of size 'type' to be accessed from each file.

readonly

Whether the data and file(s) should be treated as read-only or read/write.

append

If TRUE, then all offsets will be adjusted to be from the end-of-file (for all files in path), and readonly will be set to FALSE.

rowMaj

Whether the data is stored in row-major or column-major order. The default is to use column-major order, which is the same as native R matrices.

...

Additional arguments to be passed to constructor.

Value

An object of class matter_arr.

Slots

data:

This slot stores any information necessary to access the data for the object (which may include the data itself and/or paths to file locations, etc.).

type:

The storage mode of the accessed data when read into R. This is a 'factor' with levels 'raw', 'logical', 'integer', 'numeric', or 'character'.

dim:

Either 'NULL' for vectors, or an integer vector of length one of more giving the maximal indices in each dimension for matrices and arrays.

names:

The names of the data elements for vectors.

dimnames:

Either 'NULL' or the names for the dimensions. If not 'NULL', then this should be a list of character vectors of the length given by 'dim' for each dimension. This is always 'NULL' for vectors.

ops:

Deferred arithmetic operations.

transpose:

Indicates whether the data is stored in row-major order (TRUE) or column-major order (FALSE). For a matrix, switching the order that the data is read is equivalent to transposing the matrix (without changing any data).

indexed:

For matter_mat only. Indicates whether the pointers to rows or columns are indexed for quick access or not.

Extends

matter

Creating Objects

matter_arr instances can be created through matter_arr() or matter(). Matrices and vectors can also be created through matter_mat() and matter_vec().

Methods

Class-specific methods:

path(x), path(x) <- value:

Get or set the data source names, i.e., file path(s).

fetch(x, ...):

Pull data into shared memory.

flash(x, ...):

Push data to a temporary file.

Standard generic methods:

length(x), length(x) <- value:

Get or set length.

dim(x), dim(x) <- value:

Get or set 'dim'.

names(x), names(x) <- value:

Get or set 'names'.

dimnames(x), dimnames(x) <- value:

Get or set 'dimnames'.

x[...], x[...] <- value:

Get or set the elements of the array.

as.vector(x):

Coerce to a vector.

as.array(x):

Coerce to an array.

cbind(x, ...), rbind(x, ...):

Combine matrices by row or column.

t(x):

Transpose a matrix. This is a quick operation which only changes metadata and does not touch the data representation.

rowMaj(x):

Check the data orientation.

Author(s)

Kylie A. Bemis

See Also

matter

Examples

x <- matter_arr(1:1000, dim=c(10,10,10))
x

kuwisdelu/matter documentation built on Dec. 8, 2024, 8:09 p.m.