# CoCoA:BlockMatrix

## BlockMatrix

create a block matrix

### Description

This function creates a block matrix. Each entry of the input list L

has the form [M_1,...,M_k] where each M_i is either: (i) a matrix (or

list cast-able to a matrix) or (ii) the number 0, representing a zero matrix of arbitrary size. The entry represents a row of a block matrix. For instance, if A, B, C, and D are matrices, then BlockMatrix([[A,B,0],[C,0,D]]) will return a matrix of the form <verbatim>

```               | A B 0 |
| C 0 D |.
```

</verbatim> The obvious restrictions on the sizes of the matrices apply. In the above example, we would need the number of rows in A and B to be the same. Similarly for C and D. The number of columns in A and C would need to be the same.

#### Example

```  A := [[1,2,3], [4,5,6]];
B := [[1,2], [3,4]];
C := [[1,1,1], [2,2,2], [3,3,3]];
D := [[4,4], [5,5], [6,6]];
BlockMatrix([[A,B,0], [C,0,D]]);
Mat([
[1, 2, 3, 1, 2, 0, 0],
[4, 5, 6, 3, 4, 0, 0],
[1, 1, 1, 0, 0, 4, 4],
[2, 2, 2, 0, 0, 5, 5],
[3, 3, 3, 0, 0, 6, 6]
])
-------------------------------
```

### Syntax

```BlockMatrix(L:LIST):MAT

where L is a list representing a block matrix.
```

```   <type>list</type>
<type>matrix</type>
```