Learn R Programming

TRES (version 1.1.1)

ttt: Inner product of two tensors

Description

Computes the inner product of two tensors on the specified modes.

Usage

ttt(X, Y, ms)

Arguments

X

A tensor instance.

Y

A tensor instance.

ms

The indices of the modes to compute on.

Value

Return a matrix, the inner product of tensors X and Y on the modes specified by the vector ms.

Details

Two tensors X and Y are unfolded into two matrix with the modes in ms onto the columns. Then implement matrix multiplication on the two matrices. The sizes of the dimensions specified by ms must match, e.g., the number of columns of the two unfolded matrices must match.

Examples

Run this code
# NOT RUN {
 X = rTensor::as.tensor(array(runif(24), c(3, 4, 2)));
 Y = rTensor::as.tensor(array(runif(24), c(3, 4, 2)));
 Z = ttt(X, Y, 1:2)
# }

Run the code above in your browser using DataLab