pub struct Interp1D<D, S>where
D: Data + RawDataClone + Clone,
D::Elem: Num + PartialOrd + Copy + Debug,
S: Strategy1D<D> + Clone,{
pub data: InterpData1D<D>,
pub strategy: S,
pub extrapolate: Extrapolate<D::Elem>,
}Expand description
1-D interpolator
Fields§
§data: InterpData1D<D>§strategy: S§extrapolate: Extrapolate<D::Elem>Implementations§
Source§impl<D, S> Interp1D<D, S>where
D: Data + RawDataClone + Clone,
D::Elem: Num + PartialOrd + Copy + Debug,
S: Strategy1D<D> + Clone,
impl<D, S> Interp1D<D, S>where
D: Data + RawDataClone + Clone,
D::Elem: Num + PartialOrd + Copy + Debug,
S: Strategy1D<D> + Clone,
Sourcepub fn set_extrapolate(
&mut self,
extrapolate: Extrapolate<D::Elem>,
) -> Result<(), ValidateError>
pub fn set_extrapolate( &mut self, extrapolate: Extrapolate<D::Elem>, ) -> Result<(), ValidateError>
Set Extrapolate variant, checking validity.
pub fn check_extrapolate( &self, extrapolate: &Extrapolate<D::Elem>, ) -> Result<(), ValidateError>
Source§impl<D, S> Interp1D<D, S>where
D: Data + RawDataClone + Clone,
D::Elem: Num + PartialOrd + Copy + Debug,
S: Strategy1D<D> + Clone,
impl<D, S> Interp1D<D, S>where
D: Data + RawDataClone + Clone,
D::Elem: Num + PartialOrd + Copy + Debug,
S: Strategy1D<D> + Clone,
Sourcepub fn new(
x: ArrayBase<D, Ix1>,
f_x: ArrayBase<D, Ix1>,
strategy: S,
extrapolate: Extrapolate<D::Elem>,
) -> Result<Self, ValidateError>
pub fn new( x: ArrayBase<D, Ix1>, f_x: ArrayBase<D, Ix1>, strategy: S, extrapolate: Extrapolate<D::Elem>, ) -> Result<Self, ValidateError>
Instantiate one-dimensional interpolator.
Applicable interpolation strategies:
Extrapolate::Enable is valid for Linear
§Example:
use ndarray::prelude::*;
use ninterp::prelude::*;
// f(x) = 0.4 * x
let interp = Interp1D::new(
// x
array![0., 1., 2.], // x0, x1, x2
// f(x)
array![0.0, 0.4, 0.8], // f(x0), f(x1), f(x2)
Linear,
Extrapolate::Enable,
)
.unwrap();
assert_eq!(interp.interpolate(&[1.4]).unwrap(), 0.56);
assert_eq!(
interp.interpolate(&[3.6]).unwrap(),
1.44
);Source§impl<D> Interp1D<D, Box<dyn Strategy1D<D>>>
impl<D> Interp1D<D, Box<dyn Strategy1D<D>>>
Sourcepub fn set_strategy(
&mut self,
strategy: Box<dyn Strategy1D<D>>,
) -> Result<(), ValidateError>
pub fn set_strategy( &mut self, strategy: Box<dyn Strategy1D<D>>, ) -> Result<(), ValidateError>
Update strategy dynamically.
Trait Implementations§
Source§impl<D, S> Clone for Interp1D<D, S>where
D: Data + RawDataClone + Clone + Clone,
D::Elem: Num + PartialOrd + Copy + Debug + Clone,
S: Strategy1D<D> + Clone + Clone,
impl<D, S> Clone for Interp1D<D, S>where
D: Data + RawDataClone + Clone + Clone,
D::Elem: Num + PartialOrd + Copy + Debug + Clone,
S: Strategy1D<D> + Clone + Clone,
Source§impl<D, S> Debug for Interp1D<D, S>where
D: Data + RawDataClone + Clone + Debug,
D::Elem: Num + PartialOrd + Copy + Debug + Debug,
S: Strategy1D<D> + Clone + Debug,
impl<D, S> Debug for Interp1D<D, S>where
D: Data + RawDataClone + Clone + Debug,
D::Elem: Num + PartialOrd + Copy + Debug + Debug,
S: Strategy1D<D> + Clone + Debug,
Source§impl<D, S> Interpolator<<D as RawData>::Elem> for Interp1D<D, S>where
D: Data + RawDataClone + Clone,
D::Elem: Num + PartialOrd + Copy + Debug,
S: Strategy1D<D> + Clone,
impl<D, S> Interpolator<<D as RawData>::Elem> for Interp1D<D, S>where
D: Data + RawDataClone + Clone,
D::Elem: Num + PartialOrd + Copy + Debug,
S: Strategy1D<D> + Clone,
Source§impl<D, S> PartialEq for Interp1D<D, S>where
D: Data + RawDataClone + Clone + PartialEq,
D::Elem: Num + PartialOrd + Copy + Debug + PartialEq,
S: Strategy1D<D> + Clone + PartialEq,
impl<D, S> PartialEq for Interp1D<D, S>where
D: Data + RawDataClone + Clone + PartialEq,
D::Elem: Num + PartialOrd + Copy + Debug + PartialEq,
S: Strategy1D<D> + Clone + PartialEq,
impl<D, S> StructuralPartialEq for Interp1D<D, S>where
D: Data + RawDataClone + Clone,
D::Elem: Num + PartialOrd + Copy + Debug,
S: Strategy1D<D> + Clone,
Auto Trait Implementations§
impl<D, S> Freeze for Interp1D<D, S>
impl<D, S> RefUnwindSafe for Interp1D<D, S>
impl<D, S> Send for Interp1D<D, S>
impl<D, S> Sync for Interp1D<D, S>
impl<D, S> Unpin for Interp1D<D, S>
impl<D, S> UnwindSafe for Interp1D<D, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more