up previous next
BlockMat

create a block matrix

Syntax
BlockMat(LIST of LIST of MAT: L): MAT

Description
This function creates a block matrix from a LIST of rows of matrices. The following restrictions on the sizes of the matrices apply: in each row list: all matrices must have the same number of rows; for all row list: the total number of columns must be the same.

The function BlockMat2x2 has a simpler syntax for a 2x2 block matrix.

Example
/**/  A := RowMat([1,2,3,4]);   B := RowMat([0,0]);
-- /**/ BlockMat2x2(A,B, B,A);  --> !!! ERROR !!! as expected
/**/  BlockMat([[A,B], [B,A]]);
matrix(QQ,
 [[1, 2, 3, 4, 0, 0],
  [0, 0, 1, 2, 3, 4]])
/**/  BlockMat([[A,B], [RowMat(1..6)]]);
matrix(QQ,
 [[1, 2, 3, 4, 0, 0],
  [1, 2, 3, 4, 5, 6]])

See Also