Skip to content

Commit f5806d5

Browse files
committed
FIX: conda bug: reenabled cache=True option
1 parent e3352c3 commit f5806d5

File tree

9 files changed

+56
-52
lines changed

9 files changed

+56
-52
lines changed

interpolation/cartesian.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def mlinspace(a, b, nums, order='C'):
6767
return cartesian(nodes, order=order)
6868

6969

70-
@njit(cache=False)
70+
@njit(cache=True)
7171
def _repeat_1d(x, K, out):
7272
'''Repeats each element of a vector many times and repeats the whole result many times
7373

interpolation/splines/eval_cubic_numba.py

Lines changed: 24 additions & 24 deletions
Large diffs are not rendered by default.

interpolation/splines/eval_cubic_numba.py.in

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ for i in range(1,4):
3333
# SLOWER
3434
#
3535
# {{for d in range(1,max_order+1)}}
36-
# @njit(cache=False)
36+
# @njit(cache=True)
3737
# def vec_eval_cubic_spline_{{d}}(a, b, orders, coefs, points, values):
3838
#
3939
# N = points.shape[0]
@@ -46,7 +46,7 @@ for i in range(1,4):
4646

4747

4848
{{for d in range(1,max_order+1)}}
49-
@njit(cache=False)
49+
@njit(cache=True)
5050
def eval_cubic_spline_{{d}}(a, b, orders, coefs, point):
5151

5252
{{for i in range(d)}}
@@ -104,7 +104,7 @@ def eval_cubic_spline_{{d}}(a, b, orders, coefs, point):
104104

105105

106106
{{for d in range(1,max_order+1)}}
107-
@njit(cache=False)
107+
@njit(cache=True)
108108
def vec_eval_cubic_spline_{{d}}(a, b, orders, coefs, points, out):
109109

110110
d = a.shape[0]
@@ -165,7 +165,7 @@ def vec_eval_cubic_spline_{{d}}(a, b, orders, coefs, points, out):
165165

166166

167167
{{for d in range(1,max_order+1)}}
168-
@njit(cache=False)
168+
@njit(cache=True)
169169
def eval_cubic_splines_{{d}}(a, b, orders, coefs, point, vals):
170170

171171
n_vals = coefs.shape[{{d}}]
@@ -224,7 +224,7 @@ def eval_cubic_splines_{{d}}(a, b, orders, coefs, point, vals):
224224

225225

226226
{{for d in range(1,max_order+1)}}
227-
@njit(cache=False)
227+
@njit(cache=True)
228228
def vec_eval_cubic_splines_{{d}}(a, b, orders, coefs, points, vals):
229229

230230
n_vals = coefs.shape[{{d}}]
@@ -287,7 +287,7 @@ def vec_eval_cubic_splines_{{d}}(a, b, orders, coefs, points, vals):
287287

288288

289289
{{for d in range(1,max_order+1)}}
290-
@njit(cache=False)
290+
@njit(cache=True)
291291
def vec_eval_cubic_splines_G_{{d}}(a, b, orders, coefs, points, vals, dvals):
292292

293293
n_vals = coefs.shape[{{d}}]

interpolation/splines/filter_cubic.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
basis = np.array([1.0 / 6.0, 2.0 / 3.0, 1.0 / 6.0, 0.0])
99

1010

11-
@njit(cache=False)
11+
@njit(cache=True)
1212
def solve_deriv_interp_1d(bands, coefs):
1313

1414
M = coefs.shape[0] - 2
@@ -55,7 +55,7 @@ def solve_deriv_interp_1d(bands, coefs):
5555

5656

5757

58-
@njit(cache=False)
58+
@njit(cache=True)
5959
def find_coefs_1d(delta_inv, M, data, coefs):
6060

6161
bands = np.zeros((M + 2, 4))
@@ -88,7 +88,7 @@ def find_coefs_1d(delta_inv, M, data, coefs):
8888
solve_deriv_interp_1d(bands, coefs)
8989

9090

91-
@njit(cache=False)
91+
@njit(cache=True)
9292
def filter_coeffs_1d(dinv, data):
9393

9494
M = data.shape[0]
@@ -100,7 +100,7 @@ def filter_coeffs_1d(dinv, data):
100100
return coefs
101101

102102

103-
@njit(cache=False)
103+
@njit(cache=True)
104104
def filter_coeffs_2d(dinv, data):
105105

106106
Mx = data.shape[0]
@@ -124,7 +124,7 @@ def filter_coeffs_2d(dinv, data):
124124
return coefs
125125

126126

127-
@njit(cache=False)
127+
@njit(cache=True)
128128
def filter_coeffs_3d(dinv, data):
129129

130130
Mx = data.shape[0]
@@ -154,7 +154,7 @@ def filter_coeffs_3d(dinv, data):
154154
return coefs
155155

156156

157-
@njit(cache=False)
157+
@njit(cache=True)
158158
def filter_coeffs_4d(dinv, data):
159159

160160
Mx = data.shape[0]

interpolation/splines/multilinear.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import numpy
44
import numpy as np
55

6-
from interpolation.splines.multilinear_numba import multilinear_interpolation, vec_multilinear_interpolation
7-
86

97
def mlinspace(smin,smax,orders):
108
if len(orders) == 1:
@@ -83,6 +81,8 @@ def set_values(self,values):
8381

8482

8583
def interpolate(self,s):
84+
85+
from .multilinear_numba import multilinear_interpolation
8686
s = numpy.ascontiguousarray(s, dtype=self.dtype)
8787
a = multilinear_interpolation(self.smin,self.smax,self.orders,self.values,s)
8888
return a
@@ -92,7 +92,6 @@ def __call__(self,s):
9292
if s.ndim == 1:
9393
res = self.__call__( numpy.atleast_2d(s) )
9494
return res[0]
95-
9695
return self.interpolate(s)
9796

9897

@@ -169,6 +168,8 @@ def set_values(self,mvalues):
169168

170169

171170
def interpolate(self,s):
171+
172+
from .multilinear_numba import vec_multilinear_interpolation
172173
s = numpy.ascontiguousarray(s, dtype=self.dtype)
173174
a = vec_multilinear_interpolation(self.smin,self.smax,self.orders,self.mvalues,s)
174175
return a

interpolation/splines/multilinear_numba.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import numpy as np
2-
2+
from numba import njit
33

44
def vec_multilinear_interpolation(smin, smax, orders, values, s, out=None):
55

@@ -39,6 +39,7 @@ def multilinear_interpolation(smin, smax, orders, values, s, out=None):
3939
return out
4040

4141

42+
@njit(cache=True)
4243
def multilinear_interpolation_1d(smin, smax, orders, V, s, output):
4344

4445
d = 1
@@ -68,6 +69,7 @@ def multilinear_interpolation_1d(smin, smax, orders, V, s, output):
6869
output[n] = (1-lam_0)*(v_0) + (lam_0)*(v_1)
6970

7071

72+
@njit(cache=True)
7173
def multilinear_interpolation_2d(smin, smax, orders, V, s, output):
7274

7375
d = 2
@@ -103,9 +105,8 @@ def multilinear_interpolation_2d(smin, smax, orders, V, s, output):
103105
# interpolated/extrapolated value
104106
output[n] = (1-lam_0)*((1-lam_1)*(v_00) + (lam_1)*(v_01)) + (lam_0)*((1-lam_1)*(v_10) + (lam_1)*(v_11))
105107

106-
from numba import njit
107108

108-
@njit(cache=False)
109+
@njit(cache=True)
109110
def multilinear_interpolation_3d(smin, smax, orders, V, s, output):
110111

111112
d = 3
@@ -151,6 +152,7 @@ def multilinear_interpolation_3d(smin, smax, orders, V, s, output):
151152
output[n] = (1-lam_0)*((1-lam_1)*((1-lam_2)*(v_000) + (lam_2)*(v_001)) + (lam_1)*((1-lam_2)*(v_010) + (lam_2)*(v_011))) + (lam_0)*((1-lam_1)*((1-lam_2)*(v_100) + (lam_2)*(v_101)) + (lam_1)*((1-lam_2)*(v_110) + (lam_2)*(v_111)))
152153

153154

155+
@njit(cache=True)
154156
def multilinear_interpolation_4d(smin, smax, orders, V, s, output):
155157

156158
d = 4
@@ -209,6 +211,7 @@ def multilinear_interpolation_4d(smin, smax, orders, V, s, output):
209211
output[n] = (1-lam_0)*((1-lam_1)*((1-lam_2)*((1-lam_3)*(v_0000) + (lam_3)*(v_0001)) + (lam_2)*((1-lam_3)*(v_0010) + (lam_3)*(v_0011))) + (lam_1)*((1-lam_2)*((1-lam_3)*(v_0100) + (lam_3)*(v_0101)) + (lam_2)*((1-lam_3)*(v_0110) + (lam_3)*(v_0111)))) + (lam_0)*((1-lam_1)*((1-lam_2)*((1-lam_3)*(v_1000) + (lam_3)*(v_1001)) + (lam_2)*((1-lam_3)*(v_1010) + (lam_3)*(v_1011))) + (lam_1)*((1-lam_2)*((1-lam_3)*(v_1100) + (lam_3)*(v_1101)) + (lam_2)*((1-lam_3)*(v_1110) + (lam_3)*(v_1111))))
210212

211213

214+
@njit(cache=True)
212215
def multilinear_interpolation_5d(smin, smax, orders, V, s, output):
213216

214217
d = 5

interpolation/splines/multilinear_numba.py.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def multilinear_interpolation(smin, smax, orders, values, s, out=None):
3636

3737
{{for d in range(1,max_d+1)}}
3838

39-
@njit(cache=False)
39+
@njit(cache=True)
4040
def multilinear_interpolation_{{d}}d(smin, smax, orders, V, s, output):
4141

4242
d = {{d}}

misc/alternative_implementations.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
d2Ad[:,i] = dAd[:,i-1]*(4-i)
4747

4848

49-
@njit(cache=False)
49+
@njit(cache=True)
5050
def eval_cubic_spline_3(a, b, orders, coefs, point, Ad, dAd):
5151

5252
M0 = orders[0]
@@ -142,7 +142,7 @@ def eval_cubic_spline_3(a, b, orders, coefs, point, Ad, dAd):
142142
return t
143143

144144

145-
@njit(cache=False)
145+
@njit(cache=True)
146146
def vec_eval_cubic_spline_3(a, b, orders, coefs, points, values):
147147

148148
N = points.shape[0]
@@ -151,7 +151,7 @@ def vec_eval_cubic_spline_3(a, b, orders, coefs, points, values):
151151
point = points[n, :]
152152
values[n] = eval_cubic_spline_3(a, b, orders, coefs, point, Ad, dAd)
153153

154-
@njit(cache=False)
154+
@njit(cache=True)
155155
def vec_eval_cubic_spline_3_inlined(a, b, orders, coefs, points, values):
156156

157157
N = points.shape[0]
@@ -255,7 +255,7 @@ def vec_eval_cubic_spline_3_inlined(a, b, orders, coefs, points, values):
255255

256256
values[n] = Phi0_0*(Phi1_0*(Phi2_0*(coefs[i0+0,i1+0,i2+0]) + Phi2_1*(coefs[i0+0,i1+0,i2+1]) + Phi2_2*(coefs[i0+0,i1+0,i2+2]) + Phi2_3*(coefs[i0+0,i1+0,i2+3])) + Phi1_1*(Phi2_0*(coefs[i0+0,i1+1,i2+0]) + Phi2_1*(coefs[i0+0,i1+1,i2+1]) + Phi2_2*(coefs[i0+0,i1+1,i2+2]) + Phi2_3*(coefs[i0+0,i1+1,i2+3])) + Phi1_2*(Phi2_0*(coefs[i0+0,i1+2,i2+0]) + Phi2_1*(coefs[i0+0,i1+2,i2+1]) + Phi2_2*(coefs[i0+0,i1+2,i2+2]) + Phi2_3*(coefs[i0+0,i1+2,i2+3])) + Phi1_3*(Phi2_0*(coefs[i0+0,i1+3,i2+0]) + Phi2_1*(coefs[i0+0,i1+3,i2+1]) + Phi2_2*(coefs[i0+0,i1+3,i2+2]) + Phi2_3*(coefs[i0+0,i1+3,i2+3]))) + Phi0_1*(Phi1_0*(Phi2_0*(coefs[i0+1,i1+0,i2+0]) + Phi2_1*(coefs[i0+1,i1+0,i2+1]) + Phi2_2*(coefs[i0+1,i1+0,i2+2]) + Phi2_3*(coefs[i0+1,i1+0,i2+3])) + Phi1_1*(Phi2_0*(coefs[i0+1,i1+1,i2+0]) + Phi2_1*(coefs[i0+1,i1+1,i2+1]) + Phi2_2*(coefs[i0+1,i1+1,i2+2]) + Phi2_3*(coefs[i0+1,i1+1,i2+3])) + Phi1_2*(Phi2_0*(coefs[i0+1,i1+2,i2+0]) + Phi2_1*(coefs[i0+1,i1+2,i2+1]) + Phi2_2*(coefs[i0+1,i1+2,i2+2]) + Phi2_3*(coefs[i0+1,i1+2,i2+3])) + Phi1_3*(Phi2_0*(coefs[i0+1,i1+3,i2+0]) + Phi2_1*(coefs[i0+1,i1+3,i2+1]) + Phi2_2*(coefs[i0+1,i1+3,i2+2]) + Phi2_3*(coefs[i0+1,i1+3,i2+3]))) + Phi0_2*(Phi1_0*(Phi2_0*(coefs[i0+2,i1+0,i2+0]) + Phi2_1*(coefs[i0+2,i1+0,i2+1]) + Phi2_2*(coefs[i0+2,i1+0,i2+2]) + Phi2_3*(coefs[i0+2,i1+0,i2+3])) + Phi1_1*(Phi2_0*(coefs[i0+2,i1+1,i2+0]) + Phi2_1*(coefs[i0+2,i1+1,i2+1]) + Phi2_2*(coefs[i0+2,i1+1,i2+2]) + Phi2_3*(coefs[i0+2,i1+1,i2+3])) + Phi1_2*(Phi2_0*(coefs[i0+2,i1+2,i2+0]) + Phi2_1*(coefs[i0+2,i1+2,i2+1]) + Phi2_2*(coefs[i0+2,i1+2,i2+2]) + Phi2_3*(coefs[i0+2,i1+2,i2+3])) + Phi1_3*(Phi2_0*(coefs[i0+2,i1+3,i2+0]) + Phi2_1*(coefs[i0+2,i1+3,i2+1]) + Phi2_2*(coefs[i0+2,i1+3,i2+2]) + Phi2_3*(coefs[i0+2,i1+3,i2+3]))) + Phi0_3*(Phi1_0*(Phi2_0*(coefs[i0+3,i1+0,i2+0]) + Phi2_1*(coefs[i0+3,i1+0,i2+1]) + Phi2_2*(coefs[i0+3,i1+0,i2+2]) + Phi2_3*(coefs[i0+3,i1+0,i2+3])) + Phi1_1*(Phi2_0*(coefs[i0+3,i1+1,i2+0]) + Phi2_1*(coefs[i0+3,i1+1,i2+1]) + Phi2_2*(coefs[i0+3,i1+1,i2+2]) + Phi2_3*(coefs[i0+3,i1+1,i2+3])) + Phi1_2*(Phi2_0*(coefs[i0+3,i1+2,i2+0]) + Phi2_1*(coefs[i0+3,i1+2,i2+1]) + Phi2_2*(coefs[i0+3,i1+2,i2+2]) + Phi2_3*(coefs[i0+3,i1+2,i2+3])) + Phi1_3*(Phi2_0*(coefs[i0+3,i1+3,i2+0]) + Phi2_1*(coefs[i0+3,i1+3,i2+1]) + Phi2_2*(coefs[i0+3,i1+3,i2+2]) + Phi2_3*(coefs[i0+3,i1+3,i2+3])))
257257

258-
@njit(cache=False)
258+
@njit(cache=True)
259259
def vec_eval_cubic_spline_3_inlined_columns(a, b, orders, coefs, points, values):
260260

261261
# N = points.shape[0]
@@ -361,7 +361,7 @@ def vec_eval_cubic_spline_3_inlined_columns(a, b, orders, coefs, points, values)
361361

362362
values[n] = Phi0_0*(Phi1_0*(Phi2_0*(coefs[i0+0,i1+0,i2+0]) + Phi2_1*(coefs[i0+0,i1+0,i2+1]) + Phi2_2*(coefs[i0+0,i1+0,i2+2]) + Phi2_3*(coefs[i0+0,i1+0,i2+3])) + Phi1_1*(Phi2_0*(coefs[i0+0,i1+1,i2+0]) + Phi2_1*(coefs[i0+0,i1+1,i2+1]) + Phi2_2*(coefs[i0+0,i1+1,i2+2]) + Phi2_3*(coefs[i0+0,i1+1,i2+3])) + Phi1_2*(Phi2_0*(coefs[i0+0,i1+2,i2+0]) + Phi2_1*(coefs[i0+0,i1+2,i2+1]) + Phi2_2*(coefs[i0+0,i1+2,i2+2]) + Phi2_3*(coefs[i0+0,i1+2,i2+3])) + Phi1_3*(Phi2_0*(coefs[i0+0,i1+3,i2+0]) + Phi2_1*(coefs[i0+0,i1+3,i2+1]) + Phi2_2*(coefs[i0+0,i1+3,i2+2]) + Phi2_3*(coefs[i0+0,i1+3,i2+3]))) + Phi0_1*(Phi1_0*(Phi2_0*(coefs[i0+1,i1+0,i2+0]) + Phi2_1*(coefs[i0+1,i1+0,i2+1]) + Phi2_2*(coefs[i0+1,i1+0,i2+2]) + Phi2_3*(coefs[i0+1,i1+0,i2+3])) + Phi1_1*(Phi2_0*(coefs[i0+1,i1+1,i2+0]) + Phi2_1*(coefs[i0+1,i1+1,i2+1]) + Phi2_2*(coefs[i0+1,i1+1,i2+2]) + Phi2_3*(coefs[i0+1,i1+1,i2+3])) + Phi1_2*(Phi2_0*(coefs[i0+1,i1+2,i2+0]) + Phi2_1*(coefs[i0+1,i1+2,i2+1]) + Phi2_2*(coefs[i0+1,i1+2,i2+2]) + Phi2_3*(coefs[i0+1,i1+2,i2+3])) + Phi1_3*(Phi2_0*(coefs[i0+1,i1+3,i2+0]) + Phi2_1*(coefs[i0+1,i1+3,i2+1]) + Phi2_2*(coefs[i0+1,i1+3,i2+2]) + Phi2_3*(coefs[i0+1,i1+3,i2+3]))) + Phi0_2*(Phi1_0*(Phi2_0*(coefs[i0+2,i1+0,i2+0]) + Phi2_1*(coefs[i0+2,i1+0,i2+1]) + Phi2_2*(coefs[i0+2,i1+0,i2+2]) + Phi2_3*(coefs[i0+2,i1+0,i2+3])) + Phi1_1*(Phi2_0*(coefs[i0+2,i1+1,i2+0]) + Phi2_1*(coefs[i0+2,i1+1,i2+1]) + Phi2_2*(coefs[i0+2,i1+1,i2+2]) + Phi2_3*(coefs[i0+2,i1+1,i2+3])) + Phi1_2*(Phi2_0*(coefs[i0+2,i1+2,i2+0]) + Phi2_1*(coefs[i0+2,i1+2,i2+1]) + Phi2_2*(coefs[i0+2,i1+2,i2+2]) + Phi2_3*(coefs[i0+2,i1+2,i2+3])) + Phi1_3*(Phi2_0*(coefs[i0+2,i1+3,i2+0]) + Phi2_1*(coefs[i0+2,i1+3,i2+1]) + Phi2_2*(coefs[i0+2,i1+3,i2+2]) + Phi2_3*(coefs[i0+2,i1+3,i2+3]))) + Phi0_3*(Phi1_0*(Phi2_0*(coefs[i0+3,i1+0,i2+0]) + Phi2_1*(coefs[i0+3,i1+0,i2+1]) + Phi2_2*(coefs[i0+3,i1+0,i2+2]) + Phi2_3*(coefs[i0+3,i1+0,i2+3])) + Phi1_1*(Phi2_0*(coefs[i0+3,i1+1,i2+0]) + Phi2_1*(coefs[i0+3,i1+1,i2+1]) + Phi2_2*(coefs[i0+3,i1+1,i2+2]) + Phi2_3*(coefs[i0+3,i1+1,i2+3])) + Phi1_2*(Phi2_0*(coefs[i0+3,i1+2,i2+0]) + Phi2_1*(coefs[i0+3,i1+2,i2+1]) + Phi2_2*(coefs[i0+3,i1+2,i2+2]) + Phi2_3*(coefs[i0+3,i1+2,i2+3])) + Phi1_3*(Phi2_0*(coefs[i0+3,i1+3,i2+0]) + Phi2_1*(coefs[i0+3,i1+3,i2+1]) + Phi2_2*(coefs[i0+3,i1+3,i2+2]) + Phi2_3*(coefs[i0+3,i1+3,i2+3])))
363363

364-
@njit(cache=False)
364+
@njit(cache=True)
365365
def vec_eval_cubic_spline_3_inlined_lesswork(orders, coefs, points, values, Ad, dAd):
366366

367367
N = points.shape[0]
@@ -417,7 +417,7 @@ def vec_eval_cubic_spline_3_inlined_lesswork(orders, coefs, points, values, Ad,
417417

418418

419419

420-
@njit(cache=False)
420+
@njit(cache=True)
421421
def kernel(n, a, b, orders, coefs, points, values):
422422

423423
x0 = points[n,0]
@@ -518,7 +518,7 @@ def kernel(n, a, b, orders, coefs, points, values):
518518

519519
values[n] = t
520520

521-
@njit(cache=False)
521+
@njit(cache=True)
522522
def vec_eval_cubic_spline_3_kernel(a, b, orders, coefs, points, values):
523523

524524
N = points.shape[0]

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# Versions should comply with PEP440. For a discussion on single-sourcing
99
# the version across setup.py and the project code, see
1010
# http://packaging.python.org/en/latest/tutorial.html#version
11-
version='0.1.5',
11+
version='0.1.6',
1212

1313
description='Interpolation in Python',
1414
# long_description=long_description,

0 commit comments

Comments
 (0)