[Numpy-discussion] Re: Is a Python function a gufunc if it broadcasts its arguments appropriately?

2024-12-28 Thread Jim Pivarski via NumPy-Discussion
Yes, Numba (https://numba.pydata.org/) lets you write gufuncs without the performance penalty that would be incurred if it were written in pure Python: https://numba.pydata.org/numba-doc/dev/user/vectorize.html#the-guvectorize-decorator On Fri, Dec 27, 2024 at 2:10 AM john.a.dawson--- via NumPy

[Numpy-discussion] Re: Is a Python function a gufunc if it broadcasts its arguments appropriately?

2024-12-31 Thread Jim Pivarski via NumPy-Discussion
I think you're right: the function `stack`, as you've defined it, is a gufunc. Here's an implementation using np.vectorize (rather than nb.vectorize ). Since the sign

[Numpy-discussion] Re: Is a Python function a gufunc if it broadcasts its arguments appropriately?

2025-01-02 Thread Jim Pivarski via NumPy-Discussion
gt; > `vectorize` can indeed mimic generalized ufuncs, but (unfortunately) > doesn't create them as such currently. > > - Sebastian > > > On Tue, 2024-12-31 at 10:20 -0600, Jim Pivarski via NumPy-Discussion > wrote: > > I think you're right: the function `stack