[SciPy-User] iterative matrix methods seem slow

Pauli Virtanen pav at iki.fi
Fri Jun 24 18:02:15 EDT 2011


On Fri, 24 Jun 2011 11:58:25 -0700, Richard Sharp wrote:
[clip]
> Thanks for this.  Using the incomplete as follows LU I was able to cut
> the iterative runtimes from 1700s to 30s
> 
>         P = scipy.sparse.linalg.spilu(matrix, drop_tol=1e-5) 
>         M_x = lambda x: P.solve(x)
>         M = scipy.sparse.linalg.LinearOperator((n * m, n * m), M_x)
>         result = scipy.sparse.linalg.lgmres(matrix, b, tol=1e-4, M=M)[0]
[clip]

BTW, PyAMG wipes the floor with the competition :)

	import pyamg

        ml = pyamg.smoothed_aggregation_solver(matrix)
        M = ml.aspreconditioner()

        result, info = scipy.sparse.linalg.gmres(A, b, M=M, tol=1e-12)

finds the solution in ~ 10s.

That it works so well is probably because the problem seems to be
some sort of a diffusion problem.

	Pauli




More information about the SciPy-User mailing list