[SciPy-user] spare matrices

Nathan Bell wnbell@gmail....
Tue Mar 17 05:19:53 CDT 2009


On Mon, Mar 16, 2009 at 10:12 PM, Eric Friedman <ejf27@cornell.edu> wrote:
>
> thanks -- I played around with a few of the formats and
> read the docs, but what
> I'm looking for is someone to tell me that it
> really does work and if I spend
> the required time to figure it out it will
> be able handle millions of entries.
> (I read a couple of posts on various bulletin
> boards that seemed to suggest that
> I'm pushing the envelope here.)
>

Yes, scipy.sparse should be competitive with MATLAB in terms of
performance.  For instance, I use scipy.sparse with PyAMG[1] to solve
linear systems with millions of unknowns.  With such large matrices
you'll want to primarily use the COO, CSR, and CSC formats, whose
operations are implemented in C++.  You'll want to avoid using
lil_matrix and dok_matrix to construct matrices, as they are about 100
times slower than the alternatives.  Here's a example that highlights
the difference[2].

Please let us know if you find something lacking.

[1] http://www.pyamg.org/
[2] http://www.scipy.org/SciPyPackages/Sparse#head-be8a0be5d0e44c4d59550d64fb0173508073c36e

-- 
Nathan Bell wnbell@gmail.com
http://graphics.cs.uiuc.edu/~wnbell/


More information about the SciPy-user mailing list