# Create a block diagonal matrix with different sizes of blocks in GAP

I don't know if this question has been asked before, or if this is the right site to ask it. If not, let me know about a site where can I ask, please.

Problem: I want to create a block diagonal matrix with different size of blocks in GAP, for example with a block $$1\times 1$$ and a block $$2\times 2$$. I read the manual of GAP and I found the command "BlockMatrix" but I don't understand if it is possible to create such a matrix it with different sizes of blocks.

• The manual entry for BlockMatrix says "All matrices M(i,j) must have the same dimensions." So, you can't make a block matrix with blocks of different sizes with this command. Commented Mar 11, 2022 at 3:08
• Right. So, is there another way to create such a matrix? I'd think that there is. Commented Mar 11, 2022 at 3:13

As long as the blocks are diagonal, you can use DirectSumMat with the matrices to be placed along the diagonal as arguments:
gap> m1:=[[1,2],[3,4]];;

(BlockMatrix is a special representation where blocks must have the same dimension, used mainly for representing induced representations)