I have a numpy array C of size 1000 x 100. I have figured out how to compute the matrix of outer products of its rows transposed
Create array of outer products in numpy
This yields a 1000x100x100 numpy array D. I'd like to store each of the D[i,:,:] as one of the block diagonals of a sparse matrix of size 1000*100^2 x 1000*100^2. I am able to accomplish this using scipy.sparse.block_diag
E = spspar.block_diag(D,"lil")
I am wondering if there is a more efficient way of doing this. Some of the entries of E need to be manipulated at first (hence "lil"). The resulting matrix will be used to solve a sequence of sparse linear systems.
Thanks in advance.