66from numba import prange
77from .codegen import get_code_linear , get_code_cubic , source_to_function
88
9- from distutils .version import LooseVersion
10- from numba import __version__
11- if LooseVersion (__version__ )>= '0.43' :
12- overload_options = {'strict' : False }
13- else :
14- overload_options = {}
9+ from ..compat import Tuple , UniTuple
10+ from ..compat import overload_options
1511
1612#
1713
8278import numpy as np
8379from numba import njit
8480from numba .extending import overload
81+ from numba .types import Array
8582
8683def _eval_linear ():
8784 pass
@@ -97,7 +94,7 @@ def __eval_linear(grid,C,points):
9794 vec_eval = (points .ndim == 2 )
9895 from math import floor
9996 from numpy import zeros
100- grid_types = ['nonuniform' if isinstance (tt , numba . types . Array ) else 'uniform' for tt in grid .types ]
97+ grid_types = ['nonuniform' if isinstance (tt , Array ) else 'uniform' for tt in grid .types ]
10198 context = {'floor' : floor , 'zeros' : zeros , 'np' : np } #, 'Cd': Ad, 'dCd': dAd}
10299 code = get_code_linear (d , vector_valued = vector_valued , vectorized = vec_eval , allocate = True , grid_types = grid_types )
103100 # print(code)
@@ -113,7 +110,7 @@ def __eval_linear(grid,C,points,extrap_mode):
113110 vec_eval = (points .ndim == 2 )
114111 from math import floor
115112 from numpy import zeros
116- grid_types = ['nonuniform' if isinstance (tt , numba . types . Array ) else 'uniform' for tt in grid .types ]
113+ grid_types = ['nonuniform' if isinstance (tt , Array ) else 'uniform' for tt in grid .types ]
117114 context = {'floor' : floor , 'zeros' : zeros , 'np' : np } #, 'Cd': Ad, 'dCd': dAd}
118115 # print(f"We are going to extrapolate in {extrap_mode} mode.")
119116 if extrap_mode == t_NEAREST :
@@ -138,7 +135,7 @@ def __eval_linear(grid,C,points,out,extrap_mode):
138135 n_x = len (grid .types )
139136 vector_valued = (C .ndim == d + 1 )
140137 vec_eval = (points .ndim == 2 )
141- grid_types = ['nonuniform' if isinstance (tt , numba . types . Array ) else 'uniform' for tt in grid .types ]
138+ grid_types = ['nonuniform' if isinstance (tt , Array ) else 'uniform' for tt in grid .types ]
142139 context = {'floor' : floor , 'zeros' : zeros , 'np' : np } #, 'Cd': Ad, 'dCd': dAd}
143140 if extrap_mode == t_NEAREST :
144141 extrap_ = 'nearest'
@@ -162,7 +159,7 @@ def __eval_linear(grid,C,points,out):
162159 n_x = len (grid .types )
163160 vector_valued = (C .ndim == d + 1 )
164161 vec_eval = (points .ndim == 2 )
165- grid_types = ['nonuniform' if isinstance (tt , numba . types . Array ) else 'uniform' for tt in grid .types ]
162+ grid_types = ['nonuniform' if isinstance (tt , Array ) else 'uniform' for tt in grid .types ]
166163 context = {'floor' : floor , 'zeros' : zeros , 'np' : np } #, 'Cd': Ad, 'dCd': dAd}
167164 code = get_code_linear (d , vector_valued = vector_valued , vectorized = vec_eval , allocate = False , grid_types = grid_types )
168165 # print(code)
@@ -193,7 +190,7 @@ def __eval_cubic(grid,C,points):
193190 vec_eval = (points .ndim == 2 )
194191 from math import floor
195192 from numpy import zeros
196- grid_types = ['nonuniform' if isinstance (tt , numba . types . Array ) else 'uniform' for tt in grid .types ]
193+ grid_types = ['nonuniform' if isinstance (tt , Array ) else 'uniform' for tt in grid .types ]
197194 context = {'floor' : floor , 'zeros' : zeros , 'Cd' : Ad , 'dCd' : dAd }
198195 code = get_code_cubic (d , vector_valued = vector_valued , vectorized = vec_eval , allocate = True , grid_types = grid_types )
199196 # print(code)
@@ -209,7 +206,7 @@ def __eval_cubic(grid,C,points,extrap_mode):
209206 vec_eval = (points .ndim == 2 )
210207 from math import floor
211208 from numpy import zeros
212- grid_types = ['nonuniform' if isinstance (tt , numba . types . Array ) else 'uniform' for tt in grid .types ]
209+ grid_types = ['nonuniform' if isinstance (tt , Array ) else 'uniform' for tt in grid .types ]
213210 context = {'floor' : floor , 'zeros' : zeros , 'Cd' : Ad , 'dCd' : dAd }
214211
215212 # print(f"We are going to extrapolate in {extrap_mode} mode.")
@@ -236,7 +233,7 @@ def __eval_cubic(grid,C,points,out,extrap_mode):
236233 n_x = len (grid .types )
237234 vector_valued = (C .ndim == d + 1 )
238235 vec_eval = (points .ndim == 2 )
239- grid_types = ['nonuniform' if isinstance (tt , numba . types . Array ) else 'uniform' for tt in grid .types ]
236+ grid_types = ['nonuniform' if isinstance (tt , Array ) else 'uniform' for tt in grid .types ]
240237 context = {'floor' : floor , 'zeros' : zeros , 'Cd' : Ad , 'dCd' : dAd }
241238 if extrap_mode == t_NEAREST :
242239 extrap_ = 'nearest'
@@ -260,7 +257,7 @@ def __eval_cubic(grid,C,points,out):
260257 n_x = len (grid .types )
261258 vector_valued = (C .ndim == d + 1 )
262259 vec_eval = (points .ndim == 2 )
263- grid_types = ['nonuniform' if isinstance (tt , numba . types . Array ) else 'uniform' for tt in grid .types ]
260+ grid_types = ['nonuniform' if isinstance (tt , Array ) else 'uniform' for tt in grid .types ]
264261 context = {'floor' : floor , 'zeros' : zeros , 'Cd' : Ad , 'dCd' : dAd }
265262 code = get_code_cubic (d , vector_valued = vector_valued , vectorized = vec_eval , allocate = False , grid_types = grid_types )
266263 # print(code)
0 commit comments