pub struct CubicSpline { /* private fields */ }Expand description
Natural cubic spline interpolation.
Constructs a smooth curve through data points using piecewise cubic polynomials with continuous first and second derivatives.
“Natural” means the second derivative is zero at the endpoints.
§Example
use convex_math::interpolation::{CubicSpline, Interpolator};
let xs = vec![0.0, 1.0, 2.0, 3.0];
let ys = vec![0.0, 1.0, 4.0, 9.0];
let spline = CubicSpline::new(xs, ys).unwrap();
let y = spline.interpolate(1.5).unwrap();Implementations§
Source§impl CubicSpline
impl CubicSpline
Sourcepub fn with_extrapolation(self) -> Self
pub fn with_extrapolation(self) -> Self
Enables extrapolation beyond the data range.
Trait Implementations§
Source§impl Clone for CubicSpline
impl Clone for CubicSpline
Source§fn clone(&self) -> CubicSpline
fn clone(&self) -> CubicSpline
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CubicSpline
impl Debug for CubicSpline
Source§impl Interpolator for CubicSpline
impl Interpolator for CubicSpline
Source§fn interpolate(&self, x: f64) -> MathResult<f64>
fn interpolate(&self, x: f64) -> MathResult<f64>
Returns the interpolated value at x.
Source§fn derivative(&self, x: f64) -> MathResult<f64>
fn derivative(&self, x: f64) -> MathResult<f64>
Returns the first derivative at x. Read more
Source§fn allows_extrapolation(&self) -> bool
fn allows_extrapolation(&self) -> bool
Returns true if extrapolation is allowed.
Auto Trait Implementations§
impl Freeze for CubicSpline
impl RefUnwindSafe for CubicSpline
impl Send for CubicSpline
impl Sync for CubicSpline
impl Unpin for CubicSpline
impl UnwindSafe for CubicSpline
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.