[−][src]Struct bio::data_structures::interpolation_table::InterpolationTable
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 valuemax_x
- maximum sample valuefrac_digits
- number of fraction digits to store in samplefunc
- 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,
F: Sync,
impl<F> Unpin for InterpolationTable<F> where
F: Unpin,
F: Unpin,
impl<F> Send for InterpolationTable<F> where
F: Send,
F: Send,
impl<F> RefUnwindSafe for InterpolationTable<F> where
F: RefUnwindSafe,
F: RefUnwindSafe,
impl<F> UnwindSafe for InterpolationTable<F> where
F: UnwindSafe,
F: UnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,