diag_scale: Scalar diagonal operation on an HDF5Matrix

View source: R/S3_diagonal.R

diag_scaleR Documentation

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 class 'HDF5Matrix'
diag_scale(
  x,
  scalar,
  op = "multiply",
  outgroup = NULL,
  outdataset = NULL,
  overwrite = FALSE,
  ...
)

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.

Value

A new HDF5Matrix.

See Also

diag_op

Examples


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)



BigDataStatMeth documentation built on May 15, 2026, 1:07 a.m.