[Matrix-SIG] Sparse objects

Travis Oliphant Oliphant.Travis@mayo.edu
Wed, 19 May 1999 12:16:25 -0500 (CDT)


It looks like there is enough interest to get something done and it sounds
like there is enough experience in the user base to do a decent job of
implementation.  

My first post hinted at the idea of general sparse arrays but I wonder if
that is a bit too ambitious at this point, especially considering that I
haven't heard of any uses for such beasts.  I'm sure one could come up
with some uses but the useability/cost ratio seems to me a bit too low at
this point.   So, we should probably concentrate on just getting a useful
sparse matrix object defined.  On second thought it may be useful to
define an object with a sparsity structure in 2-D and a full structure in
the other dimensions --- ah, but wait if we define a good 2-D sparse
object then we could but those as elements in NumPy arrays...

Storage problem:

I looked some at how MATLAB stores sparse matrices.  I have not seen any
comment on this so I'm not sure but looking at the sizes of some sparse
matrices it looks like they use a compressed row or a compressed colum
storage format.  This is pretty transparent to the user, however, as you
mainly interact with the matrix using index notation.  

The important thing that matlab does is define the standard mathematical
operations on sparse matrices so that they happen quickly, so that all of
the iterative algorithms can be coded in MATLAB's language.

I rather like the idea of having multiple storage formats with a flag in
the object indicating which storage format is in use.  This would allow
better interfacing with existing code.  

I think it would be useful to have the data itself stored in a NumPy array
so that ufuncs could be easily applied.  This would add only minimal
overhead to the entire structure.








--------------------------------------------------
Travis Oliphant           200 First St SW          
    	                  Rochester MN 55905       
Ultrasound Research Lab	  (507) 286-5293           
Mayo Graduate School	  Oliphant.Travis@mayo.edu