pub struct CubicSpline<T, D: Dimension> { /* private fields */ }
Expand description
The CubicSpline 1d interpolation Strategy (Builder)
§Example
From Wikipedia
let y = array![ 0.5, 0.0, 3.0];
let x = array![-1.0, 0.0, 3.0];
let query = Array::linspace(-1.0, 3.0, 10);
let interpolator = Interp1DBuilder::new(y)
.strategy(CubicSpline::new())
.x(x)
.build().unwrap();
let result = interpolator.interp_array(&query).unwrap();
let expect = array![
0.5,
0.1851851851851852,
0.01851851851851853,
-5.551115123125783e-17,
0.12962962962962965,
0.40740740740740755,
0.8333333333333331,
1.407407407407407,
2.1296296296296293, 3.0
];
Implementations§
Source§impl<T, D> CubicSpline<T, D>
impl<T, D> CubicSpline<T, D>
Sourcepub fn extrapolate(self, extrapolate: bool) -> Self
pub fn extrapolate(self, extrapolate: bool) -> Self
does the strategy extrapolate? Default is false
Sourcepub fn boundary(self, boundary: BoundaryCondition<T, D>) -> Self
pub fn boundary(self, boundary: BoundaryCondition<T, D>) -> Self
set the boundary condition. default is BoundaryCondition::Natural
Trait Implementations§
Source§impl<T, D> Default for CubicSpline<T, D>
impl<T, D> Default for CubicSpline<T, D>
Source§impl<Sd, Sx, D> Interp1DStrategyBuilder<Sd, Sx, D> for CubicSpline<Sd::Elem, D>
impl<Sd, Sx, D> Interp1DStrategyBuilder<Sd, Sx, D> for CubicSpline<Sd::Elem, D>
const MINIMUM_DATA_LENGHT: usize = 3usize
type FinishedStrat = CubicSplineStrategy<Sd, D>
Source§fn build<Sx2>(
self,
x: &ArrayBase<Sx2, Ix1>,
data: &ArrayBase<Sd, D>,
) -> Result<Self::FinishedStrat, BuilderError>
fn build<Sx2>( self, x: &ArrayBase<Sx2, Ix1>, data: &ArrayBase<Sd, D>, ) -> Result<Self::FinishedStrat, BuilderError>
initialize the strategy by validating data and
possibly calculating coefficients
This method is called in
Interp1DBuilder::build
Read moreAuto Trait Implementations§
impl<T, D> Freeze for CubicSpline<T, D>where
D: Freeze,
impl<T, D> RefUnwindSafe for CubicSpline<T, D>where
D: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, D> Send for CubicSpline<T, D>where
T: Send,
impl<T, D> Sync for CubicSpline<T, D>where
T: Sync,
impl<T, D> Unpin for CubicSpline<T, D>where
D: Unpin,
impl<T, D> UnwindSafe for CubicSpline<T, D>where
D: UnwindSafe,
T: RefUnwindSafe,
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