sorted range
interpolant structure with .gridScopeView method. Complexity: O(range.length + interpolant.gridScopeView.length) to evaluate all elements.
Lazy input range.
PCHIP interpolation.
import mir.math.common: approxEqual; import mir.ndslice.slice: sliced; import mir.ndslice.allocation: rcslice; import mir.interpolate: interp1; import mir.interpolate.spline; static immutable x = [1.0, 2, 4, 5, 8, 10, 12, 15, 19, 22]; static immutable y = [17.0, 0, 16, 4, 10, 15, 19, 5, 18, 6]; auto interpolation = spline!double(x.rcslice, y.sliced, SplineType.monotone); auto xs = x[0 .. $ - 1].sliced + 0.5; auto ys = xs.interp1(interpolation);
Lazy interpolation shell with linear complexity.