# mFlatten: Flattening an Array Along One Mode In tensorBSS: Blind Source Separation Methods for Tensor-Valued Observations

## Description

Reshapes a higher order array (tensor) into a matrix with a process known as m-mode flattening or matricization.

## Usage

 `1` ```mFlatten(x, m) ```

## Arguments

 `x` an (r + 1)-dimensional array with r >= 2. The final mode is understood to correspond to the observations (i.e., its length is usually the sample size n). `m` an integer between 1 and r signifying the mode along which the array should be flattened. Note that the flattening cannot be done w.r.t. the final (r + 1)th mode.

## Details

If the original tensor `x` has the size p_1 x ... x p_r x n, then `mFlatten(x, m)` returns tensor of size p_m x p_1 ... p_{m - 1} p_{m + 1} ... p_r x n obtained by gathering all m-mode vectors of `x` into a wide matrix (an m-mode vector of `x` is any vector of length p_m obtained by varying the mth index and holding the other indices constant).

## Value

The m-mode flattened 3rd order tensor of size p_m x p_1 ... p_{m - 1} p_{m + 1} ... p_r x n.

Joni Virta

## Examples

 ``` 1 2 3 4 5 6 7 8 9 10 11 12``` ```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) dim(mFlatten(x, 1)) dim(mFlatten(x, 2)) ```

tensorBSS documentation built on June 2, 2021, 9:08 a.m.