Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Create a block-diagonal matrix from submatrices
ResourceFunction["BlockDiagonalMatrix"][m1,m2,…] constructs a matrix with submatrices mi on the diagonal. |
Create a block-diagonal matrix from three matrices:
In[1]:= | ![]() |
Out[1]= | ![]() |
Use non-square matrices:
In[2]:= | ![]() |
Out[2]= | ![]() |
Empty lists are treated as zero-dimensional matrices:
In[3]:= | ![]() |
Out[3]= | ![]() |
The dimensions of the result are the sum of the dimensions of the submatrices:
In[4]:= | ![]() |
Out[5]= | ![]() |
In[6]:= | ![]() |
Out[6]= | ![]() |
In[7]:= | ![]() |
Out[7]= | ![]() |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License