I want to build a block diagonal matrix from a list of square matrices of the same shape.
This answer explains how to do it for a single matrix, but I have a whole bunch of different matrices that need to be made into a block matrix.
I want to perform this operation in Theano on GPU, so performance is a necessity (and the function has to exist in Theano).
Details : The reason for doing this is to accelerate the calculation of eigenvalues/vectors on GPU when there are many small matrices (e.g. around 10000 matrices 7x7). Instead of taking the eigenvalues of each small matrix separately (very slow on GPU), I want to perform a big EVD over the block diagonal matrix (same eigenvalues than the small matrices). Hopefully this will be faster and the sparsity of the matrix will not create much overhead (or maybe EIGH will take advantage of that).