I am a bit struggled with so many int
data types in cython.
np.int, np.int_, np.int_t, int
I guess int
in pure python
np.int_
is the default integer type (as defined in the NumPy docs), on a 64bit system this would be a C long
. np.intc
is the default C int
either int32
or int64
. np.int
is an alias to the built-in int
function
>>> np.int(2.4)
2
>>> np.int is int # object id equality
True
The cython datatypes should reflect C
datatypes, so cdef int a
is a C int
and so on.
As for np.int_t
that is the Cython
compile time equivalent of the NumPy np.int_
datatype, np.int64_t
is the Cython
compile time equivalent of np.int64