[Scipy-svn] r6668 - in trunk/scipy: interpolate spatial

scipy-svn@scip... scipy-svn@scip...
Thu Sep 2 15:06:17 CDT 2010


Author: ptvirtan
Date: 2010-09-02 15:06:16 -0500 (Thu, 02 Sep 2010)
New Revision: 6668

Modified:
   trunk/scipy/interpolate/interpnd.pyx
   trunk/scipy/spatial/qhull.pyx
Log:
BUG: spatial/interpolate: use correct integer types in qhull/interpnd on 64-bit systems

Modified: trunk/scipy/interpolate/interpnd.pyx
===================================================================
--- trunk/scipy/interpolate/interpnd.pyx	2010-09-02 14:56:30 UTC (rev 6667)
+++ trunk/scipy/interpolate/interpnd.pyx	2010-09-02 20:06:16 UTC (rev 6668)
@@ -199,7 +199,7 @@
         cdef np.ndarray[np.${DTYPE}_t, ndim=2] values = self.values
         cdef np.ndarray[np.${DTYPE}_t, ndim=2] out
         cdef np.ndarray[np.double_t, ndim=2] points = self.points
-        cdef np.ndarray[np.int_t, ndim=2] vertices = self.tri.vertices
+        cdef np.ndarray[np.npy_int, ndim=2] vertices = self.tri.vertices
         cdef double c[NPY_MAXDIMS]
         cdef ${CDTYPE} fill_value
         cdef int i, j, k, m, ndim, isimplex, inside, start, nvalues
@@ -812,7 +812,7 @@
         cdef np.ndarray[np.${DTYPE}_t, ndim=3] grad = self.grad
         cdef np.ndarray[np.${DTYPE}_t, ndim=2] out
         cdef np.ndarray[np.double_t, ndim=2] points = self.points
-        cdef np.ndarray[np.int_t, ndim=2] vertices = self.tri.vertices
+        cdef np.ndarray[np.npy_int, ndim=2] vertices = self.tri.vertices
         cdef double c[NPY_MAXDIMS]
         cdef ${CDTYPE} f[NPY_MAXDIMS+1]
         cdef ${CDTYPE} df[2*NPY_MAXDIMS+2]

Modified: trunk/scipy/spatial/qhull.pyx
===================================================================
--- trunk/scipy/spatial/qhull.pyx	2010-09-02 14:56:30 UTC (rev 6667)
+++ trunk/scipy/spatial/qhull.pyx	2010-09-02 20:06:16 UTC (rev 6668)
@@ -212,12 +212,12 @@
     cdef facetT* neighbor
     cdef vertexT *vertex
     cdef int i, j, point
-    cdef np.ndarray[np.int_t, ndim=2] vertices
-    cdef np.ndarray[np.int_t, ndim=2] neighbors
+    cdef np.ndarray[np.npy_int, ndim=2] vertices
+    cdef np.ndarray[np.npy_int, ndim=2] neighbors
     cdef np.ndarray[np.double_t, ndim=2] equations
-    cdef np.ndarray[np.int_t, ndim=1] id_map
+    cdef np.ndarray[np.npy_int, ndim=1] id_map
 
-    id_map = np.empty((qh_qh.facet_id,), dtype=np.int)
+    id_map = np.empty((qh_qh.facet_id,), dtype=np.intc)
     id_map.fill(-1)
 
     # Compute facet indices
@@ -230,8 +230,8 @@
         facet = facet.next
 
     # Allocate output
-    vertices = np.zeros((j, ndim+1), dtype=np.int)
-    neighbors = np.zeros((j, ndim+1), dtype=np.int)
+    vertices = np.zeros((j, ndim+1), dtype=np.intc)
+    neighbors = np.zeros((j, ndim+1), dtype=np.intc)
     equations = np.zeros((j, ndim+2), dtype=np.double)
 
     # Retrieve facet information
