Skip to main content

Interpolator

Trait Interpolator 

Source
pub trait Interpolator {
    type Output: Interpolation;

    const GLOBAL: bool = false;

    // Required method
    fn interpolate(&self, x: &[Real], y: &[Real]) -> QlResult<Self::Output>;

    // Provided method
    fn required_points(&self) -> Size { ... }
}
Expand description

A factory building an Interpolation over (x, y) nodes.

Mirrors QuantLib’s interpolator traits classes (Linear, LogLinear, …): term structures store the factory alongside their node data and rebuild the interpolation from it whenever the data changes.

Provided Associated Constants§

Source

const GLOBAL: bool = false

Whether this is a global interpolator: every interpolated value depends on all node values, so moving one node re-shapes the whole curve.

Mirrors QuantLib’s Interpolator::global. A single-pass bootstrap solves each node once against the curve built so far, which cannot converge a global interpolator (an earlier node’s value shifts once later nodes are added). Local interpolators (Linear, LogLinear, BackwardFlat) leave this false; Cubic overrides it to true.

Required Associated Types§

Source

type Output: Interpolation

The interpolation type this factory builds.

Required Methods§

Source

fn interpolate(&self, x: &[Real], y: &[Real]) -> QlResult<Self::Output>

Builds an interpolation through (x, y).

Provided Methods§

Source

fn required_points(&self) -> Size

The minimum number of nodes the interpolation requires.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§