![]() 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! |
![]() 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:
|
![]() Registered Member ![]()
|
thanks for the advice
|
![]() 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
|
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]