# Linear Transformation of Tensors from mth Mode

### Description

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

### Usage

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

### Arguments

`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. |

### Details

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*.

### Value

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*

### Author(s)

Joni Virta

### Examples

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)
``` |

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker. Vote for new features on Trello.