pub type BinningI16 = BinningWithWidth<i16>;
Expand description
Efficient binning for i16
with arbitrary width
Aliased Type§
struct BinningI16 { /* private fields */ }
Implementations§
Source§impl BinningI16
impl BinningI16
Sourcepub fn new_inclusive(
start: i16,
end_inclusive: i16,
bin_width: i16,
) -> Result<Self, <i16 as HasUnsignedVersion>::Unsigned>
pub fn new_inclusive( start: i16, end_inclusive: i16, bin_width: i16, ) -> Result<Self, <i16 as HasUnsignedVersion>::Unsigned>
Sourcepub const fn range_inclusive(&self) -> RangeInclusive<i16>
pub const fn range_inclusive(&self) -> RangeInclusive<i16>
§Returns the range covered by the bins as a RangeInclusive<i16>
Sourcepub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<i16>>
pub fn native_bin_iter(&self) -> impl Iterator<Item = RangeInclusive<i16>>
Sourcepub fn bins_m1(&self) -> <i16 as HasUnsignedVersion>::Unsigned
pub fn bins_m1(&self) -> <i16 as HasUnsignedVersion>::Unsigned
§The amount of bins -1
- minus 1 because if the bins are of width 1 and are going over the entire range of the type, then we cannot represent the number of bins as this type
§Example
If we look at an u8 and the range from 0 to 255, then this is 256 bins, which cannot be represented as u8. To combat this, I return bins - 1. This works, because we always have at least 1 bin
Sourcepub fn get_bin_index_native<V: Borrow<i16>>(
&self,
val: V,
) -> Option<<i16 as HasUnsignedVersion>::Unsigned>
pub fn get_bin_index_native<V: Borrow<i16>>( &self, val: V, ) -> Option<<i16 as HasUnsignedVersion>::Unsigned>
§Get the respective bin in native unsigned
Trait Implementations§
Source§impl Binning<i16> for BinningI16
impl Binning<i16> for BinningI16
Source§fn get_bin_index<V: Borrow<i16>>(&self, val: V) -> Option<usize>
fn get_bin_index<V: Borrow<i16>>(&self, val: V) -> Option<usize>
§Get the respective bin index
- Note: Obviously this breaks when the bin index cannot be represented as
usize
Source§fn not_inside<V: Borrow<i16>>(&self, val: V) -> bool
fn not_inside<V: Borrow<i16>>(&self, val: V) -> bool
§Opposite of is_inside
- I could also have called this
is_outside
, but I didn’t
Source§fn first_border(&self) -> i16
fn first_border(&self) -> i16
get the left most border (inclusive)
Source§fn distance<V: Borrow<i16>>(&self, v: V) -> f64
fn distance<V: Borrow<i16>>(&self, v: V) -> f64
§calculates some sort of absolute distance to the nearest valid bin
- if a value corresponds to a valid bin, the distance is zero
Source§fn bin_iter(&self) -> Box<dyn Iterator<Item = Bin<i16>>>
fn bin_iter(&self) -> Box<dyn Iterator<Item = Bin<i16>>>
§Iterates over all bins
- Note: This implementation uses a more efficient representations of the bins underneath, but is capable of returning the bins in this representation on request
- Note also that this
Binning
implements another method for the bin borders, i.e.,native_bin_iter
. Consider using that instead, as it is more efficient
Source§fn get_bin_len(&self) -> usize
fn get_bin_len(&self) -> usize
Get the number of underlying bins Read more
Source§fn last_border(&self) -> i16
fn last_border(&self) -> i16
If the last border is inclusive, this returns the largest value that is still inside the binning.If the last border is exclusive, this is the first value which is not inside the binning. Read more
Source§fn last_border_is_inclusive(&self) -> bool
fn last_border_is_inclusive(&self) -> bool
True if last border is inclusive, false otherwise Read more
Source§fn to_generic_hist(self) -> GenericHist<Self, T>where
Self: Sized,
fn to_generic_hist(self) -> GenericHist<Self, T>where
Self: Sized,
Convert binning into GenericHist Read more
Source§fn to_generic_atomic_hist(self) -> AtomicGenericHist<Self, T>where
Self: Sized,
fn to_generic_atomic_hist(self) -> AtomicGenericHist<Self, T>where
Self: Sized,
Convert binning into a AtomicGenericHist Read more