Class Interpolate

Class Documentation

class Interpolate

Public Types

enum Style

Values:

UNKNOWN = -1
CONSTANT = 0
LINEAR = 1
NATURAL_SPLINE = 2
CUBIC_SPLINE = 3
CUBIC_SPLINE_PERIODIC = 4
AKIMA_SPLINE = 5
AKIMA_SPLINE_PERIODIC = 6
NUM_STYLES

Public Functions

Interpolate(Interpolate const&)
Interpolate(Interpolate&&)
Interpolate &operator=(Interpolate const&)
Interpolate &operator=(Interpolate&&)
virtual ~Interpolate()
virtual double interpolate(double const x) const = 0
std::vector<double> interpolate(std::vector<double> const &x) const
ndarray::Array<double, 1> interpolate(ndarray::Array<double const, 1> const &x) const

Protected Functions

Interpolate(std::vector<double> const &x, std::vector<double> const &y, Interpolate::Style const style = UNKNOWN)

Parameters
  • x: the ordinates of points

  • y: the values at x[]

  • style: desired interpolator

Base class ctor

Interpolate(std::pair<std::vector<double>, std::vector<double>> const xy, Interpolate::Style const style = UNKNOWN)

Base class ctor. Note that we should use rvalue references when available as the vectors in xy will typically be movable (although the returned-value-optimisation might suffice for the cases we care about)

Parameters
  • xy: pair (x,y) where x are the ordinates of points and y are the values at x[]

  • style: desired interpolator

Protected Attributes

std::vector<double> const _x
std::vector<double> const _y
Interpolate::Style const _style

Friends

std::shared_ptr<Interpolate> makeInterpolate(std::vector<double> const &x, std::vector<double> const &y, Interpolate::Style const style)

A factory function to make Interpolate objects

Parameters
  • x: the x-values of points

  • y: the values at x[]

  • style: desired interpolator