| Syntax: |
vector = UNFOLD( matrix )
|
The UNFOLD function has one argument, which must be a
matrix. The result is a vector formed by unfolding the rows of the matrix.
Suppose that matrix m has r rows and c columns.
Then
UNFOLD(m)[i+(j-1)*r] = m[i,j] for i = 1,2,...,r and
j = 1,2,...,c.
Examples
Suppose that
| 1 4 7 10 |
M = | 2 5 8 11 |
| 3 6 9 12 |
| function | result |
UNFOLD(M) |
[1;2;3;4;5;6;7;8;9;10;11;12] |
| Note: | if X is a vector and N is a scalar such than
LEN(X) is divisible by N, thenUNFOLD(FOLD(X,N)) is equal to X |
if M is a matrix with R rows, thenFOLD(UNFOLD(M),R) is equal to M |