Description
numpy/numpy/core/include/numpy/ndarraytypes.h
Lines 444 to 554 in 2948673
I believe that most of the functions in this list should be replaced by generalized ufuncs and this list of function pointers shrunk.
In theory, the PyArray_Descr structure could then become a meta-type in Python parlance ("inheriting" from PyHeapTypeObject ala https://stackoverflow.com/questions/1237266/how-can-inheritance-be-modelled-using-c) and adding remaining fields needed by NumPy. All dtypes would then be "real" Python types --- but we don't need these extra functions.
In particular, the following functions should be (generalized) ufuncs --- others can likely be as well with a bit more thought.
- cast -> becomes several cast_to_ functions
argmax
,argmin
(Create a gufunc form of argmin and argmax #12516)- dotfunc
sort
,argsort
(Create a gufunc form of sort and argsort #12517)- sortfunc --> several sortfuncs for each type of sort
- argsortfunc --> several argsortfuncs for each type
- fastclipfunc (ENH/DEP: Use a ufunc under the hood for ndarray.clip #12519)
- nonzero
This kind of refactor would break the ABI and I would suggest including only in a major release. It would be facilitated by an improved ufunc dispatching system for NumPy as well.