[][src]Struct bio::data_structures::interpolation_table::InterpolationTable

pub struct InterpolationTable<F: Fn(f64) -> f64> { /* fields omitted */ }

Fast lookup table for arbitrary floating point functions. This can be used to e.g., provide fast lookups of distribution values. Input values are sampled with a given precision and results are stored in a vector. During lookup, infimum and supremum of a given value are calculated and the result is interpolated.

Methods

impl<F: Fn(f64) -> f64> InterpolationTable<F>[src]

pub fn new(min_x: f64, max_x: f64, frac_digits: i32, func: F) -> Self[src]

Create a new InterpolationTable.

Arguments

  • min_x - minimum sample value
  • max_x - maximum sample value
  • frac_digits - number of fraction digits to store in sample
  • func - Function to emulate.

If given value is outside of min_x and max_x, the lookup falls back to applying the function itself. The table size grows with the number of fraction digits.

pub fn get(&self, x: f64) -> f64[src]

Lookup given value in table, and interpolate the result between the sampled values if necessary. This provides an approximation that is better the more fraction digits are used to generate this table.

Auto Trait Implementations

impl<F> Sync for InterpolationTable<F> where
    F: Sync

impl<F> Unpin for InterpolationTable<F> where
    F: Unpin

impl<F> Send for InterpolationTable<F> where
    F: Send

impl<F> UnwindSafe for InterpolationTable<F> where
    F: UnwindSafe

impl<F> RefUnwindSafe for InterpolationTable<F> where
    F: RefUnwindSafe

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]