[SciPy-dev] Compiling pysparse from the sandbox

Jonathan Guyer guyer at nist.gov
Thu Apr 19 08:59:37 EDT 2007


On Apr 18, 2007, at 11:54 PM, Bill Baxter wrote:

> SciPy's sparse matrices also lack any way to operate based on a sparse
> index, which is a fundamental operation in FEM codes.  Basically you
> need to be able to do something like
>     idx = [1,8,13,15]
>     K[ix_[idx,idx]] += node_contribution
>
> pysparse has an update_add_masked function which can do that
> efficiently (although it would obviously be better if regular numpy
> indexing just worked.)

This is one important advantage, although update_add_mask() was not  
suitable for our needs (we wanted to build sparse matrices from dense  
vectors, rather than building sparse matrices from small dense  
matrices). We added (and Roman accepted) an update_add_at() function  
that did what we wanted. Either is blindingly faster than what could  
be done if SciPy the last time I looked. SciPy's syntax is more  
Pythonic, but PySparse can build matrices *much* more efficiently.

More broadly, the advantages of PySparse over SciPy all boil down to  
speed. About a year and a half ago, I posted some benchmarking info  
to the SciPy wiki, but it went away with the move to the new wiki. I  
have no idea where it's gone, and I don't seem to have a copy of it.  
It used to be at <http://www.scipy.org/wikis/featurerequests/ 
SparseSolvers>.

> Sounds great to me.  I've toyed with MG, but never got very far.
> Non-power-of-two grids and boundary conditions were too tricksy for
> me.  But the O(N) solve time is great if someone else does all the
> hard work for me. :-)

Likewise. We're very interested in multigrid for FiPy, and even more  
interested if it doesn't require us to think very hard.




More information about the SciPy-Dev mailing list