[Numpy-discussion] reduce array by computing min/max every n samples

Neil Crighton neilcrighton@gmail....
Mon Jun 21 03:40:09 CDT 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.


More information about the NumPy-Discussion mailing list