unfold: Tensor Unfolding of 2D DelayedArray

unfold-methodsR Documentation

Tensor Unfolding of 2D DelayedArray

Description

Unfolds the tensor into a matrix, with the modes in rs onto the rows and modes in cs onto the columns. Note that c(rs,cs) must have the same elements (order doesn't matter) as dim(darr). Within the rows and columns, the order of the unfolding is determined by the order of the modes. This convention is consistent with Kolda and Bader (2009).

Usage

unfold(darr, row_idx, col_idx)

## S4 method for signature 'DelayedArray'
unfold(darr, row_idx, col_idx)

Arguments

darr

DelayedArray object

row_idx

the indices of the modes to map onto the row space

col_idx

the indices of the modes to map onto the column space

Details

This function is an extension of the unfold by DelayedArray.

For Row Space Unfolding or m-mode Unfolding, see rs_unfold. For Column Space Unfolding or matvec, see cs_unfold.

vec returns the vectorization of the tensor.

Value

2D DelayedArray with prod(row_idx) rows and prod(col_idx) columns

References

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

See Also

k_unfold, matvec, rs_unfold, cs_unfold

Examples

library("DelayedRandomArray")
darr <- RandomUnifArray(c(2,3,4))
unfold(darr, row_idx=2, col_idx=c(3,1))

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