pub trait AtomicHistogramVal<T> {
    // Required methods
    fn get_bin_index<V: Borrow<T>>(&self, val: V) -> Result<usize, HistErrors>;
    fn count_val<V: Borrow<T>>(&self, val: V) -> Result<usize, HistErrors>;
    fn borders_clone(&self) -> Result<Vec<T>, HistErrors>;
    fn is_inside<V: Borrow<T>>(&self, val: V) -> bool;
    fn not_inside<V: Borrow<T>>(&self, val: V) -> bool;
    fn first_border(&self) -> T;
    fn last_border(&self) -> T;
    fn distance<V: Borrow<T>>(&self, val: V) -> f64;
}
Expand description
  • trait used for mapping values of arbitrary type T to bins
  • used to create a histogram

Required Methods§

source

fn get_bin_index<V: Borrow<T>>(&self, val: V) -> Result<usize, HistErrors>

convert val to the respective histogram index

source

fn count_val<V: Borrow<T>>(&self, val: V) -> Result<usize, HistErrors>

count val. Ok(index), if inside of hist, Err(_) if val is invalid

source

fn borders_clone(&self) -> Result<Vec<T>, HistErrors>

binning borders
  • the borders used to bin the values
  • any val which fullfills self.border[i] <= val < self.border[i + 1] will get index i.
  • Note that the last border is exclusive
source

fn is_inside<V: Borrow<T>>(&self, val: V) -> bool

does a value correspond to a valid bin?

source

fn not_inside<V: Borrow<T>>(&self, val: V) -> bool

opposite of is_inside

source

fn first_border(&self) -> T

get the left most border (inclusive)

source

fn last_border(&self) -> T

Get border on the right
  • Note: This border might be inclusive or exclusive
source

fn distance<V: Borrow<T>>(&self, val: V) -> f64

calculates some sort of absolute distance to the nearest valid bin
  • any invalid numbers (like NAN or INFINITY) should have the highest distance possible
  • if a value corresponds to a valid bin, the distance should be zero

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<B, T> AtomicHistogramVal<T> for GenericAtomicHist<B, T>
where B: Binning<T>,

source§

impl<T> AtomicHistogramVal<T> for AtomicHistogramFloat<T>
where T: Float + Zero + NumCast,

source§

impl<T> AtomicHistogramVal<T> for AtomicHistogramInt<T>
where T: Ord + Sub<T, Output = T> + Add<T, Output = T> + One + NumCast + Copy,