On Thu, Jun 30, 2022, at 22:23, Ewout ter Hoeven wrote:
> A function to get the minimum and maximum values of an array 
> simultaneously could be very useful, from both a convenience and 
> performance point of view. Especially when arrays get larger the 
> performance benefit could be significant, and even more if the array 
> doesn't fit in L2/L3 cache or even memory.

Hi,

There's an open issue asking for this feature: 
https://github.com/numpy/numpy/issues/9836

AndrĂ¡s

>
> There are many cases where not either the minimum or the maximum of an 
> array is required, but both. Think of clipping an array, getting it's 
> range, checking for outliers, normalizing, making a plot like a 
> histogram, etc.
>
> This function could be called aminmax() for example, and also be called 
> like ndarray.minmax(). It should return a tuple (min, max) with the 
> minimum and maximum values of the array, identical to calling 
> (ndarray.min(), ndarray.max()).
>
> With such a function, numpy.ptp() and the special cases of 
> numpy.quantile(a, q=[0,1]) and numpy.percentile(a, q=[0,100]) could 
> also potentially be speeded up, among others.
>
> Potentially argmin and argmax could get the same treatment, being 
> called argminmax().
>
> There is also a very extensive post on Stack Overflow (a bit old 
> already) with discussion and benchmarks: 
> https://stackoverflow.com/questions/12200580/numpy-function-for-simultaneous-max-and-min
> _______________________________________________
> NumPy-Discussion mailing list -- numpy-discussion@python.org
> To unsubscribe send an email to numpy-discussion-le...@python.org
> https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
> Member address: deak.and...@gmail.com
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to