Matrix Utilities

1 Overview

Diagonal operations and sparse matrix multiplication utilities for HDF5Matrix objects.

2 Functions

2.1 diag_op

Applies an element-wise binary operation between an and a diagonal vector (a 1-row or 1-column ). The vector is broadcast across each row of the matrix.

The standard arithmetic operators (, , , ) dispatch automatically to this function when one operand is a 1-row or 1-column .

2.2 diag_scale

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

2.3 diag

Overrides to dispatch on objects. For plain R matrices/vectors the call is forwarded to .

When is an , extracts the diagonal as an in-memory numeric vector (length = min(nrow, ncol)).

2.4 multiply_sparse

Generic function for block-wise sparse matrix multiplication. The method for computes using the BigDataStatMeth sparse multiplication algorithm, which skips all-zero blocks and is more efficient when one or both matrices are highly sparse.