Skip to main content

Linear

Struct Linear 

Source
pub struct Linear<S: Scalar> { /* private fields */ }
Expand description

Piecewise linear interpolant.

Implementations§

Source§

impl<S: Scalar> Linear<S>

Source

pub fn new(x: &[S], y: &[S]) -> Result<Self, InterpError>

Create a linear interpolant from data points.

§Errors

Returns error if fewer than 2 points or data is not sorted.

Trait Implementations§

Source§

impl<S: Scalar> Interpolant<S> for Linear<S>

Source§

fn interpolate(&self, x: S) -> S

Evaluate the interpolant at x. Extrapolates using the first/last segment if x is outside the data range.
Source§

fn derivative(&self, x: S) -> Option<S>

First derivative at x, if available.
Source§

fn integrate(&self, a: S, b: S) -> Option<S>

Definite integral from a to b, if available.
Source§

fn interpolate_vec(&self, xs: &[S]) -> Vec<S>

Evaluate at multiple points.

Auto Trait Implementations§

§

impl<S> Freeze for Linear<S>

§

impl<S> RefUnwindSafe for Linear<S>
where S: RefUnwindSafe,

§

impl<S> Send for Linear<S>

§

impl<S> Sync for Linear<S>

§

impl<S> Unpin for Linear<S>
where S: Unpin,

§

impl<S> UnsafeUnpin for Linear<S>

§

impl<S> UnwindSafe for Linear<S>
where S: UnwindSafe,

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 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.