Learn R Programming

BigDataStatMeth (version 2.0.3)

diag_scale: Scalar diagonal operation on an HDF5Matrix

Description

Applies a scalar arithmetic operation to the diagonal elements of an HDF5Matrix. Off-diagonal elements are not modified. Delegates to bdDiag_scalar_hdf5().

Usage

diag_scale(x, scalar, op = "multiply", ...)

# S3 method for HDF5Matrix diag_scale( x, scalar, op = "multiply", outgroup = NULL, outdataset = NULL, overwrite = FALSE, ... )

Value

A new HDF5Matrix.

Arguments

x

An HDF5Matrix.

scalar

Numeric scalar.

op

Operation: "add", "subtract", "multiply" (default), or "divide".

...

Additional arguments passed to x$diag_scale(): outgroup, outdataset, overwrite, threads, compression.

outgroup

Character or NULL. HDF5 group where the result is stored. Default "OUTPUT".

outdataset

Character or NULL. Dataset name for the result.

overwrite

Logical. If TRUE, overwrite the existing result dataset. Default FALSE.

See Also

diag_op

Examples

Run this code
# \donttest{
tmp <- tempfile(fileext = ".h5")
M   <- hdf5_create_matrix(tmp, "data/M", data = diag(5))
R   <- diag_scale(M, scalar = 3, op = "multiply")
hdf5_close_all()
unlink(tmp)
# }

Run the code above in your browser using DataLab