[Numpy-discussion] reduce array by computing min/max every n samples
Neil Crighton
neilcrighton at gmail.com
Mon Jun 21 04:40:09 EDT 2010
Warren Weckesser <warren.weckesser <at> enthought.com> writes:
>
> Benjamin Root wrote:
> > Brad, I think you are doing it the right way, but I think what is
> > happening is that the reshape() call on the sliced array is forcing a
> > copy to be made first. The fact that the copy has to be made twice
> > just worsens the issue. I would save a copy of the reshape result (it
> > is usually a view of the original data, unless a copy is forced), and
> > then perform a min/max call on that with the appropriate axis.
> >
> > On that note, would it be a bad idea to have a function that returns a
> > min/max tuple?
>
> +1. More than once I've wanted exactly such a function.
>
I also think this would be useful. For what it's worth, IDL also has a function
called minmax() that does this (e.g.
http://astro.uni-tuebingen.de/software/idl/astrolib/misc/minmax.html)
Neil
More information about the NumPy-Discussion
mailing list