On undefined, Charles R Harris <[EMAIL PROTECTED]> wrote:
>
> On Wed, Apr 2, 2008 at 4:30 PM, Robert Kern <[EMAIL PROTECTED]> wrote:
> >
> > On undefined, Charles R Harris <[EMAIL PROTECTED]> 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
> 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.
> >
> > -1
> >
> > 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
> > API.
>
> Apart from that, what do you think of the idea? I currently spend more
> effort than I like doing newaxis magic.

It's fine. I don't encounter the use case all that frequently, so
personally, I want it as new functionality rather than changing the
old functionality.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
 -- Umberto Eco
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to