Module quantmath::math::interpolation[][src]

Structs

CubicSpline

Cubic spline interpolation is continuous up to the second derivative. It builds sections of cubic curves, based on matching first derivatives at the pillar points. It is therefore generally smoother than a simple polynomial fit.

FlyweightLinear

Flyweight linear interpolation. In this interpolator, the data is kept externally, and passed into the interpolate function. This avoids the cost of creating a vector to hold the data internally.

Linear

Non-flyweight linear interpolation. In this interpolator, the data is kept internally, and passed into the constructor.

Enums

Extrap

Extrapolation methods

Traits

FlyweightInterpolate

Interpolation with date or number for the abscissa and number for the ordinal. In this implementation, the array of points is supplied in the call to the interpolate function.

Interpolable

To use interpolation, the types along the x axis must be Interpolable

Interpolate

Interpolation with date or number for the abscissa and number for the ordinal. In this implementation, the array of points is supplied in the constructor to the interpolation object.

Functions

lerp

Low-level linear interpolation function. Guaranteed to exactly equal the end points y0 and y1 when the fraction t is equal to 0 and 1 respectively.

linear_interpolate

Linear interpolation function. The y value and result must be f64. The x value can be any type supporting subtraction giving a numeric type.

linear_interpolate_extrapolate

Helper function for linear interpolation and extrapolation.

validate_abscissae

You should invoke this method to validate that the curve contains suitable data for this interpolator. Otherwise you may get unexpected panics or incorrect values when interpolating. (Validates that the x values are strictly monotonic increasing and none is NaN.)