Class LinearInterpolator#
Defined in File Interpolation.h
Inheritance Relationships#
Base Type#
public Karana::Math::BaseInterpolator(Class BaseInterpolator)
Class Documentation#
-
class LinearInterpolator : public Karana::Math::BaseInterpolator#
Piecewise linear interpolation method
Public Types
Public Functions
-
LinearInterpolator(ConstVecSlice indep, ConstVecSlice dep, std::optional<Extrapolation> extrapolation = std::nullopt)#
LinearInterpolator constructor.
- Parameters:
indep – Monotonically increasing independent variable values
dep – Corresponding dependent variable values
extrapolation – How to extrapolate outside the data points. If omitted, extrapolated values are NaN.
-
virtual double operator()(double x) const override#
Sample the dependent variable.
- Parameters:
x – A value for the independent variable
- Returns:
The corresponding value for the dependent variable
-
virtual void operator()(ConstVecSlice x, VecSlice out) const#
Sample the dependent variable at multiple values.
- Parameters:
x – A vector containing values for the independent variable
out – A matching sized vector to contain the result
-
virtual Vec operator()(ConstVecSlice x) const#
Sample the dependent variable at multiple values.
- Parameters:
x – A vector containing values for the independent variable
- Returns:
A corresponding vector of dependent variable values
-
LinearInterpolator(ConstVecSlice indep, ConstVecSlice dep, std::optional<Extrapolation> extrapolation = std::nullopt)#