[SciPy-User] Sparse vector

Felix Schlesinger schlesin@cshl....
Wed Apr 21 16:01:14 CDT 2010


> > I occasionally wonder whether a generalized sparse ndarray object
> > would be useful. You'd want it to specify the value for empty elements
> > so that things like boolean arrays could be done this way, and I think
> > a dictionary of keys approach would be the way to go. In any case,
> > nothing exists now.
> 
> for some applications, I keep just the nonzero values in an array and
> the index separate, which allows easy back and forth conversion to
> dense.

Storing indicies seperate is a good option sometimes but does not allow random
access. Are you aware of any fast hash-table implementation that can store
atomic values (e.g. numpy floats) instead of general python objects? That would
go a long way towards sparse vectors.

felix



More information about the SciPy-User mailing list