numpy.pxd: add NPY_UINT64 and family
authorMark Lodato <lodatom@gmail.com>
Fri, 16 Oct 2009 23:38:02 +0000 (19:38 -0400)
committerMark Lodato <lodatom@gmail.com>
Fri, 16 Oct 2009 23:38:02 +0000 (19:38 -0400)
This provides a fast way to check to see the data type of an ndarray.
For example, to check to see if an integer is 64 bits:

    PyArray_TYPE(a) == NPY_UINT64 or PyArray_TYPE(a) == NPY_INT64

Cython/Includes/numpy.pxd

index 98f73460f8b0d8b609c7c7a4cb100c9d7d579674..1d84e9fb7182b9e96ba89e9841b36d2ffd2b4443 100644 (file)
@@ -52,6 +52,33 @@ cdef extern from "numpy/arrayobject.h":
         NPY_NTYPES
         NPY_NOTYPE
 
+        NPY_INT8
+        NPY_INT16
+        NPY_INT32
+        NPY_INT64
+        NPY_INT128
+        NPY_INT256
+        NPY_UINT8
+        NPY_UINT16
+        NPY_UINT32
+        NPY_UINT64
+        NPY_UINT128
+        NPY_UINT256
+        NPY_FLOAT16
+        NPY_FLOAT32
+        NPY_FLOAT64
+        NPY_FLOAT80
+        NPY_FLOAT96
+        NPY_FLOAT128
+        NPY_FLOAT256
+        NPY_COMPLEX32
+        NPY_COMPLEX64
+        NPY_COMPLEX128
+        NPY_COMPLEX160
+        NPY_COMPLEX192
+        NPY_COMPLEX256
+        NPY_COMPLEX512
+
     enum NPY_ORDER:
         NPY_ANYORDER
         NPY_CORDER