The file misc/try_jit_classes has one example of a spline object using numba's jit classes.
sp = Spline3D(a,b,orders,values)
Current limitations:
uses .evaluate() method instead of more natural call
no type check
works only for 3D. Is it possible to create an object that would work in any dimension ?
As for the performance aspect (which can still improve), it is not bad at all. On a 50x50x50 grid evaluating on 10^6 points:
JIT class (repeated call): 0.309826135635376 # repeated calls to JIT class
No class (repeated call): 0.23068761825561523 # direct repeated calls to interp. routine
Vectorized version: 0.10867524147033691 # vectorized function (with no memory allocation)
Scipy (linear): 0.692845344543457 # (!?? is it the right way to proceed ?)
The file
misc/try_jit_classes
has one example of a spline object using numba's jit classes. sp = Spline3D(a,b,orders,values)Current limitations:
As for the performance aspect (which can still improve), it is not bad at all. On a 50x50x50 grid evaluating on 10^6 points: