The OpenD Programming Language

ConstantExtrapolator

Constant extrapolator

Constructors

this
this(T data)

Members

Functions

gridScopeView
auto gridScopeView()
lightConst
ConstantExtrapolator lightConst()

Templates

opCall
template opCall(uint derivative = 0)

Variables

data
T data;
derivativeOrder
enum uint derivativeOrder;
dimensionCount
enum uint dimensionCount;

Examples

import mir.interpolate.linear;

auto x = [0.0, 1, 2, 3, 5];
auto y = [4.0, 0, 9, 23, 40];

auto g = [7.0, 10, 15];

import mir.ndslice.allocation: rcslice;

auto linear = linear!double(
    x.rcslice!(immutable double),
    y.rcslice!(const double),
).constantExtrapolator;

assert(linear(2) == 9);
assert(linear(-1) == 4);
assert(linear(100) == 40);

assert(linear.opCall!1(-1) == [4, 0]);

Meta