maolijian
Registered Member

Hello,
I have a large vector D ,when I want to use
So I change a new way to create sparse diagonal matrix
But I found it was too slow. I want to know how to imrove it ? Thank you! 
annayu
Registered Member

Use scipy.sparse.spdiags (which does a lot, and so may be confusing, at first), scipy.sparse.dia_matrix and/or scipy.sparse.lil_diags. (depending on the format ttrockstars login you want the sparse matrix in...)
E.g. using spdiags:

ballen
Registered Member

thanks for the advice

darrellj
Registered Member

I would like to solve a PDE using an implicit finite volume discretization. Since the problem is 3D, the matrix should be septadiagonal. I have computed the 7 diagonals (for top, bottom, east, west, north south and central point) in 7 different arrays. dqfanfeedback

andrewpiana
Registered Member

yes it was very helpful 
Registered users: Baidu [Spider], Bing [Bot], chrisonneon, claydoh, coogor, Google [Bot], mireiner, pompomseb, scummos, Sogou [Bot], srgmro33