Struct sampling::histogram::HistogramInt [−][src]
pub struct HistogramInt<T> { /* fields omitted */ }
Expand description
Implementations
impl<T> HistogramInt<T> where
T: PartialOrd + ToPrimitive + FromPrimitive + CheckedAdd + One + HasUnsignedVersion + Bounded + Sub<T, Output = T> + Mul<T, Output = T> + Zero + Copy,
RangeInclusive<T>: Iterator<Item = T>,
T::Unsigned: Bounded + HasUnsignedVersion<LeBytes = T::LeBytes, Unsigned = T::Unsigned> + WrappingAdd + ToPrimitive + Sub<Output = T::Unsigned> + Rem<Output = T::Unsigned> + FromPrimitive + Zero + Eq + Div<Output = T::Unsigned> + Ord + Mul<Output = T::Unsigned> + WrappingSub + Copy,
RangeInclusive<T::Unsigned>: Iterator<Item = T::Unsigned>,
impl<T> HistogramInt<T> where
T: PartialOrd + ToPrimitive + FromPrimitive + CheckedAdd + One + HasUnsignedVersion + Bounded + Sub<T, Output = T> + Mul<T, Output = T> + Zero + Copy,
RangeInclusive<T>: Iterator<Item = T>,
T::Unsigned: Bounded + HasUnsignedVersion<LeBytes = T::LeBytes, Unsigned = T::Unsigned> + WrappingAdd + ToPrimitive + Sub<Output = T::Unsigned> + Rem<Output = T::Unsigned> + FromPrimitive + Zero + Eq + Div<Output = T::Unsigned> + Ord + Mul<Output = T::Unsigned> + WrappingSub + Copy,
RangeInclusive<T::Unsigned>: Iterator<Item = T::Unsigned>,
Create a new histogram
right
: exclusive borderleft
: inclusive borderbins
: how many bins do you need?
Note
(right - left) % bins == 0
has to be true, otherwise the bins cannot all have the same length!
Create a new histogram
- equivalent to
Self::new(left, right + 1, bins)
(except that this method checks for possible overflow)
Note:
- Due to implementation details,
right
cannot beT::MAX
- if you try, you will getErr(HistErrors::Overflow)
Trait Implementations
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
self.hist[index] += count
, Err()
if index
out of bounds
self.hist[index] += 1
, Err()
if index
out of bounds
check if any bin was not hit yet
impl<T> HistogramIntervalDistance<T> for HistogramInt<T> where
T: Ord + Sub<T, Output = T> + Add<T, Output = T> + One + NumCast + Copy,
impl<T> HistogramIntervalDistance<T> for HistogramInt<T> where
T: Ord + Sub<T, Output = T> + Add<T, Output = T> + One + NumCast + Copy,
Distance metric for how far a value is from a valid interval Read more
partition the interval Read more
impl<T> HistogramVal<T> for HistogramInt<T> where
T: Ord + Sub<T, Output = T> + Add<T, Output = T> + One + NumCast + Copy,
impl<T> HistogramVal<T> for HistogramInt<T> where
T: Ord + Sub<T, Output = T> + Add<T, Output = T> + One + NumCast + Copy,
None if not inside Hist covered zone
calculates some sort of absolute distance to the nearest valid bin Read more
get the left most border (inclusive)
let b = self.borders_clone().expect("overflow"); assert_eq!(self.second_last_border(), b[b.len()-2])
opposite of is_inside
binning borders Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for HistogramInt<T> where
T: RefUnwindSafe,
impl<T> Send for HistogramInt<T> where
T: Send,
impl<T> Sync for HistogramInt<T> where
T: Sync,
impl<T> Unpin for HistogramInt<T> where
T: Unpin,
impl<T> UnwindSafe for HistogramInt<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn cast_trunc(self) -> T
pub fn cast_trunc(self) -> T
Cast to integer, truncating Read more
pub fn cast_nearest(self) -> T
pub fn cast_nearest(self) -> T
Cast to the nearest integer Read more
pub fn cast_floor(self) -> T
pub fn cast_floor(self) -> T
Cast the floor to an integer Read more
pub fn try_cast_trunc(self) -> Result<T, Error>
pub fn try_cast_trunc(self) -> Result<T, Error>
Try converting to integer with truncation Read more
pub fn try_cast_nearest(self) -> Result<T, Error>
pub fn try_cast_nearest(self) -> Result<T, Error>
Try converting to the nearest integer Read more
pub fn try_cast_floor(self) -> Result<T, Error>
pub fn try_cast_floor(self) -> Result<T, Error>
Try converting the floor to an integer Read more
pub fn try_cast_ceil(self) -> Result<T, Error>
pub fn try_cast_ceil(self) -> Result<T, Error>
Try convert the ceiling to an integer Read more