[SciPy-user] 2 more sparse questions

Robert Cimrman cimrman3 at ntc.zcu.cz
Tue Aug 1 04:32:30 CDT 2006


Ed Schofield wrote:
> [CC to list]
> 
> William Hunter wrote:
>> Ed;
>>
>> I'm still chipping away at this, ... <snip>
>> Thought I'd respond off-list as it might be too specific, but I'll add
>> it to the scipy wiki once I've figured it out.
>>
>> System: {U} = [K]{F}
>> Q1) For a sparse symmetric banded K, and an extremely sparse F (one to
>> five entries in a vector of length > 1200), what is the best solver to
>> use?
>>   
> I don't know. SciPy only has wrappers for SuperLU and UMFPACK, so I
> suggest you read the documentation for those (e.g.
> http://www.cise.ufl.edu/research/sparse/umfpack/v5.0/UMFPACK/Doc/UserGuide.pdf)
> to find out what cases the routines are designed to handle. If you need
> something more specialized, try Roman Geus's PySparse. It's not yet been
> ported from Numeric to NumPy, although I did port the basic matrix
> objects a while ago (in the SciPy sandbox), and that went fine. And
> there's Tim Davis's CSparse
> (http://www.cise.ufl.edu/research/sparse/CSparse/), which could be
> wrapped with ctypes ...

Just note that UMFPACK is also written by Tim Davis (a part of UFsparse
package), it is imho more heavy-weight than the sparse solvers in
CSparse. Otherwise CSparse contains lots of good stuff that I would like
to see wrapped.

> Perhaps Robert Cimrman can give you more specific advice ... he wrote
> the UMFPACK wrapper and knows more about sparse solvers than I do.

I am also just a user of sparse solvers. And I am not aware of a solver
using information on the sparsity of the right-hand side. Google is
silent. Maybe we should all read Tim's 'Direct Methods for Sparse Linear
Systems' :)

>> Q2) At the moment I'm just using linsolve.spsolve, but I also see that
>> there is a linsolve.splu. No docstring, obviously LU factorisation, but
>> what does one use then?
>>
>> I'll create an example 3 demonstrating the use.
>>   
> 
> Yeah, we need a docstring for this. I've never used it before either.
> But it's a wrapper for the SuperLU factorization functions like
> dgstrf(), and you could figure it out by reading the source and the
> SuperLU docs. If you could contribute a docstring I'd be very happy to
> commit it :)

you can use the umfpack module directly (import scipy.linsolve.umfpack
as um) to do LU, and than solve e.g. more right-hand sides - see
scipy/linsolve/umfpack/umfpack.py docstring.

hmm, help( um ) does not show it - just look into the source file.

The wrapper is not complete for now, there are functions in the UMFPACK
library to get the L, U factors as sparse matrices etc. - I will update
it if there is enough interest.

r.


More information about the SciPy-user mailing list