[SciPy-user] spare matrices

josef.pktd@gmai... josef.pktd@gmai...
Mon Mar 16 20:27:04 CDT 2009

On Mon, Mar 16, 2009 at 8:06 PM, Eric Friedman <ejf27@cornell.edu> wrote:
> Hi, I'm new to python (from matlab) and am having some difficulties.
> In my program I need to use large sparse linear systems where A is nxm matrix
> with n is a few million, m is  around 100,000 and there are about 50 entries per
> row, so there are several million nonzero entries.
> I'm trying scipy sparse and it is really slow (at least 10-20 seconds to much
> longer), while matlab can do multiplications almost instantly.  I've looked at
> various online documents and googled a bit, and from what I see people seem to
> find these numbers large in scipy. Am I missing something or do I need to go
> back to Matlab?
> thanks,
> Eric

Since there are several different sparse formats, which have
advantages for different applications, you need to be a bit more
specific what you tried and what operations you need. A brief
description of each format and advantages and disadvantages are in the

I only tried out sparse a few times and initially I used the lil
matrix type for linear algebra and it was slow, switching to csr or
csc format made the linear algebra much faster. I don't know the speed
comparison to matlab, since I never used the sparse matrices of


More information about the SciPy-user mailing list