[Numpy-discussion] Thoughts for 1.1
Wed Apr 2 17:48:39 CDT 2008
If you're looking for user input ... +1 on having a keepdims capability. I
have myself implemented many such functions with a keepdims=1 keyword. No
real preference on how it's impelemented, though the potential for
breakage is a concern ...
On Wed, 2 Apr 2008, Charles R Harris wrote:
> On Wed, Apr 2, 2008 at 4:30 PM, Robert Kern <email@example.com> wrote:
>> On undefined, Charles R Harris <firstname.lastname@example.org> wrote:
>>> 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
>>> subtract the mean along dimension 2 from the same axis of the original
>>> array, then something like
>>> In : a = ones((2,3,4,5))
>>> In : a -= a.mean(2)
>>> would do the trick. Similar modifications might also suit functions of
>>> argmax, argmin, argsort type and allow a common argtake function that
>>> 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
>>> could be special cased as scalars will broadcast correctly no matter the
>> I really don't want to see this amount of code breakage, even in 1.1.
>> Add another keyword argument if you wish, but don't break the current
> Apart from that, what do you think of the idea? I currently spend more
> effort than I like doing newaxis magic.
More information about the Numpy-discussion