diag: DelayedArray Diagonals

diag-methodsR Documentation

DelayedArray Diagonals

Description

Extract or replace the diagonal of a DelayedArray, or substitute the elements to the diagonal DelayedArray.

Usage

diag(darr)
diag(darr) <- value

## S4 method for signature 'DelayedArray'
diag(darr)
## S4 replacement method for signature 'DelayedArray'
diag(darr) <- value

Arguments

darr

DelayedArray object

value

either a single value or a vector of length equal to that of the current diagonal. Should be of a mode which can be coerced to that of darr.

Details

See also DelayedDiagonalArray or diag.

Value

1D DelayedArray (vector) with length min(dim(darr))

References

T. Kolda, B. Bader, "Tensor decomposition and applications". SIAM Applied Mathematics and Applications 2009.

See Also

DelayedDiagonalArray

Examples

library("DelayedRandomArray")
darr <- RandomUnifArray(c(2,3,4))
DelayedTensor::diag(darr)
DelayedTensor::diag(darr)[1] <- 11111
DelayedTensor::diag(darr)[2] <- 22222
DelayedTensor::diag(darr)

rikenbit/DelayedTensor documentation built on Jan. 30, 2023, 6:15 p.m.