Constructs multivariate constant interpolant with nodes on rectilinear grid.
Multivariate constant interpolant with nodes on rectilinear grid.
import mir.ndslice; import mir.math.common: approxEqual; static immutable x = [0, 1, 2, 3]; static immutable y = [10, 20, 30, 40]; auto interpolant = constant!int(x.rcslice, y.rcslice!(const int)); assert(interpolant(-1) == 10); assert(interpolant(0) == 10); assert(interpolant(0.5) == 10); assert(interpolant(1) == 20); assert(interpolant(3) == 40); assert(interpolant(4) == 40);
2020 Ilya Yaroshenko, Kaleidic Associates Advisory Limited, Symmetry Investments
Constant Interpolation