vec, vecr#

Purpose#

Creates a column vector by appending the columns/rows of a matrix to each other.

Format#

yc = vec(x)#
yc = vecr(x)#
Parameters:

x (NxK matrix) – data

Returns:
  • yc ((N*K)x1 vector) – the columns of x appended to each other.

  • yr ((N*K)x1 vector) – the rows of x appended to each other and the result transposed.

Examples#

x = { 1 2,
      3 4 };
yc = vec(x);
yr = vecr(x);

The code above assigns the variables yc and yr:

     1       1
yc = 3  yr = 2
     2       3
     4       4

Remarks#

vecr() is much faster.