Vectorizes an array of array-valued observations into a matrix so that each column of the matrix corresponds to a single observational unit.

1 |

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

Vectorizes a *p_1 x p_2 x ... x p_r x n*-dimensional array into a *p_1 p_2 ... p_r x n*-dimensional matrix, each column of which then corresponds to a single observational unit. The vectorization is done so that the *r*th index goes through its cycle the fastest and the first index the slowest.

Matrix whose columns contain the vectorized observed tensors.

Joni Virta

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | ```
# Generate sample data.
n <- 100
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)
# Matrix of vectorized observations.
vecx <- tensorVectorize(x)
# The covariance matrix of individual tensor elements
cov(t(vecx))
``` |

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

Please suggest features or report bugs with the GitHub issue tracker.

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