[Numpy-discussion] Thoughts for 1.1

Charles R Harris charlesr.harris@gmail....
Wed Apr 2 17:23:10 CDT 2008


Hi All,

I think it would enhance broadcasting if functions like sum, mean, etc
didn't change the number of dimensions. For example, suppose one wanted to
subtract the mean along dimension 2 from the same axis of the original
array, then something like

In [44]: a = ones((2,3,4,5))

In [45]: a -= a.mean(2)

would do the trick. Similar modifications might also suit functions of the
argmax, argmin, argsort type and allow a common argtake function that would
allow one to take along a specified axis, making easy something that is
somewhat complicated at the moment.

The main drawback that I see is that scalars would no longer be 0D, but that
could be special cased as scalars will broadcast correctly no matter the
ndim.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20080402/8e32f457/attachment.html 


More information about the Numpy-discussion mailing list