[SciPy-user] Re: linalg.eig on sparse matrices

Travis E. Oliphant oliphant at ee.byu.edu
Fri Jan 23 04:59:12 CST 2004

H Jansen wrote:
> On Thu, 2004-01-22 at 20:54, Travis E. Oliphant wrote:
>>H Jansen wrote:
>>>One may want to have a look at pysparse:
>>Sparse matrices are definitely a candidate for SciPy.  In fact, there is 
>>rudimentary support for Sparse matrices already there.
>>The plan is to rewrite the Sparse matrix class into one (or more) Python 
>>type objects and support at least two different types of Sparse 
>>matrices:  linked-list (for fast matrix formation),  compressed sparse 
>>row (and compressed sparse column) for fast matrix manipulation.  Four 
>>different data types are planned for these matrices.
>>There is a project out there that gets a bit of the way there (I think 
>>it may be this one you speak of) but there is more to do to make it 
>>general purpose enough.
>>If there are individuals out there with experience with Sparse matrices, 
>>this would be a great place to help out with development.
> I can't consider myself a "sparse matrix specialist" but I'm eager to
> test results and contribute to feature discussions. For instance, in
> pysparse index information is not available so you can't iterate over
> the sparse matrix elements --- this is a real handicap. Long time past
> (in my Fortran days) I've used Yousef Saad's Sparsekit which, if I
> remember correctly, was a pretty well featured sparse matrix kit. It
> didn't come integrated with iterative solvers of course since
> object-orientiation wasn't given much attention in the numerical
> computing community at that time (late 80's, early 90's).

Right now, the sparse matrix in SciPy uses Saad's toolkit (which is GPL 
and thus problematic for continuance in the SciPy tree).

> In Python the "arrayfrombuffer" module may provide the functionality
> needed for address (1). (... skipping issue (2) ...) In the article the
> proposed solution for (3) is to have each numerical library implement
> the "apply_op(...)" method which accepts user-defined (application
> specific) matrix/vector operators. I believe the same solution can work
> for Python: special-purpose vector/matrix operations can be implemented
> in a compilable language (Fortran/C++) and easily be interfaced with
> Python (using, for example, for Fortran: F2PY or pyfortran, and for C++:
> C++boost template library, PyCXX or Swig).

I think Python is a great tool for answering some of these questions, 
but right now that is not on my path.  I would just like to see the 
sparse matrix object in SciPy improved.

-Travis O.

More information about the SciPy-user mailing list