Click or drag to resize

Stacking Matrices

Hereinafter the following convention is used:

  • VSmall Greek – small Greek letters are used to denote scalars;

  • VSmall Latin – small Latin letters are used to denote vectors;

  • VCapital Latin – capital Latin letters are used to denote matrices.

Methods

Stacking matrices provides methods to concatenate two matrices horizontally, vertically or diagonally.

Operation

Description

Performance

horizontal stack

Stacks the given matrices horizontally. The new matrix is n-by-m+k matrix.

given:

MTwo Hor

the result will be:

MHor Stack

Returning result:

methodHorizontalStack(Matrix, Matrix)

Out of place:

methodHorizontalStack(Matrix, Matrix, Matrix)

vertical stack

Stacks the given matrices vertically. The new matrix is n+l-by-m matrix.

given:

MTwo Ver

the result will be:

MVer Stack

Returning result:

methodVerticalStack(Matrix, Matrix)

Out of place:

methodVerticalStack(Matrix, Matrix, Matrix)

diagonal stack

Stacks the given matrices diagonally. The new matrix is n+l-by-m+k matrix. The values of the off-diagonal blocks are unchanged.

given:

MTwo Diag

the result will be:

MDiag Stack

Returning result:

methodDiagonalStack(Matrix, Matrix)

Out of place:

methodDiagonalStack(Matrix, Matrix, Matrix)

See Also