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§
Sourcefn fit(&mut self) -> Result<(), RustQuantError>
fn fit(&mut self) -> Result<(), RustQuantError>
Fit the interpolator to the data.
§Errors
RustQuantError::UnequalLength
when the length ofxs
!=ys
.
Sourcefn interpolate(&self, point: IndexType) -> Result<ValueType, RustQuantError>
fn interpolate(&self, point: IndexType) -> Result<ValueType, RustQuantError>
Interpolate at value point
.
§Errors
RustQuantError::Unfitted
when the interpolator has not been fitted.
Sourcefn range(&self) -> (IndexType, IndexType)
fn range(&self) -> (IndexType, IndexType)
Return range of interpolation.
Sourcefn add_point(&mut self, point: (IndexType, ValueType))
fn add_point(&mut self, point: (IndexType, ValueType))
Add a point to the interpolator.