Applies a linear transformation to the mth mode of each individual tensor in an array of tensors

1 | ```
tensorTransform(x, A, m)
``` |

`x` |
Array of an order at least two with the last dimension corresponding to the sampling units. |

`A` |
Matrix corresponding to the desired linear transformation with the number of columns equal to the size of the |

`m` |
The mode from which the linear transform is to be applied. |

Applies the linear transformation given by the matrix *A* of size *q_m x p_m* to the *m*th mode of each of the *n* observed tensors *X_i* in the given *p_1 x p_2 x ... x p_r x n*-dimensional array `x`

. This is equivalent to separately applying the linear transformation given by *A* to each *m*-mode vector of each *X_i*.

Array of size *p_1 x p_2 x ... x p_(m-1) x q_m x p_(m+1) x ... x p_r x n*

Joni Virta

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | ```
# Generate sample data.
n <- 10
x <- t(cbind(rnorm(n, mean = 0),
rnorm(n, mean = 1),
rnorm(n, mean = 2),
rnorm(n, mean = 3),
rnorm(n, mean = 4),
rnorm(n, mean = 5)))
dim(x) <- c(3, 2, n)
# Transform from the second mode
A <- matrix(c(2, 1, 0, 3), 2, 2)
z <- tensorTransform(x, A, 2)
# Compare
z[, , 1]
x[, , 1]%*%t(A)
``` |

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

All documentation is copyright its authors; we didn't write any of that.