interlib is a Python library for interpolation methods designed as an alternative to scipy.interpolate. Being built on Rust, it provides reliable and in some cases faster solutions to unknown data point problems. It includes polynomial, piecewise, approximation-based and advanced interpolators for all of your needs.
pip install interlib-rsThe PyPI distribution name is interlib-rs, but the Python import name is still
interlib:
from interlib import LinearInterpolatorFrom interlib/:
.venv/bin/python -m maturin developThis rebuilds and installs the extension in editable mode inside the project venv.
from interlib import LinearInterpolator
interp = LinearInterpolator()
interp.fit([0.0, 1.0, 2.0], [0.0, 1.0, 4.0])
# scalar input -> float
y1 = interp(1.5)
# sequence input -> ordered list[float]
y_many = interp([0.5, 1.5])Common user errors are reported as ValueError (for example: unfitted usage,
length mismatch, invalid constructor parameters, out-of-range Chebyshev input).
- Polynomial exact-fit (
LagrangeInterpolator,NewtonInterpolator): good for small clean datasets; can oscillate at high degree/uniform nodes. - Piecewise local (
LinearInterpolator,QuadraticInterpolator,CubicSplineInterpolator): robust defaults for many engineering signals; cubic spline is the smoothest common default. - Derivative-constrained (
HermiteInterpolator): use when you knowdyat sample points. - Approximation/noisy data (
LeastSquaresInterpolator): fit trend instead of exact point pass-through. - Kernel/global (
RBFInterpolator): flexible smooth interpolation; kernel/epsilon tuning matters. - Chebyshev function approximation (
ChebyshevInterpolator): stable high-accuracy approximation over fixed interval.
See GUIDE.md for a fuller selection guide and pitfalls.
The repository includes cached real-data benchmark entrypoints:
python python/benches/real_data_bench.py --dataset noaa --station KSFO --field temperature
python python/benches/real_data_bench.py --dataset nasa --command 499 --axis xThese benchmark against held-out real observations (NOAA/NASA) instead of only synthetic functions.
Runnable case studies:
python/case_studies/function_approx.py(includescos(x)and Runge function)python/case_studies/signal_rec.py(sampled signal reconstruction)python/case_studies/engineering.py(engineering-style datasets, including temperature profiles)
MATLAB integration is not the Python wheel path.
- Python uses PyO3 + maturin wheels.
- MATLAB uses standalone Rust FFI shared library + MATLAB
.mwrappers.
MATLAB build path:
make matlab-buildMATLAB docs:
matlab/README.mdmatlab/MATLAB_DOCKER.md
GitHub Actions currently targets standalone Rust MATLAB/FFI binaries.
The .mltbx toolbox package is built locally from a licensed MATLAB runtime:
MATLAB_IMAGE=my-matlab-image:auth make matlab-toolbox-package-batchThis writes dist/interlib.mltbx.