atInterval

Optimization utility that can be used with interpolants if x should be extrapolated at interval given.

By default interpolants uses binary search to find appropriate interval, it has O(log(.gridScopeView.length)) complexity. If an interval is given, interpolant uses it instead of binary search.

@optmath
RefTuple!(T, size_t)
atInterval
(
T
)
(
in T value
,)

Examples

import mir.ndslice.allocation;
import mir.ndslice.slice;
import mir.interpolate.spline;
static immutable x = [0.0, 1, 2];
static immutable y = [3.0, 4, -10];
auto interpolant = spline!double(x.rcslice, y.sliced);
assert(interpolant(1.3) != interpolant(1.3.atInterval(0)));
assert(interpolant(1.3) == interpolant(1.3.atInterval(1)));

Meta