pub struct CubicSpline;
Expand description

The CubicSpline 1d interpolation Strategy

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)
    .x(x)
    .build().unwrap();

let result = interpolator.interp_array(&query).unwrap();
let expect = array![
    0.5,
    0.2109053497942387,
    0.020576131687242816,
    0.01851851851851849,
    0.21364883401920443,
    0.5733882030178327,
    1.0648148148148144,
    1.6550068587105617,
    2.3110425240054866,
    3.0
];

Trait Implementations§

source§

impl Debug for CubicSpline

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<Sd, Sx, D> StrategyBuilder<Sd, Sx, D> for CubicSplinewhere Sd: Data, Sd::Elem: Debug + Num + Copy + PartialOrd + Sub + SubAssign + NumCast + Add + Pow<Sd::Elem, Output = Sd::Elem> + ScalarOperand, Sx: Data<Elem = Sd::Elem>, D: Dimension + RemoveAxis,

source§

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>where Sx2: Data<Elem = Sd::Elem>,

initialize the strategy by validating data and possibly calculating coefficients This method is called by Interp1DBuilder::build Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.