bCoefficients (3) - Linux Manuals

bCoefficients: Cubic interpolation between discrete points.

NAME

QuantLib::CubicInterpolation - Cubic interpolation between discrete points.

SYNOPSIS


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

Inherits QuantLib::Interpolation.

Inherited by MonotonicNaturalCubicInterpolation, and NaturalCubicInterpolation.

Public Types


enum DerivativeApprox { Spline, FourthOrder, Parabolic, ModifiedParabolic, FritschButland, Akima, Kruger }

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

Public Member Functions


template<class I1 , class I2 > CubicInterpolation (const I1 &xBegin, const I1 &xEnd, const I2 &yBegin, CubicInterpolation::DerivativeApprox da, bool monotonic, CubicInterpolation::BoundaryCondition leftCond, Real leftConditionValue, CubicInterpolation::BoundaryCondition rightCond, Real rightConditionValue)

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

Detailed Description

Cubic interpolation between discrete points.

Cubic interpolation is fully defined when the ${f_i}$ function values at points ${x_i}$ are supplemented with ${f_i}$ function derivative values.

Different type of first derivative approximations are implemented, both local and non-local. Local schemes (Fourth-order, Parabolic, Modified Parabolic, Fritsch-Butland, Akima, Kruger) use only $f$ values near $x_i$ to calculate $f_i$. Non-local schemes (Spline with different boundary conditions) use all ${f_i}$ values and obtain ${f_i}$ by solving a linear system of equations. Local schemes produce $C^1$ interpolants, while the spline scheme generates $C^2$ interpolants.

Hyman's monotonicity constraint filter is also implemented: it can be applied to all schemes to ensure that in the regions of local monotoniticity of the input (three successive increasing or decreasing values) the interpolating cubic remains monotonic. If the interpolating cubic is already monotonic, the Hyman filter leaves it unchanged preserving all its original features.

In the case of $C^2$ interpolants the Hyman filter ensures local monotonicity at the expense of the second derivative of the interpolant which will no longer be continuous in the points where the filter has been applied.

While some non-linear schemes (Modified Parabolic, Fritsch-Butland, Kruger) are guaranteed to be locally monotone in their original approximation, all other schemes must be filtered according to the Hyman criteria at the expense of their linearity.

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.

Possible enhancements

implement missing schemes (FourthOrder and ModifiedParabolic) and missing boundary conditions (Periodic and Lagrange).

Tests

to be adapted from old ones.

Member Enumeration Documentation

enum DerivativeApprox

Enumerator:

Spline
Spline approximation (non-local, non-monotone, linear[?]). Different boundary conditions can be used on the left and right boundaries: see BoundaryCondition.
FourthOrder
Fourth-order approximation (local, non-monotone, linear).
Parabolic
Parabolic approximation (local, non-monotone, linear).
ModifiedParabolic
Modified-Parabolic approximation (local, monotone, non-linear).
FritschButland
Fritsch-Butland approximation (local, monotone, non-linear).
Akima
Akima approximation (local, non-monotone, non-linear).
Kruger
Kruger approximation (local, monotone, non-linear).

enum BoundaryCondition

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

CubicInterpolation (const I1 & xBegin, const I1 & xEnd, const I2 & yBegin, CubicInterpolation::DerivativeApprox da, bool monotonic, CubicInterpolation::BoundaryCondition leftCond, Real leftConditionValue, CubicInterpolation::BoundaryCondition rightCond, Real rightConditionValue)

Precondition:

the $ x $ values must be sorted.

Author

Generated automatically by Doxygen for QuantLib from the source code.