Skip to main content

InterpolationTrait

Trait InterpolationTrait 

Source
pub trait InterpolationTrait<'a>: Sized {
    // Required methods
    fn get_x_values(&self) -> VR1D<'a>;
    fn set_x_values(&mut self, x: VR1D<'a>);
    fn get_y_values(&self) -> VR1D<'a>;
    fn set_y_values(&mut self, y: VR1D<'a>);
    fn get_cached_location(&self) -> Option<usize>;
    fn set_cached_location(&mut self, x: usize);
    fn raw_interpolate(&mut self, jlo: usize, x: f64) -> Result<f64, ErrorsJSL>;

    // Provided methods
    fn x_range_is_ascending(&self) -> bool { ... }
    fn verify_sizes(&mut self, limit: usize) -> Result<(), ErrorsJSL> { ... }
    fn locate(&mut self, x: f64) -> Result<usize, ErrorsJSL> { ... }
    fn interpolate_at(&mut self, x: f64) -> Result<f64, ErrorsJSL> { ... }
}

Required Methods§

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, jlo: usize, x: f64) -> Result<f64, ErrorsJSL>

This is where the interpolation gets computed based on the method

Provided Methods§

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

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§