CubicSplineInterpolation Class Reference

#include <ql/math/interpolations/cubicspline.hpp>

Inheritance diagram for CubicSplineInterpolation:

List of all members.


Detailed Description

Cubic spline interpolation between discrete points.

It implements different type of end conditions: not-a-knot, first derivative value, second derivative value.

It also implements Hyman's monotonicity constraint filter which ensures that in the regions of monotoniticity of the input (so, three successive increasing or decreasing values) the interpolating spline remains monotonic at the expense of the second derivative of the curve which will no longer be continuous where the filter has been applied. If the interpolating spline is already monotonic, the Hyman filter leaves it unchanged.

See R. L. Dougherty, A. Edelman, and J. M. Hyman, "Nonnegativity-, Monotonicity-, or Convexity-Preserving CubicSpline and Quintic Hermite Interpolation" Mathematics Of Computation, v. 52, n. 186, April 1989, pp. 471-494.

Tests:
the correctness of the returned values is tested by reproducing results available in literature.

Public Types

enum  BoundaryCondition {
  NotAKnot, FirstDerivative, SecondDerivative, Periodic,
  Lagrange
}

Public Member Functions

template<class I1, class I2>
 CubicSplineInterpolation (const I1 &xBegin, const I1 &xEnd, const I2 &yBegin, CubicSplineInterpolation::BoundaryCondition leftCondition, Real leftConditionValue, CubicSplineInterpolation::BoundaryCondition rightCondition, Real rightConditionValue, bool monotonicityConstraint)
const std::vector< Real > & primitiveConstants () const
const std::vector< Real > & aCoefficients () const
const std::vector< Real > & bCoefficients () const
const std::vector< Real > & cCoefficients () const
const std::vector< bool > & monotonicityAdjustments () const

Member Enumeration Documentation

Enumerator:
NotAKnot  Make second(-last) point an inactive knot.
FirstDerivative  Match value of end-slope.
SecondDerivative  Match value of second derivative at end.
Periodic  Match first and second derivative at either end.
Lagrange  Match end-slope to the slope of the cubic that matches the first four data at the respective end


Constructor & Destructor Documentation

CubicSplineInterpolation ( const I1 &  xBegin,
const I1 &  xEnd,
const I2 &  yBegin,
CubicSplineInterpolation::BoundaryCondition  leftCondition,
Real  leftConditionValue,
CubicSplineInterpolation::BoundaryCondition  rightCondition,
Real  rightConditionValue,
bool  monotonicityConstraint 
)

Precondition:
the $ x $ values must be sorted.