Sparse matrix solver with preconditioner

风流意气都作罢 提交于 2020-04-10 03:44:07

问题


I have a scipy.sparse.csc_matrix sparse matrix A of shape (N, N) where N is about 15000. A has less than 1 % non-zero elements.

I need to solve for Ax=b as time efficient as possible.

Using scipy.sparse.linalg.spsolve takes about 350 ms using scikit-umfpack. scipy.sparse.linalg.gmres is with 50 ms significantly faster when using an ILU preconditioner. Without preconditioner it takes more than a minute.

However, creating the preconditioner takes about 1.5 s. Given that, it would be more efficient to just use scipy.sparse.linalg.spsolve.

I'm creating the preconditioner M with

from scipy.sparse.linalg import LinearOperator, spilu
ilu = spilu(A)
Mx = lambda x: ilu.solve(x)
M = LinearOperator((N, N), Mx)

Is there a more efficient way of doing this, such that using scipy.sparse.linalg.gmres would be more profitable?

来源:https://stackoverflow.com/questions/46876951/sparse-matrix-solver-with-preconditioner

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!