[SciPy-user] sparse stuff in numpy/scipy
Sun Jul 1 14:46:29 CDT 2007
On 7/2/07, Antonino Ingargiola <firstname.lastname@example.org> wrote:
> 2007/7/1, dmitrey <email@example.com>:
> > Hi all,
> > I had heard there are some sparse matrix abilities in scipy (btw don't
> > you think it's better to store those one in numpy?).
> > However, neither dir(scipy), nor dir(numpy), nor
> > http://www.scipy.org/Topical_Software doesn't tell me what should I use.
> Have you tried "import scipy.sparse"?
Maybe one have to know something before beginning to make requests ;)
Dmitrey, you didn't miss it in the dir(). It's not there. Some packages
like sparse and linalg that are considered 'extra' aren't loaded by default
to cut down on the load times for those that aren't using those packages.
Unfortunately these packages don't show up at all under the scipy namespace
until you explicitly import them. It is mentioned in the docstring for
scipy itself. I think that's the only way to know it's there.
Python gurus -- Is there some way that scipy can avoid hiding on-demand
packages like that?
It would be nice if there were some way to load a light-weight shims that
would show up in the dir() and maybe just have a docstring telling you you
need to import it explicity to actually load it.
No idea if python can do that sort of thing, but it would be nice. Right
As for scipy.sparse itself, it seems to be in need of some love. I tried it
a while back and it seemed that many standard ndarray functions that could
be implemented simply weren't. And you can't do any sort of fancy indexing,
which is often a key part of assembling the system matrix for sparse linear
systems (like those that arise from FEM or finite differences).
I think it would be great for Numpy to gain solid sparse support. It makes
sense for that to be in the core of a library for numerical computing. But
the devs seem to think of numpy more as a strided memory access library than
a numerical computing library. And sparse matrices are not strided memory.
Hence not Numpy.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the SciPy-user