tensorTransform2 {tensorBSS}R Documentation

Linear Transformations of Tensors from Several Modes

Description

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.

Usage

tensorTransform2(x, A, mode, transpose = FALSE)

Arguments

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

transpose

logical. Should the matrices in A be transposed before the mode wise transformations or not.

Details

For the modes i1,,iki_1,\ldots,i_k, specified via mode, the function applies the linear transformation given by the matrix AijA^{i_j} of size qij×pijq_{i_j} \times p_{i_j} to the iji_jth mode of each of the nn observed tensors XijX_{i_j} in the given p1×p2××pr×np_1 \times p_2 \times \ldots \times p_r \times n-dimensional array x.

Value

Array with r+1 dimensions where the dimensions specfied via mode are transformed.

Author(s)

Klaus Nordhausen

See Also

tensorTransform

Examples

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)

[Package tensorBSS version 0.3.8 Index]