Skip to main content

Extrapolate

Trait Extrapolate 

Source
pub trait Extrapolate {
    // Required methods
    fn domain(&self) -> (f64, f64);
    fn value_at(&self, x: f64) -> f64;

    // Provided method
    fn extrapolate(&self, x: f64, mode: &ExtrapolationBehavior) -> f64 { ... }
}
Expand description

Composable extrapolation for 1-D interpolators.

Implementors must provide:

  • domain — the closed interval [x_min, x_max].
  • value_at — interior evaluation (assumed valid only within the domain; behaviour outside is undefined).

The provided default extrapolate method dispatches to the five modes in ExtrapolationBehavior.

Required Methods§

Source

fn domain(&self) -> (f64, f64)

Returns (x_min, x_max) — the closed interpolation domain.

Source

fn value_at(&self, x: f64) -> f64

Evaluate the interpolant at x.

Callers within this crate guarantee x_min <= x <= x_max.

Provided Methods§

Source

fn extrapolate(&self, x: f64, mode: &ExtrapolationBehavior) -> f64

Evaluate at x, applying mode for out-of-domain queries.

If x is inside the domain the function falls through to value_at.

Implementors§