PiecewiseLinear

class PiecewiseLinear

User-defined piecewise linear function.

The independent variable ‘x’ has to be increasing. User have to specify at least 2 points

Public Functions

PiecewiseLinear() = default

Construct an empty linear interpolation object.

PiecewiseLinear(const std::vector<Real> &x, const std::vector<Real> &y)

Construct interpolation object by providing independent and dependent values.

Parameters:
  • x – Independent values

  • y – Dependent values

void create(const std::vector<Real> &x, const std::vector<Real> &y)

Create the interpolation object by providing independent and dependent values.

Parameters:
  • x – Independent values

  • y – Dependent values

Real evaluate(Real x)

Sample the interpolation at a point.

@params x Point where we sample the interpolation

Returns:

Interpolated value