unfold: Matrix unfolding

View source: R/utils.R

unfoldR Documentation

Matrix unfolding

Description

Conducts matricizations of a three-way array into matrices according to the selected mode.

Usage

    unfold(x, mode=c("A", "B", "C"))

Arguments

x

Array to be unfolded

mode

the selected mode for unfolding

Value

A matrix represnting the input array, according to the selected mode:

  • Mode=A: B-mode entities are nested within C-mode entities (all the frontal slices of the array next to each other) item Mode=B: C-mode entities nested within A-mode entities (all the horizontal slices of the array next to each other) item Mode C: A-mode entities nested within B-mode entities (all the lateral slices of the array next to each other)

Author(s)

Valentin Todorov valentin.todorov@chello.at

References

H.A.L. Kiers (2000). Towards a standardized notation and terminology in multiway analysis. Journal of Chemometrics 14:105–122.

Examples


(X <- array(1:24, c(4,3,2)))
dim(X)

## matricize the array

##  matricized X with the A-mode entities in its rows
##  all the frontal slices of the array next to each other
##
(Xa <- unfold(X))
dim(Xa)

## matricized X with the B-mode entities in its rows
##  all the horizontal slices of the array next to each other
##
(Xb <- unfold(X, mode="B"))
dim(Xb)

## matricized X with the C-mode entities in its rows
##  all the lateral slices of the array next to each other
##
(Xc <- unfold(X, mode="C"))
dim(Xc)

rrcov3way documentation built on July 9, 2023, 7:44 p.m.