pub struct BinLimits(_);
Expand description
Structure representing bin limits.
Implementations
sourceimpl BinLimits
impl BinLimits
sourcepub fn index(&self, value: f64) -> Option<usize>
pub fn index(&self, value: f64) -> Option<usize>
Returns the bin index for observable value
. If the value over- or underflows, the return
value is None
.
Panics
TODO
sourcepub fn limits(&self) -> Vec<f64>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub fn limits(&self) -> Vec<f64>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Returns the limits in a Vec
.
Examples
use pineappl::bin::BinLimits;
// example with equally sized bins
let equal_bins = BinLimits::new(vec![0.25, 0.5, 0.75, 1.0]);
assert_eq!(equal_bins.limits(), vec![0.25, 0.5, 0.75, 1.0]);
// example with unequally sized bins
let unequal_bins = BinLimits::new(vec![0.125, 0.25, 1.0, 1.5]);
assert_eq!(unequal_bins.limits(), vec![0.125, 0.25, 1.0, 1.5]);
sourcepub fn merge_bins(&mut self, range: Range<usize>) -> Result<(), MergeBinError>
pub fn merge_bins(&mut self, range: Range<usize>) -> Result<(), MergeBinError>
Merges the bins for the corresponding range together in a single one.
Errors
When bins
contains any indices that do not correspond to bins this method returns an
error.
sourcepub fn bin_sizes(&self) -> Vec<f64>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub fn bin_sizes(&self) -> Vec<f64>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Returns the size for each bin.
Examples
use pineappl::bin::BinLimits;
// example with equally sized bins
let equal_bins = BinLimits::new(vec![0.25, 0.5, 0.75, 1.0]);
assert_eq!(equal_bins.bin_sizes(), vec![0.25, 0.25, 0.25]);
// example with unequally sized bins
let unequal_bins = BinLimits::new(vec![0.125, 0.25, 1.0, 1.5]);
assert_eq!(unequal_bins.bin_sizes(), vec![0.125, 0.75, 0.5]);
sourcepub fn delete_bins_left(&mut self, bins: usize)
pub fn delete_bins_left(&mut self, bins: usize)
Delete bins
number of bins from the start.
sourcepub fn delete_bins_right(&mut self, bins: usize)
pub fn delete_bins_right(&mut self, bins: usize)
Delete bins
number of bins from the end.
Trait Implementations
sourceimpl<'de> Deserialize<'de> for BinLimits
impl<'de> Deserialize<'de> for BinLimits
sourcefn 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
impl StructuralPartialEq for BinLimits
Auto Trait Implementations
impl RefUnwindSafe for BinLimits
impl Send for BinLimits
impl Sync for BinLimits
impl Unpin for BinLimits
impl UnwindSafe for BinLimits
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