No description, website, or topics provided.
Python

README.md

Optimized interpolation routines in Python / numba

Build Status

This library provides fast numba-accelerated interpolation routines for the following cases:

multilinear and cubic splines in any dimension

Here is an example in 3 dimensions:

from interpolation.splines import LinearSpline, CubicSpline
a = np.array([0.0,0.0,0.0])         # lower boundaries
b = np.array([1.0,1.0,1.0])         # upper boundaries
orders = np.array([50,50,50])       # 10 points along each dimension
values = np.random.random(orders)   # values at each node of the grid
S = np.random.random((10^6,3))    # coordinates at which to evaluate the splines

# multilinear
lin = LinearSpline(a,b,orders,values)
V = lin(S)
# cubic
spline = CubicSpline(a,b,orders,values) # filter the coefficients
V = spline(S)                       # interpolates -> (100000,) array

Unfair timings: (from misc/speed_comparison.py)

# interpolate 10^6 points on a 50x50x50 grid.
Cubic: 0.11488723754882812
Linear: 0.03426337242126465
Scipy (linear): 0.6502540111541748

More details are available as an example notebook

Other available features are:

  • linear extrapolation
  • computation of derivatives
  • interpolate many functions at once (multi-splines or vector valued splines)

Experimental

  • evaluation on the GPU (with numba.cuda)
  • parallel evaluation (with guvectorize)

In the near future:

  • JIT classes for all interpolation objects

smolyak interpolation

See testfile for examples.