@@ -273,7 +273,7 @@
 
 @cython.boundscheck(False)
 def _get_barycentric_transforms(np.ndarray[np.double_t, ndim=2] points,
-                                np.ndarray[np.int_t, ndim=2] vertices):
+                                np.ndarray[np.npy_int, ndim=2] vertices):
     """
     Compute barycentric affine coordinate transformations for given
     simplices.
@@ -913,6 +913,7 @@
     """
 
     def __init__(self, points):
+        points = np.ascontiguousarray(points).astype(np.double)
         vertices, neighbors, equations, paraboloid_scale, paraboloid_shift = \
                   _construct_delaunay(points)
 
@@ -961,11 +962,11 @@
         :type: ndarray of int, shape (npoints,)
         """
         cdef int isimplex, k, ivertex, nsimplex, ndim
-        cdef np.ndarray[np.int_t, ndim=2] vertices
-        cdef np.ndarray[np.int_t, ndim=1] arr
+        cdef np.ndarray[np.npy_int, ndim=2] vertices
+        cdef np.ndarray[np.npy_int, ndim=1] arr
 
         if self._vertex_to_simplex is None:
-            self._vertex_to_simplex = np.empty((self.npoints,), dtype=int)
+            self._vertex_to_simplex = np.empty((self.npoints,), dtype=np.intc)
             self._vertex_to_simplex.fill(-1)
 
             arr = self._vertex_to_simplex
@@ -996,9 +997,9 @@
 
         """
         cdef int isimplex, k, j, ndim, nsimplex, m, msize
-        cdef np.ndarray[np.int_t, ndim=2] arr
-        cdef np.ndarray[np.int_t, ndim=2] neighbors
-        cdef np.ndarray[np.int_t, ndim=2] vertices
+        cdef np.ndarray[np.npy_int, ndim=2] arr
+        cdef np.ndarray[np.npy_int, ndim=2] neighbors
+        cdef np.ndarray[np.npy_int, ndim=2] vertices
 
         neighbors = self.neighbors
         vertices = self.vertices
@@ -1006,7 +1007,7 @@
         nsimplex = self.nsimplex
 
         msize = 10
-        out = np.empty((msize, ndim), dtype=int)
+        out = np.empty((msize, ndim), dtype=np.intc)
         arr = out
 
         m = 0
@@ -1067,7 +1068,7 @@
         cdef int start
         cdef int k
         cdef np.ndarray[np.double_t, ndim=2] x
-        cdef np.ndarray[np.int_t, ndim=1] out_
+        cdef np.ndarray[np.npy_int, ndim=1] out_
 
         xi = np.asanyarray(xi)
 
@@ -1081,7 +1082,7 @@
         start = 0
 
         eps = np.finfo(np.double).eps * 10
-        out = np.zeros((xi.shape[0],), dtype=np.int)
+        out = np.zeros((xi.shape[0],), dtype=np.intc)
         out_ = out
         info = _get_delaunay_info(self, 1, 0)
 
@@ -1178,10 +1179,10 @@
                                         int compute_vertex_to_simplex):
     cdef DelaunayInfo_t *info
     cdef np.ndarray[np.double_t, ndim=3] transform
-    cdef np.ndarray[np.int_t, ndim=1] vertex_to_simplex
+    cdef np.ndarray[np.npy_int, ndim=1] vertex_to_simplex
     cdef np.ndarray[np.double_t, ndim=2] points = obj.points
-    cdef np.ndarray[np.int_t, ndim=2] vertices = obj.vertices
-    cdef np.ndarray[np.int_t, ndim=2] neighbors = obj.neighbors
+    cdef np.ndarray[np.npy_int, ndim=2] vertices = obj.vertices
+    cdef np.ndarray[np.npy_int, ndim=2] neighbors = obj.neighbors
     cdef np.ndarray[np.double_t, ndim=2] equations = obj.equations
     cdef np.ndarray[np.double_t, ndim=1] min_bound = obj.min_bound
     cdef np.ndarray[np.double_t, ndim=1] max_bound = obj.max_bound



More information about the Scipy-svn mailing list