Description Usage Arguments Details Value Author(s) See Also Examples
View source: R/tensorTransform2.R
Applies a linear transformation to user selected modes of each individual tensor in an array of tensors. The function is a generalization of tensorTransform
which only transforms one specific mode.
1 | tensorTransform2(x, A, mode, transpose = FALSE)
|
x |
Array of order r+1 >= 2 where the last dimension corresponds to the sampling units. |
A |
A list of r matrices to apply linearly to the corresponding mode. |
mode |
subsetting vector indicating which modes should be linearly transformed by multiplying them with the corresponding matrices from |
transpose |
logical. Should the matrices in |
For the modes i_1,...,i_k, specified via mode
, the function applies the linear transformation given by the matrix A^(i_j) of size q_i_j x p_i_j to the i_jth mode of each of the n observed tensors X_i_j in the given p_1 x p_2 x ... x p_r x n-dimensional array x
.
Array with r+1 dimensions where the dimensions specfied via mode
are transformed.
Klaus Nordhausen
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | n <- 5
x <- array(rnorm(5*6*7), dim = c(7, 6, 5))
A1 <- matrix(runif(14), ncol = 7)
A2 <- matrix(rexp(18), ncol = 6)
A <- list(A1 = A1, A2 = A2)
At <- list(tA1 = t(A1), tA2 = t(A2))
x1 <- tensorTransform2(x, A, 1)
x2 <- tensorTransform2(x, A, -2)
x3 <- tensorTransform(x, A1, 1)
x1 == x2
x1 == x3
x4 <- tensorTransform2(x,At,-2, TRUE)
x1 == x4
x5 <- tensorTransform2(x, A, 1:2)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.