[SciPy-user] eigenvalues of sparse matrix

Pearu Peterson pearu at scipy.org
Thu Oct 28 17:33:56 EDT 2004



On Thu, 28 Oct 2004, David Grant wrote:

> Travis Oliphant wrote:
>
>> 
>>> 
>>> Does anyone know how much work it would be to get ARPACK support in scipy? 
>>> Even just minimal support.  This is totally new ground for me, so I'd like 
>>> to know if I'm biting off more than I can chew.
>> 
>> 
>> 
>> Not a lot for simple support if you use f2py.
>> 
>> My suggestion would be to write an f2py interface for the desired routines 
>> and we can build up from there.
>> 
>> 
> I assume your suggestion does not involve using this at all: 
> http://jrfonseca.dyndns.org/work/phd/ ?
> I believe Josa Fonseca was going to use f2py, but he didn't.
>
> Here is from his web page:
>
> "These bindings weren't generated with any automatic binding generation tool. 
> Even though I initially tried both PyFortran and f2py, both showed to be 
> inappropriate to handle the specificity of the ARPACK API. ARPACK uses a 
> /reverse communication interface/ where basically the API sucessively returns 
> to caller which must take some update steps, and re-call the API with most 
> arguments untouched. The intelligent (and silent) argument conversions made 
> by the above tools made very difficult to implement and debug the most simple 
> example. Also, for large-scale problems we wouldn't want any kind of array 
> conversion/transposing happening behind the scenes as that would completely 
> kill performance."

I cannot agree with these conclusions, at least when using f2py. The array 
conversion can be easily avoided behind the scenes (because the main loop 
is in Fortran) and transposing is not even an issue as user-specific 
parts of ARPACK API contains only 1-dimensional arrays.

> "Therefore the bindings are faithfull to the original FORTRAN API and are not 
> very friendly as is. Nevertheless a Python wrapper to these calls can easily 
> be made, where all kind of type conversions and dummy-safe actions can be 
> made."

> So who is right?

I looked into ARPACK API and I think f2py could be effectively used to wrap
ARPACK. For example, when considering SIMPLE/dssimp.f case then
I would write a Fortran subroutine that contains dsaupd main-loop and 
call to dseupd (the subroutine av would be provided as a callback 
argument) and then wrap this subroutine with f2py.

Pearu




More information about the SciPy-User mailing list