ttm: Tensor Times Matrix (m-Mode Product)

ttm-methodsR Documentation

Tensor Times Matrix (m-Mode Product)

Description

Contracted (m-Mode) product between a DelayedArray (Tensor) of arbitrary number of modes and a matrix. The result is folded back into Tensor.

Usage

ttm(darr, mat, m = NULL)

## S4 method for signature 'DelayedArray,DelayedArray'
ttm(darr, mat, m)

Arguments

darr

DelayedArray object

mat

input 2D DelayedArray with same number columns as the mth mode of darr

m

the mode to contract on

Details

This function is an extension of the ttm by DelayedArray.

By definition, rs_unfold(ttm(darr, mat), m) = mat%*%rs_unfold(darr, m), so the number of columns in mat must match the mth mode of darr. For the math on the m-Mode Product, see Kolda and Bader (2009).

Value

a DelayedArray object with K modes

Note

The mth mode of darr must match the number of columns in mat. By default, the returned Tensor does not drop any modes equal to 1.

References

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

See Also

rs_unfold, ttl

Examples

library("DelayedRandomArray")
darr <- RandomUnifArray(c(2,3,4))
mat <- RandomUnifArray(c(10,4))
ttm(darr, mat, m=3)

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