Can someone tell me how to check the ndarray data type that was passed in C code?
In a specific example, I would like to name another function if the data type of the array is float32 or double/float64 . So something like
if( Dtype(MyArray) == NPY_FLOAT ) { DoSomething_float( MyArray ); } else { DoSomething_double( MyArray ); }
I already found
PyTypeNum_ISFLOAT(num) PyDataType_ISFLOAT(descr) PyArray_ISFLOAT(obj)
In the numpy C API, but I don't understand how to use them. I already tried to find an instructive example, but did not find any.
source share