3 ms·
This is a fantastic step forward for Julia, and array-oriented computing in general. Routines that smoothly generalize to arrays with an arbitrary number of di
by shoyer 11y ago
This is a fantastic step forward for Julia, and array-oriented computing in general.
Routines that smoothly generalize to arrays with an arbitrary number of dimensions is also a strength of NumPy -- it's the core idea behind NumPy's "universal functions" [1] like sin or exp.
Writing custom ufuncs in C is not easy, but Numba makes it straightforward to write fast ufuncs in Python [2]. For many of the use cases described here, it's a pretty solid alternative. In general, I think Numba's ufuncs are under-appreciated -- they make it easy to write fast code that works on any number of array dimensions, and even automatically respect metadata when called on array-like objects from third party libraries like pandas.
Unfortunately, we don't have abstractions quite as powerful as eachindex and CartesianRange in NumPy/Numba. This makes for some awkward work-arounds and optimization constraints (e.g., see my project Numbagg [3], and discussions on the Numba issue tracker [4]). That said, I don't think there's any reason why these abstractions couldn't also be implemented in Numba, and I would love to see that happen.
[1] http://docs.scipy.org/doc/numpy/reference/ufuncs.html http://docs.scipy.org/doc/numpy/reference/ufuncs.html
[2] http://numba.pydata.org/numba-doc/0.23.1/user/vectorize.html http://numba.pydata.org/numba-doc/0.23.1/user/vectorize.html
[3] https://github.com/shoyer/numbagg https://github.com/shoyer/numbagg
[4] e.g., https://github.com/numba/numba/issues/841 https://github.com/numba/numba/issues/841
- tadlan 11y agoWhat about dynd? Iirc doesn't use iteration st all.