Skip to main content

PiecewiseHermite

Struct PiecewiseHermite 

Source
pub struct PiecewiseHermite<'a> { /* private fields */ }
Expand description

A piecewise cubic Hermite interpolant: on each interval the cubic is fixed by the end values and the end slopes. The slope-selection rule (PCHIP, Akima, Catmull-Rom, …) lives in the constructors of the respective modules.

Outside the data range the end cubic pieces are extended.

Implementations§

Source§

impl<'a> PiecewiseHermite<'a>

Source

pub fn from_slopes( x_values: VR1D<'a>, y_values: VR1D<'a>, slopes: R1D, ) -> Result<Self, ErrorsJSL>

Builds the interpolant from explicit node slopes m[i] = f'(x[i]).

Source

pub fn slopes(&self) -> &R1D

The node slopes in use.

Source

pub fn to_ppoly(&self) -> PPoly

The same interpolant as a PPoly, with derivatives, integrals and roots (SciPy’s PchipInterpolator and Akima1DInterpolator are PPolys).

Trait Implementations§

Source§

impl<'a> Debug for PiecewiseHermite<'a>

Source§

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

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

impl<'a> InterpolationTrait<'a> for PiecewiseHermite<'a>

Source§

fn get_x_values(&self) -> VR1D<'a>

Setters and getters for required fields
Source§

fn set_x_values(&mut self, x: VR1D<'a>)

Source§

fn get_y_values(&self) -> VR1D<'a>

Source§

fn set_y_values(&mut self, y: VR1D<'a>)

Source§

fn get_cached_location(&self) -> Option<usize>

Source§

fn set_cached_location(&mut self, x: usize)

Source§

fn raw_interpolate(&mut self, j: usize, x: f64) -> Result<f64, ErrorsJSL>

This is where the interpolation gets computed based on the method
Source§

fn x_range_is_ascending(&self) -> bool

Check if x range is ascending
Source§

fn verify_sizes(&mut self, limit: usize) -> Result<(), ErrorsJSL>

Thie function checks to make sure x and y are the same length and greater than 2
Source§

fn locate(&mut self, x: f64) -> Result<usize, ErrorsJSL>

Finds the index immediately before x, optionally relying on the cache of the previous value The location will not exceed N-2 so it always indicates to two valid sequential indexes, even if at the end
Source§

fn interpolate_at(&mut self, x: f64) -> Result<f64, ErrorsJSL>

Top level wrapper for evaluation

Auto Trait Implementations§

§

impl<'a> Freeze for PiecewiseHermite<'a>

§

impl<'a> RefUnwindSafe for PiecewiseHermite<'a>

§

impl<'a> Send for PiecewiseHermite<'a>

§

impl<'a> Sync for PiecewiseHermite<'a>

§

impl<'a> Unpin for PiecewiseHermite<'a>

§

impl<'a> UnsafeUnpin for PiecewiseHermite<'a>

§

impl<'a> UnwindSafe for PiecewiseHermite<'a>

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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> MaybeSerialize for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.