Ops.HDF5Matrix

Ops.HDF5Matrix

OTHER

1 Description

Standard R arithmetic operators applied element-wise to HDF5Matrix objects stored on disk. Both operands must be HDF5Matrix objects with identical dimensions.

2 Usage

Ops.HDF5Matrix(e1, e2)

3 Arguments

Parameter Description
e1 An object (left-hand side)
e2 An object (right-hand side)

4 Value

A new containing the result, stored in the same HDF5 file as under a temporary dataset name.

5 Details

Supported operators:

All operations use block-wise processing and optional OpenMP parallelisation, controlled via hdf5matrix_options.

Performance settings:

Global options set via hdf5matrix_options are applied. For explicit control use the R6 methods directly: A$add(B, paral = TRUE, threads = 4).

6 Examples

\donttest{
fn <- tempfile(fileext = ".h5")
A_hdf5 <- hdf5_create_matrix(fn, "data/A", data = matrix(1:12, 3, 4))
B_hdf5 <- hdf5_create_matrix(fn, "data/B", data = matrix(2, 3, 4))

C <- A_hdf5 + B_hdf5
D <- A_hdf5 - B_hdf5
E <- A_hdf5 * B_hdf5
G <- A_hdf5 / B_hdf5

all.equal(as.matrix(C), matrix(1:12, 3, 4) + 2)

hdf5_close_all()
unlink(fn)
}

7 See Also

hdf5matrix_options for global performance settings, HDF5Matrix for R6 methods with explicit parameters