[SciPy-User] iterative matrix methods seem slow

eat e.antero.tammi at gmail.com
Fri Jun 24 16:44:16 EDT 2011


Just to be really specific, please do compare visually the attachments:
where a) is spsolve based and b) is spilu based.

Which one is the 'correct' one?


Thanks,
eat

On Fri, Jun 24, 2011 at 10:48 PM, eat <e.antero.tammi at gmail.com> wrote:

> Hi,
>
> On Fri, Jun 24, 2011 at 9:58 PM, Richard Sharp <richsharp at stanford.edu>wrote:
>
>> Thanks Pauli,
>>
>> > I don't see you passing in a preconditioner here -- it goes in via
>> > the M= parameter of gmres.
>>
>> Right, I had one in there to begin with, but removed it later since it
>> seemed to slow down the convergence.
>>
>> > On preconditioners: If you want "automatic" preconditioners, you can
>> > try the following:
>> >
>> >
>> http://docs.scipy.org/doc/scipy/reference/sparse.linalg.html#scipy.sparse.linalg.spilu
>>
>> 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]
>>
>> But the spilu factors in about 3s, solves in 0.1s and seems to give a
>> result that's very close to my continuous solution, so I'm using that
>> now with no memory or runtime problems:
>>
>>        P = scipy.sparse.linalg.spilu(matrix, drop_tol=1e-5)
>>        result = P.solve(b)
>>
> AFAIU, this is quite fast indeed, but inspecting visually the result; it
> really doesn't seem to agree  with your original solution, calculated with
> the slight increased cell size! (Of'course I don't know which one would be
> the correct one).
>
> BTW, did you make any experiments with my suggestion of adding  permc_spec=
> 'MMD_AT_PLUS_A' to the spsolve(.)? Would it be anyway comparable in
> performance sense?
>
>
> Regards,
> eat
>
>> Rich
>> _______________________________________________
>> 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/20110624/e6289362/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: case1_a.png
Type: image/png
Size: 25766 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20110624/e6289362/attachment.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: case1_b.png
Type: image/png
Size: 19260 bytes
Desc: not available
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20110624/e6289362/attachment-0001.png>


More information about the SciPy-User mailing list