Class NearestNeighborInterpolator#

Inheritance Relationships#

Base Type#

Class Documentation#

class NearestNeighborInterpolator : public Karana::Math::BaseInterpolator#

Nearest neighbor interpolation method

Public Functions

NearestNeighborInterpolator(ConstVecSlice indep, ConstVecSlice dep)#

NearestNeighborInterpolator constructor.

Parameters:
  • indep – Monotonically increasing independent variable values

  • dep – Corresponding dependent variable values

NearestNeighborInterpolator(const NearestNeighborInterpolator&) = default#

Copy constructor.

NearestNeighborInterpolator &operator=(const NearestNeighborInterpolator&) = default#

Copy assignment operator.

Returns:

A reference the recently assigned to ConstantInterpolator.

virtual double operator()(double x) const override#

Call operator to do interpolation.

Parameters:

x – The value to interpolate at.

Returns:

The interpolated value.

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