The OpenD Programming Language

LinearExtrapolator

Linear extrapolator.

Constructors

this
this(T data)

Members

Functions

gridScopeView
auto gridScopeView()
lightConst
LinearExtrapolator lightConst()

Templates

opCall
template opCall(uint derivative = 0)

Variables

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

Examples

import mir.test;
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),
);

auto linearLinear = linear.linearExtrapolator;

linearLinear(2).should == linear(2);
linearLinear(-1).should == linear(-1);
linearLinear.opCall!1(-1).should == [8, -4];
linearLinear(100).shouldApprox == linear(100);

Meta