[SciPy-User] iterative matrix methods seem slow
eat
e.antero.tammi at gmail.com
Sat Jun 25 06:04:46 EDT 2011
Hi,
On Sat, Jun 25, 2011 at 1:02 AM, Pauli Virtanen <pav at iki.fi> wrote:
> 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.
>
Interesting. But shouldn't A actually be matrix.
Anyway it will produce similar looking results than original, but:
elements: 640000
initialize ... (0.00619422300879s elapsed)
building system A... (5.17429177451s elapsed)
building sparse matrix ... (0.65811520738s elapsed)
doing 1d solution to prime iterative solution ... (4.67539582545s elapsed)
solving ... Implicit conversion of A to CSR in
pyamg.smoothed_aggregation_solver
C:\Python27\lib\site-packages\pyamg\util\linalg.py:233: ComplexWarning:
Casting
complex values to real discards the imaginary part
H[i,j] = numpy.dot(numpy.conjugate(numpy.ravel(v)), numpy.ravel(w))
(17.3736393173s elapsed)
generate mesh
prepare result plot
plot result
Any ideas where those complex values emerged?
Thanks,
eat
>
> That it works so well is probably because the problem seems to be
> some sort of a diffusion problem.
>
> Pauli
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20110625/822d51d0/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: case1_c.png
Type: image/png
Size: 25766 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20110625/822d51d0/attachment.png>
More information about the SciPy-User
mailing list