Algosim documentation: vec

vec

Vectorisation of a matrix.

Syntax

Description

If A is a matrix, then vec(A) is the vectorisation of A, that is, the vector obtained by concatenating the columns of A, from left to right.

Notes

vectorization and vec are synonyms.

To obtain the vector obtained by concatenating the rows of A, from top to bottom, simply “cast” the matrix to a vector using the vector function.

Examples

A ≔ ❨❨2, 1, −i❩, ❨1, 0, 2❩, ❨4, i, 2❩, ❨0, 1, −1❩❩
⎛ 2   1  −i⎞
⎜ 1   0   2⎟
⎜ 4   i   2⎟
⎝ 0   1  −1⎠
vec(A)
(2, 1, 4, 0, 1, 0, i, 1, −i, 2, 2, −1)

See also