[−][src]Struct pineappl::bin::BinLimits
Structure representing bin limits.
Implementations
impl BinLimits
[src]
#[must_use]pub fn new(limits: Vec<f64>) -> Self
[src]
Constructor for BinLimits
.
#[must_use]pub fn bins(&self) -> usize
[src]
Returns the number of bins.
#[must_use]pub fn index(&self, value: f64) -> Option<usize>
[src]
Returns the bin index for observable value
. If the value over- or underflows, the return
value is None
.
#[must_use]pub fn left(&self) -> f64
[src]
Returns the left-most bin limit
#[must_use]pub fn limits(&self) -> Vec<f64>
[src]
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]);
#[must_use]pub fn bin_sizes(&self) -> Vec<f64>
[src]
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]);
pub fn merge(&mut self, other: &Self) -> Result<(), MergeBinError>
[src]
Merge the limits of other
into self
on the right-hand-side. If both limits are
non-consecutive, an error is returned.
Errors
If the right-most limit of self
is different from the left-most limit of other
, the
bins are non-consecutive and an error is returned.
#[must_use]pub fn right(&self) -> f64
[src]
Returns the right-most bin limit
Trait Implementations
impl<'de> Deserialize<'de> for BinLimits
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl PartialEq<BinLimits> for BinLimits
[src]
impl Serialize for BinLimits
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralPartialEq for BinLimits
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,