I have a scipy.sparse.csc_matrix
sparse A
form matrix (N, N)
, where N
about 15000
. A
has fewer 1 %
nonzero elements.
I need to decide for the Ax=b
most effective time.
Using scipy.sparse.linalg.spsolve
takes about 350 ms
using scikit-umfpack
.
scipy.sparse.linalg.gmres
Works 50 ms
much faster when using a preconditioner ILU
. Without a precondition, this takes more than a minute.
However, creating a preconditioner takes about 1.5 s
. Given this, it would be more efficient to use scipy.sparse.linalg.spsolve
.
I am creating a preconditioner M
using
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 to do this, so that use scipy.sparse.linalg.gmres
would be more profitable?
source
share