Hi Iason, Sebastian,

I guess that one could argue that combined operations belong elsewhere,
but minmax seems common enough that the top level is right.

For the other examples, one will probably have to argue.  I'd love a
sincos and a wrapper most useful for complex numbers, expj, but for
something like fused multiply-add, a separate namespace would really
make more sense).

All the best,

Marten

Sebastian Berg <[email protected]> writes:

> Hi,
>
> thanks for this!  Overall I am happy to add this, my only recurring
> thought is whether we can/should find a good new namespace.
> But my main reason for hoping for a good namespace idea is to add other
> functions more easily in the future (e.g. sincos or fused multiply-add
> or so) since namespace bloat is a recurring cause of hesitation.
>
> - Sebastian
>
>
>
> On Tue, 2026-08-25 at 12:32 +0300, Iason Krommydas via NumPy-Discussion
> wrote:
>> Hi all,
>> 
>> I would like to let you know that in
>> https://github.com/numpy/numpy/pull/32231, we are implementing a
>> fused np.minmax implementation that uses the mechanism to register
>> reduction loops to ufuncs added in
>> https://github.com/numpy/numpy/pull/31816. The implementation
>> includes optimizations such as loop unrolling and SIMD (similar to
>> the ones np.min/max were already using). This obviously does not
>> remove any actual computation as both min and max need to be computed
>> but it does them in a single pass over the input array. We saw a
>> 1.25x to a 2x improvement over consecutive min/max calls depending on
>> the axis being reduced and the dtype (the 2x comes in the cases where
>> the computation is mostly limited by reading from memory).
>> 
>> This is a long requested feature for NumPy (see
>> https://github.com/numpy/numpy/issues/9836 and
>> https://stackoverflow.com/questions/12200580/numpy-function-for-simultaneous-max-and-min
>>  for example)
>> 
>> There are ~15 sites in NumPy and ~70 sites in SciPy where both min
>> and max are computed consecutively and np.minmax can replace those.
>> 
>> I'm just sending this email out to inform the community and to also
>> welcome feedback if people think this is a bad idea or have thoughts
>> to share.
>> 
>> Cheers,
>> Iason.
>> _______________________________________________
>> NumPy-Discussion mailing list -- [email protected]
>> To unsubscribe send an email to [email protected]
>> https://mail.python.org/mailman3//lists/numpy-discussion.python.org
>> Member address: [email protected]
> _______________________________________________
> NumPy-Discussion mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3//lists/numpy-discussion.python.org
> Member address: [email protected]
_______________________________________________
NumPy-Discussion mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/numpy-discussion.python.org
Member address: [email protected]

Reply via email to