QuantLib: Interpolation Class Reference

A free/open-source library for quantitative finance Reference manual - version 1.20

Classes | Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Interpolation Class Reference

base class for 1-D interpolations. More...

`#include <ql/math/interpolation.hpp>`

Inheritance diagram for Interpolation:
[legend]

## Classes
class | Impl
| abstract base class for interpolation implementations More...
class | templateImpl
| basic template implementation More...

## Public Types
typedef Real | argument_type
typedef Real | result_type

## Public Member Functions
bool | empty () const
Real | operator() (Real x, bool allowExtrapolation=false) const
Real | primitive (Real x, bool allowExtrapolation=false) const
Real | derivative (Real x, bool allowExtrapolation=false) const
Real | secondDerivative (Real x, bool allowExtrapolation=false) const
Real | xMin () const
Real | xMax () const
bool | isInRange (Real x) const
void | update ()
Public Member Functions inherited from Extrapolator
void | enableExtrapolation (bool b=true)
| enable extrapolation in subsequent calls
void | disableExtrapolation (bool b=true)
| disable extrapolation in subsequent calls
bool | allowsExtrapolation () const
| tells whether extrapolation is enabled

## Protected Member Functions
void | checkRange (Real x, bool extrapolate) const

## Protected Attributes
ext::shared_ptr< Impl > | impl_

## Detailed Description

base class for 1-D interpolations.

Classes derived from this class will provide interpolated values from two sequences of equal length, representing discretized values of a variable and a function of the former, respectively.

Warning:
  Interpolations don't copy their underlying data; instead, they store iterators through which they access them. This allow them to see changes in the underlying data without having to propagate them manually, but adds the requirement that the lifetime of the underlying data exceeds or equals the lifetime of the interpolation. It is up to the user to ensure this: usually, a class will store as data members both the data and the interpolation (see, e.g., the InterpolatedCurve class) and call the update() method on the latter when the data change.