I am working on a FEM project using Scipy. Now my problem is that the assembly of sparse matrices is too slow. I calculate the contribution of each element to dense small matrices (one for each element). To build global matrices, I iterate over all small dense matrices and set the matrix entries as follows:
[i,j] = someList[k][l]
Mglobal[i,j] = Mglobal[i,j] + Mlocal[k,l]
Mglobalis lil_matrice of the appropriate size, someListdisplays indexing variables.
Of course, it is rather slow and consumes most of the matrix assembly time. Is there a better way to assemble a large sparse matrix from many small dense matrices? I tried scipy.weave but it doesn't seem to work with sparse matrices
source
share