[Numpy-discussion] some work on arpack

David Grant davidgrant at gmail.com
Tue Aug 15 21:06:51 CDT 2006

Building an arpack extension turned out to be surprisingly simple. For
example for dsaupd:

f2py -c dsaupd.f -m dsaupd -L/usr/lib/blas/atlas:/usr/lib/lapack/atlas
-llapack -lblas -larpack

It took me a long time to get the command down to something that
simple. Took me a while even to figure out I could just use the arpack
library on my computer rather than re-linking all of arpack! I was
able to import the dsaupd.so python module just fine and I was also
able to call it just fine. I'll have to tweak the pyf file in order to
get some proper output. But this gives me confidence that arpack is
easy to hook into which is what others have said in the past, but
without any experience with f2py I had no idea myself. f2py is
awesome, for anyone who doesn't know.

Matlab has interfaces for the arpack functions like dsaupd, dseupd,
dnaupd, znaupd, zneupd (the mex file documentation claims those are
the only ones, but they have more). Matlab has a C interface to these
functions in arpackc.mex* and the script eigs.m does the grunt work,
providing a very high-level interface as well as doing some linear
algebra (the same type of stuff that is done in arpack's examples
directory I gather) and various other things.

My idea is (if I have time) to write an eigs-like function in python
that will only perform a subset of what Matlab's eigs does for. It
will, for example, compute a certain number of eigenvalues and
eigenvectors for a real, sparse, symmetric matrix (the case I'm
interested in)... I hope that this subset-of-matlab's-eigs function
will not be too hard to write. Then more functionality can be added on
to eigs.py later... Does this make sense?

Has anyone else started work on arpack integration at all?

David Grant

More information about the Numpy-discussion mailing list