Extend __numpy_ufunc__ to most numpy.core.multiarray functions?
See original GitHub issueThe __numpy_ufunc__
mechanism likely is easily extended to all relevant numpy.core.multiarray functions. This would also enable several pure-Python Numpy functions (e.g. hstack, vstack, …) to work transparently with 3rd party classes — as long as array/asarray are not called, things should work out transparently.
It might also make sense to add a helper function to multiarraymodule so that the override mechanism can be invoked from Python side. This could be a sensible alternative e.g. in the case of linear algebra functions.
Issue Analytics
- State:
- Created 10 years ago
- Comments:22 (22 by maintainers)
Top Results From Across the Web
NEP 43 — Enhancing the extensibility of UFuncs - NumPy
This NEP outlines how NumPy will operate on arrays with custom dtypes in the future. The most important functions operating on NumPy arrays...
Read more >Writing your own ufunc — NumPy v1.23 Manual
It provides a great many examples of how to create a universal function. ... Details explaining the Python-C API can be found under...
Read more >How to extend NumPy
Each entry in the mymethods array is a PyMethodDef structure containing 1) the Python name, 2) the C-function that implements the function, 3)...
Read more >The N-dimensional array (ndarray) — NumPy v1.24 Manual
An array object represents a multidimensional, homogeneous array of fixed-size items. Indexing arrays#. Arrays can be indexed using an extended Python slicing ...
Read more >NEP 5 — Generalized Universal Functions - NumPy
Each ufunc consists of an elementary function that performs the most basic operation on the smallest portion of array arguments (e.g. adding two...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Can we close this? We have now NEP 18
__array_function__
and NEP 18 duck arraysAgreed, closing.