If I have an array of square matrices of different sizes; e.g.,

3-element Array{Array{Float64,2},1}:
 2x2 Array{Float64,2}:
 0.539932  0.429322
 0.623487  0.0397795
 2x2 Array{Float64,2}:
 0.35508   0.700551
 0.768214  0.954056
 3x3 Array{Float64,2}:
 0.953354  0.453831   0.991583
 0.159975  0.116518   0.355275
 0.791447  0.0104295  0.151609


Where the number of elements may be much larger than 3 (e.g., 1000), how do 
I construct a block diagonal matrix, where the blocks are the matrices in 
the array? For the array above, this would be

7x7 Array{Float64,2}:
 0.539932  0.429322   0.0       0.0       0.0       0.0        0.0
 0.623487  0.0397795  0.0       0.0       0.0       0.0        0.0
 0.0       0.0        0.35508   0.700551  0.0       0.0        0.0
 0.0       0.0        0.768214  0.954056  0.0       0.0        0.0
 0.0       0.0        0.0       0.0       0.953354  0.453831   0.991583
 0.0       0.0        0.0       0.0       0.159975  0.116518   0.355275
 0.0       0.0        0.0       0.0       0.791447  0.0104295  0.151609

Reply via email to