[Numpy-discussion] Irregular arrays
David M. Cooke
cookedm at physics.mcmaster.ca
Mon Sep 4 19:30:45 CDT 2006
On Mon, 4 Sep 2006 17:35:04 -0600
"Charles R Harris" <charlesr.harris at gmail.com> wrote:
> On 9/4/06, rw679aq02 at sneakemail.com <rw679aq02 at sneakemail.com> wrote:
> > >> The question is whether numpy has such support; if not, is it planned.
> > > No, and no.
> > Thank you for answering, and I am sorry to hear that.
> > I will be dropping my membership on the scipy-numpy email list shortly.
> > Many systems handle rectangular arrays quite well already, and are more
> > fully developed.
> > It is a common fallacy rectangles are the only shapes one ever needs.
> > Physical geometry is only rarely rectangular, and solution of actual
> > physical problems, and even number-theoretical problem, is a far larger
> > problem domain.
> Thanks for blessing us with your exalted presence and superior intellect.
> You will be missed.
Well now, that's just snarky.
rw679aq02 (if that is indeed your real name!), the reason that numpy will not
support irregular "arrays" anytime soon comes down to multiple reasons:
1) It would require a complete rework; better to make a new package.
Irregular arrays would require an entirely different approach than regular
2) While most things are not rectangular, the equations that describe them
are, for the most part. Finite-element methods, for instance, use a
triangulation of the physical object, and the equations can then be cast as
very large set of array equations.
3) I would guess that problems that could be described by irregular arrays
could be better recast with a different data structure. There's a saying that
you can write Fortran in any language; however, that doesn't mean you should!
4) No one else has asked for them, and the developers don't need them (this
is how open source works: scratching one's own itch)
5) If, instead, you're looking for efficient memory representations of
of sparse matrices (most elements being 0), then there are various ways to do
this. I'm not familiar with them, but scipy has packages to handle sparse
matrices. A lot of work happens in this field (those finite-element methods
tend to make sparse matrices).
Note that you could simulate an irregular array (with a maximum size in the
dimensions) using the masked arrays provided by NumPy.
|David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca
More information about the Numpy-discussion