Struct net_ensembles::sampling::HistogramFast [−][src]
pub struct HistogramFast<T> { /* fields omitted */ }
Expand description
Faster version of HistogramInt for Integers
provided the bins should be: (left, left +1, …, right - 1) then you should use this version!
Implementations
impl<T> HistogramFast<T> where
T: CheckedSub + ToPrimitive + CheckedAdd + One + FromPrimitive + HasUnsignedVersion + PrimInt,
<T as HasUnsignedVersion>::Unsigned: Bounded,
<T as HasUnsignedVersion>::Unsigned: HasUnsignedVersion,
<T as HasUnsignedVersion>::Unsigned: WrappingAdd,
<T as HasUnsignedVersion>::Unsigned: ToPrimitive,
<T as HasUnsignedVersion>::Unsigned: Sub<<T as HasUnsignedVersion>::Unsigned>,
<<T as HasUnsignedVersion>::Unsigned as HasUnsignedVersion>::LeBytes == <T as HasUnsignedVersion>::LeBytes,
<<T as HasUnsignedVersion>::Unsigned as Sub<<T as HasUnsignedVersion>::Unsigned>>::Output == <T as HasUnsignedVersion>::Unsigned,
impl<T> HistogramFast<T> where
T: CheckedSub + ToPrimitive + CheckedAdd + One + FromPrimitive + HasUnsignedVersion + PrimInt,
<T as HasUnsignedVersion>::Unsigned: Bounded,
<T as HasUnsignedVersion>::Unsigned: HasUnsignedVersion,
<T as HasUnsignedVersion>::Unsigned: WrappingAdd,
<T as HasUnsignedVersion>::Unsigned: ToPrimitive,
<T as HasUnsignedVersion>::Unsigned: Sub<<T as HasUnsignedVersion>::Unsigned>,
<<T as HasUnsignedVersion>::Unsigned as HasUnsignedVersion>::LeBytes == <T as HasUnsignedVersion>::LeBytes,
<<T as HasUnsignedVersion>::Unsigned as Sub<<T as HasUnsignedVersion>::Unsigned>>::Output == <T as HasUnsignedVersion>::Unsigned,
Create a new interval
- same as
Self::new_inclusive(left, right - 1)
though with checks - That makes
left
an inclusive andright
an exclusive border
Create new histogram with inclusive borders
Err
ifleft > right
left
is inclusive borderright
is inclusive border
Trait Implementations
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<HistogramFast<T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<HistogramFast<T>, <__D as Deserializer<'de>>::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> HistogramCombine for HistogramFast<T> where
T: PartialOrd<T> + Copy + PrimInt + CheckedSub + ToPrimitive + CheckedAdd + One + FromPrimitive + HasUnsignedVersion,
<T as HasUnsignedVersion>::Unsigned: Bounded,
<T as HasUnsignedVersion>::Unsigned: HasUnsignedVersion,
<T as HasUnsignedVersion>::Unsigned: WrappingAdd,
<T as HasUnsignedVersion>::Unsigned: ToPrimitive,
<T as HasUnsignedVersion>::Unsigned: Sub<<T as HasUnsignedVersion>::Unsigned>,
HistogramFast<T>: HistogramVal<T>,
<<T as HasUnsignedVersion>::Unsigned as HasUnsignedVersion>::LeBytes == <T as HasUnsignedVersion>::LeBytes,
<<T as HasUnsignedVersion>::Unsigned as Sub<<T as HasUnsignedVersion>::Unsigned>>::Output == <T as HasUnsignedVersion>::Unsigned,
impl<T> HistogramCombine for HistogramFast<T> where
T: PartialOrd<T> + Copy + PrimInt + CheckedSub + ToPrimitive + CheckedAdd + One + FromPrimitive + HasUnsignedVersion,
<T as HasUnsignedVersion>::Unsigned: Bounded,
<T as HasUnsignedVersion>::Unsigned: HasUnsignedVersion,
<T as HasUnsignedVersion>::Unsigned: WrappingAdd,
<T as HasUnsignedVersion>::Unsigned: ToPrimitive,
<T as HasUnsignedVersion>::Unsigned: Sub<<T as HasUnsignedVersion>::Unsigned>,
HistogramFast<T>: HistogramVal<T>,
<<T as HasUnsignedVersion>::Unsigned as HasUnsignedVersion>::LeBytes == <T as HasUnsignedVersion>::LeBytes,
<<T as HasUnsignedVersion>::Unsigned as Sub<<T as HasUnsignedVersion>::Unsigned>>::Output == <T as HasUnsignedVersion>::Unsigned,
pub fn encapsulating_hist<S>(
hists: &[S]
) -> Result<HistogramFast<T>, HistErrors> where
S: Borrow<HistogramFast<T>>,
pub fn encapsulating_hist<S>(
hists: &[S]
) -> Result<HistogramFast<T>, HistErrors> where
S: Borrow<HistogramFast<T>>,
Create a histogram, which encapsulates the histograms passed Read more
pub fn align<S>(&self, right: S) -> Result<usize, HistErrors> where
S: Borrow<HistogramFast<T>>,
pub fn align<S>(&self, right: S) -> Result<usize, HistErrors> where
S: Borrow<HistogramFast<T>>,
Get bin difference between histograms Read more
impl<T> HistogramIntervalDistance<T> for HistogramFast<T> where
T: PartialOrd<T> + Sub<T, Output = T> + NumCast + Copy,
HistogramFast<T>: HistogramVal<T>,
impl<T> HistogramIntervalDistance<T> for HistogramFast<T> where
T: PartialOrd<T> + Sub<T, Output = T> + NumCast + Copy,
HistogramFast<T>: HistogramVal<T>,
pub fn interval_distance_overlap<V>(
&self,
val: V,
overlap: NonZeroUsize
) -> usize where
V: Borrow<T>,
pub fn interval_distance_overlap<V>(
&self,
val: V,
overlap: NonZeroUsize
) -> usize where
V: Borrow<T>,
Distance metric for how far a value is from a valid interval Read more
impl<T> HistogramPartition for HistogramFast<T> where
T: ToPrimitive + CheckedAdd + One + FromPrimitive + HasUnsignedVersion + Bounded + PrimInt + CheckedSub,
<T as HasUnsignedVersion>::Unsigned: Bounded,
<T as HasUnsignedVersion>::Unsigned: HasUnsignedVersion,
<T as HasUnsignedVersion>::Unsigned: WrappingAdd,
<T as HasUnsignedVersion>::Unsigned: ToPrimitive,
<T as HasUnsignedVersion>::Unsigned: Sub<<T as HasUnsignedVersion>::Unsigned>,
<T as HasUnsignedVersion>::Unsigned: FromPrimitive,
<T as HasUnsignedVersion>::Unsigned: WrappingSub,
<<T as HasUnsignedVersion>::Unsigned as HasUnsignedVersion>::LeBytes == <T as HasUnsignedVersion>::LeBytes,
<<T as HasUnsignedVersion>::Unsigned as HasUnsignedVersion>::Unsigned == <T as HasUnsignedVersion>::Unsigned,
<<T as HasUnsignedVersion>::Unsigned as Sub<<T as HasUnsignedVersion>::Unsigned>>::Output == <T as HasUnsignedVersion>::Unsigned,
impl<T> HistogramPartition for HistogramFast<T> where
T: ToPrimitive + CheckedAdd + One + FromPrimitive + HasUnsignedVersion + Bounded + PrimInt + CheckedSub,
<T as HasUnsignedVersion>::Unsigned: Bounded,
<T as HasUnsignedVersion>::Unsigned: HasUnsignedVersion,
<T as HasUnsignedVersion>::Unsigned: WrappingAdd,
<T as HasUnsignedVersion>::Unsigned: ToPrimitive,
<T as HasUnsignedVersion>::Unsigned: Sub<<T as HasUnsignedVersion>::Unsigned>,
<T as HasUnsignedVersion>::Unsigned: FromPrimitive,
<T as HasUnsignedVersion>::Unsigned: WrappingSub,
<<T as HasUnsignedVersion>::Unsigned as HasUnsignedVersion>::LeBytes == <T as HasUnsignedVersion>::LeBytes,
<<T as HasUnsignedVersion>::Unsigned as HasUnsignedVersion>::Unsigned == <T as HasUnsignedVersion>::Unsigned,
<<T as HasUnsignedVersion>::Unsigned as Sub<<T as HasUnsignedVersion>::Unsigned>>::Output == <T as HasUnsignedVersion>::Unsigned,
pub fn overlapping_partition(
&self,
n: usize,
overlap: usize
) -> Result<Vec<HistogramFast<T>, Global>, HistErrors>
pub fn overlapping_partition(
&self,
n: usize,
overlap: usize
) -> Result<Vec<HistogramFast<T>, Global>, HistErrors>
partition the interval Read more
impl<T> HistogramVal<T> for HistogramFast<T> where
T: PartialOrd<T> + CheckedSub + CheckedAdd + One + Saturating + NumCast + Copy,
RangeInclusive<T>: Iterator,
<RangeInclusive<T> as Iterator>::Item == T,
impl<T> HistogramVal<T> for HistogramFast<T> where
T: PartialOrd<T> + CheckedSub + CheckedAdd + One + Saturating + NumCast + Copy,
RangeInclusive<T>: Iterator,
<RangeInclusive<T> as Iterator>::Item == T,
Creates a vector containing borders (last border is exclusive)
- returns
Err(Overflow)
if right border isT::MAX
- creates and returns borders otherwise
- Note: even if
Err(Overflow)
is returned, this does not provide any problems for the rest of the implementation, as the border vector is not used internally forHistogramFast
get the left most border (inclusive)
let b = self.borders_clone().expect("overflow"); assert_eq!(self.second_last_border(), b[b.len()-2])
calculates some sort of absolute distance to the nearest valid bin Read more
convert val to the respective histogram index
does a value correspond to a valid bin?
opposite of is_inside
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for HistogramFast<T> where
T: RefUnwindSafe,
impl<T> Send for HistogramFast<T> where
T: Send,
impl<T> Sync for HistogramFast<T> where
T: Sync,
impl<T> Unpin for HistogramFast<T> where
T: Unpin,
impl<T> UnwindSafe for HistogramFast<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