@@ -33,6 +33,7 @@ import numpy as np
3333
3434cimport cython
3535cimport numpy as np
36+ from cython cimport floating
3637from libc.math cimport atan2, ceil, cos, exp, fabs, floor, round , sin, sqrt
3738from libc.stdlib cimport qsort
3839
@@ -155,7 +156,7 @@ cdef double clip(double x, double vmin, double vmax, int cyclic,
155156@ cython.wraparound (False )
156157@ cython.nonecheck (False )
157158@ cython.cdivision (True )
158- cdef bint sample_array(const double [:,:,:] source, double [:] dest,
159+ cdef bint sample_array(const floating [:,:,:] source, floating [:] dest,
159160 double x, double y, int x_cyclic, int y_cyclic,
160161 bint out_of_range_nearest) noexcept nogil:
161162 x = clip(x, 0 , source.shape[2 ] - 1 , x_cyclic, out_of_range_nearest)
@@ -352,7 +353,7 @@ BAD_VALUE_MODES['ignore'] = 3
352353@ cython.wraparound (False )
353354@ cython.nonecheck (False )
354355@ cython.cdivision (True )
355- def map_coordinates (const double [:,:,:] source , double [:,:,:] target , Ci , int max_samples_width = - 1 ,
356+ def map_coordinates (const floating [:,:,:] source , floating [:,:,:] target , Ci , int max_samples_width = - 1 ,
356357 int conserve_flux = False , int progress = False , int singularities_nan = False ,
357358 int x_cyclic = False , int y_cyclic = False , int out_of_range_nan = False ,
358359 bint center_jacobian = False , bint despiked_jacobian = False ,
@@ -492,7 +493,7 @@ def map_coordinates(const double[:,:,:] source, double[:,:,:] target, Ci, int ma
492493 cdef double [:] weight_sum = np.empty(source.shape[0 ])
493494 cdef double ignored_weight_sum
494495 cdef double weight
495- cdef double [:] value = np.empty( source.shape[0 ])
496+ cdef floating [:] value = np.empty_like(source, shape = source.shape[0 ])
496497 cdef double [:] P1 = np.empty((2 ,))
497498 cdef double [:] P2 = np.empty((2 ,))
498499 cdef double [:] P3 = np.empty((2 ,))
0 commit comments