matter_mat-class: Matrices Stored on Disk

Description Usage Arguments Value Slots Extends Creating Objects Methods Author(s) See Also Examples

Description

The matter_mat class implements on-disk matrices.

Usage

1
2
3
4
5
6
7
8
## Instance creation
matter_mat(data, datamode = "double", paths = NULL,
            filemode = ifelse(all(file.exists(paths)), "rb", "rb+"),
            offset = c(0, cumsum(sizeof(datamode) * extent)[-length(extent)]),
            extent = if (rowMaj) rep(ncol, nrow) else rep(nrow, ncol),
            nrow = 0, ncol = 0, rowMaj = FALSE, dimnames = NULL, ...)

## Additional methods documented below

Arguments

data

An optional data matrix which will be initially written to the data on disk if provided.

datamode

A 'character' vector giving the storage mode of the data on disk. Allowable values are the C types ('char', 'uchar', short', 'ushort', 'int', 'uint', 'long', 'ulong', 'float') and their R equivalents ('raw', 'logical', 'integer', 'numeric').

paths

A 'character' vector of the paths to the files where the data are stored. If 'NULL', then a temporary file is created using tempfile.

filemode

The read/write mode of the files where the data are stored. This should be 'rb' for read-only access, or 'rb+' for read/write access.

offset

A vector giving the offsets in number of bytes from the beginning of each file in 'paths', 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 'paths', specifying the number of elements of size 'datamode' to be accessed from each file.

nrow

An optional number giving the total number of rows.

ncol

An optional number giving the total number of columns.

rowMaj

Whether the data should be stored in row-major order (as opposed to column-major order) on disk. Defaults to 'FALSE', for efficient access to columns. Set to 'TRUE' for more efficient access to rows instead.

dimnames

The names of the matrix dimensions.

...

Additional arguments to be passed to constructor.

Value

An object of class matter_mat.

Slots

data:

This slot stores the information about locations of the data on disk and within the files.

datamode:

The storage mode of the accessed data when read into R. This should a 'character' vector of length one with value 'integer' or 'numeric'.

paths:

A 'character' vector of the paths to the files where the data are stored.

filemode:

The read/write mode of the files where the data are stored. This should be 'rb' for read-only access, or 'rb+' for read/write access.

chunksize:

The maximum number of elements which should be loaded into memory at once. Used by methods implementing summary statistics and linear algebra. Ignored when explicitly subsetting the dataset.

length:

The length of the data.

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:

Delayed operations to be applied on atoms.

Extends

matter

Creating Objects

matter_mat instances can be created through matter_mat() or matter().

Methods

Standard generic methods:

x[i, j, ..., drop], x[i, j] <- value:

Get or set the elements of the matrix. Use drop = NULL to return a subset of the same class as the object.

x %*% y:

Matrix multiplication. At least one matrix must be an in-memory R matrix (or vector).

crossprod(x, y):

Alias for t(x) %*% y.

tcrossprod(x, y):

Alias for x %*% t(y).

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 on-disk data.

Author(s)

Kylie A. Bemis

See Also

matter

Examples

1
2
x <- matter_mat(1:100, nrow=10, ncol=10)
x[]

matter documentation built on May 2, 2018, 4:19 a.m.