serge-sans-paille / pythran

Ahead of Time compiler for numeric kernels
https://pythran.readthedocs.io
BSD 3-Clause "New" or "Revised" License
2.01k stars 193 forks source link

numpy.clip does not have a way to specify only max for clip #2054

Closed nbecker closed 1 year ago

nbecker commented 1 year ago

The numpy clip function allows None for either min or max arg to specify no clipping on the corresponding bound. pythran clip does not seem to allow None. pythran clip does seem to allow specifying only min, avoiding max (from my reading of the code clip.hpp) But there is no way to specify only a max, and not a min.

serge-sans-paille commented 1 year ago

Indeed. Thanks for reporting this, I'll have a look.

nbecker commented 1 year ago

For now my workaround is use np.inf or -np.inf for one limit, but probably slower

On Sun, Dec 4, 2022, 1:33 PM serge-sans-paille @.***> wrote:

Indeed. Thanks for reporting this, I'll have a look.

— Reply to this email directly, view it on GitHub https://github.com/serge-sans-paille/pythran/issues/2054#issuecomment-1336486263, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA4VUFUQRL2JR6AZ6LW2JTWLTPWRANCNFSM6AAAAAASTKEQM4 . You are receiving this because you authored the thread.Message ID: @.***>

serge-sans-paille commented 1 year ago

Fix available, that should indeed be slightly faster