| diag_op | R Documentation |
Applies an element-wise binary operation between an
HDF5Matrix and a diagonal vector (a 1-row or 1-column
HDF5Matrix). 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 HDF5Matrix.
diag_op(x, diag, op = "+", ...)
## S3 method for class 'HDF5Matrix'
diag_op(x, diag, op = "+", outgroup = NULL, outdataset = NULL, ...)
x |
An |
diag |
An |
op |
Character. One of |
... |
Additional arguments passed to |
outgroup |
Character or |
outdataset |
Character or |
A new HDF5Matrix.
diag_scale
tmp <- tempfile(fileext = ".h5")
M <- hdf5_create_matrix(tmp, "data/M", data = matrix(rnorm(10000), 100, 100))
d <- hdf5_create_matrix(tmp, "data/d", data = matrix(rnorm(10000), 100, 100))
R1 <- diag_op(M, d, "*") # scale each column
R2 <- M * d # same via operator auto-dispatch
hdf5_close_all()
unlink(tmp)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.