On Mon, 2024-03-25 at 13:49 +0000, percynichols...@gmail.com wrote: > Many thanks! > > Just one more inquiry along those lines, if I may. The code asserts > that clip should outpace np.maximum(mp.minumum(arr, max), min). > Despite this: > *time a = np.arange(100)it.clip(4, 20) # 8.48 µs > %timeit np.maximum(np.minimum(a, 20), 4) 2.09 nanoseconds > Will this be the norm?
There some slow paths necessary due to NaN handling and a deprecation in `np.clip`. You should try with an up to date NumPy version. That was a known issue, but not much to do about it. You shouldn't really see much of a difference on up to date NumPy versions. - Sebastian > _______________________________________________ > 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: sebast...@sipsolutions.net _______________________________________________ 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