Expand description
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.
Implementations
sourceimpl<F: Fn(f64) -> f64> InterpolationTable<F>
impl<F: Fn(f64) -> f64> InterpolationTable<F>
sourcepub fn new(min_x: f64, max_x: f64, frac_digits: i32, func: F) -> Self
pub fn new(min_x: f64, max_x: f64, frac_digits: i32, func: F) -> Self
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.
Auto Trait Implementations
impl<F> RefUnwindSafe for InterpolationTable<F>where
F: RefUnwindSafe,
impl<F> Send for InterpolationTable<F>where
F: Send,
impl<F> Sync for InterpolationTable<F>where
F: Sync,
impl<F> Unpin for InterpolationTable<F>where
F: Unpin,
impl<F> UnwindSafe for InterpolationTable<F>where
F: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more