amprod {tensr} | R Documentation |
-mode product.
Description
amprod
returns the -mode product of an array with a
matrix.
Usage
amprod(A, M, k)
Arguments
A |
A real valued array. |
M |
A real matrix. |
k |
An integer. The mode along which |
Details
The -mode product of a tensor
with a matrix
results in a tensor whose
-mode unfolding is
times
the
-mode unfolding of
. That is
mat(amprod(A,M,k)) = M %*% mat(A,k)
. More details of the
-mode product can be found in
Kolda and
Bader (2009).
Value
An array whose -mode unfolding is
M %*%
mat(A,k)
.
Author(s)
Peter Hoff.
References
Kolda, T. G., & Bader, B. W. (2009). Tensor decompositions and applications. SIAM review, 51(3), 455-500.
See Also
atrans
for applying multiple -mode
products.
Examples
A <- array(1:8, dim = c(2,2,2))
M <- matrix(1:4, nrow = 2, ncol = 2)
Y <- amprod(A, M, 2)
Y
identical(M %*% mat(A,2), mat(Y,2))
[Package tensr version 1.0.1 Index]