virtual_mat-class {matter} | R Documentation

## Virtual Matrices

### Description

The `virtual_mat` class implements virtual matrices, which may hold any matrix-like objects. It is provided primarily to allow combining of `matter` matrix classes that could not be combined otherwise.

### Usage

    ## Instance creation
    virtual_mat(data, datamode = "double", rowMaj = FALSE,
                dimnames = NULL, index = NULL, transpose = FALSE,
                chunksize = getOption("matter.default.chunksize"), ...)

    # Check if an object is a virtual matrix
    is.virtual(x)

    # Coerce an object to a virtual matrix
    as.virtual(x, ...)

    ## Additional methods documented below

### Arguments

`data` | A list of matrices or vectors to combine.
`datamode` | A 'character' vector giving the storage mode of the data in virtual memory. Allowable values are R numeric and logical types ('logical', 'integer', 'numeric') and their C equivalents.
`rowMaj` | Whether the matrices in `data` are combined by row (`TRUE`) or by column (`FALSE`.
`dimnames` | The names of the virtual matrix dimensions.
`index` | A length-2 list of row and column indices giving a submatrix, if desired.
`transpose` | Should the matrix be transposed?
`chunksize` | The (suggested) maximum number of elements which should be accessed at once by summary functions and linear algebra. Ignored when explicitly subsetting the dataset.
`x` | An object to check if it is a virtual matrix or coerce to a virtual matrix.
`...` | Additional arguments to be passed to constructor.

### Value

An object of class `virtual_mat`.

### Slots

`data`:

  A list of the original matrices or row/column-vectors.

`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 'r' for read-only access, or 'rw' 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.

index

  A length-2 list of row and column indices giving a virtual submatrix.

transpose

  `TRUE` if the virtual matrix should be transposed, and `FALSE` otherwise.

### Extends

`matter`

### Creating Objects

`virtual_mat` instances can be created through `virtual_mat()`.

### Methods

Standard generic methods:

`x[i, j, ..., drop]`:

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

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

  Combine virtual 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.

### Author(s)

Kylie A. Bemis

### See Also

`matter`

### Examples

    x <- matrix(runif(50), nrow=10, ncol=5)

    x <- virtual_mat(list(x, x))
    x[]

[Package matter version 1.16.0 Index]