Trait Interpolator

Source
pub trait Interpolator<IndexType, ValueType>
where IndexType: InterpolationIndex, ValueType: InterpolationValue,
{ // Required methods fn fit(&mut self) -> Result<(), RustQuantError>; fn interpolate(&self, point: IndexType) -> Result<ValueType, RustQuantError>; fn range(&self) -> (IndexType, IndexType); fn add_point(&mut self, point: (IndexType, ValueType)); }
Expand description

Interpolator trait. This trait is implemented by all interpolation models.

Required Methods§

Source

fn fit(&mut self) -> Result<(), RustQuantError>

Fit the interpolator to the data.

§Errors
  • RustQuantError::UnequalLength when the length of xs != ys.
Source

fn interpolate(&self, point: IndexType) -> Result<ValueType, RustQuantError>

Interpolate at value point.

§Errors
  • RustQuantError::Unfitted when the interpolator has not been fitted.
Source

fn range(&self) -> (IndexType, IndexType)

Return range of interpolation.

Source

fn add_point(&mut self, point: (IndexType, ValueType))

Add a point to the interpolator.

Implementors§

Source§

impl<IndexType, ValueType> Interpolator<IndexType, ValueType> for ExponentialInterpolator<IndexType, ValueType>
where IndexType: InterpolationIndex<DeltaDiv = ValueType>, ValueType: InterpolationValue + Float,

Source§

impl<IndexType, ValueType> Interpolator<IndexType, ValueType> for LinearInterpolator<IndexType, ValueType>
where IndexType: InterpolationIndex<DeltaDiv = ValueType>, ValueType: InterpolationValue,