[SciPy-user] calling scipy methods from fortran code...

Dominique Orban dominique.orban@gmail....
Mon Jul 2 17:01:44 CDT 2007


fred wrote:
> Gnata Xavier a écrit :
>> Hi,
>> "- loops are "forbidden" in python code; "
>> Well ok loop are slow in python but if each llinalg.solve() takes a 
>> significant amount of time, you may just want to use a python loop.
>> Anyway, calling scipy methods from fortran looks funny because scipy is 
>> based on fortran routines. Maybe you should have a direct look at lapack.
>>   
> Ok, you're right.
> But I was looking for something easy & ready-to-use, so I thought about 
> scipy calls.
> 
> Anyway, I prefer to use intel MKL and its symmetric undefinite matrix 
> solver,
> but this is another story...

Fred,

The de-facto standard for solving symmetric indefinite linear systems is a 
package called MA27 from the Harwell Subroutine Library. This one is available 
for free for non-commercial and research projects 
(http://hsl.rl.ac.uk/archive/hslarchive.html).

I interfaced MA27 to Python in my NLPy package (http://nlpy.sf.net) and wrote a 
nice wraparound Python class. There is an example on the NLPy website (in the 
'Examples' section). The interface is with the PySparse sparse matrix package. 
You won't have to call Fortran from Python; I already wrote the interface.

Typically, for my optimization applications, I call MA27 many times inside a 
outer loop. Make sure to use NumPy for all array operations and things should go 
well. I'm interested in any comments you might have on the package.

Dominique


More information about the SciPy-user mailing list