[SciPy-user] sparse stuff in numpy/scipy

Bill Baxter wbaxter at gmail.com
Sun Jul 1 15:46:29 EDT 2007


On 7/2/07, Antonino Ingargiola <tritemio at gmail.com> wrote:
>
> 2007/7/1, dmitrey <openopt at ukr.net>:
> > 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
now google

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.

--bb
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20070702/8ef4f14e/attachment.html>


More information about the SciPy-User mailing list