pub struct Histogram {
pub bins: Vec<u64>,
pub lo: f64,
pub hi: f64,
}Expand description
Fixed-bin histogram over a f64 slice.
Values outside [lo, hi) are clamped into the boundary bins.
Mimics a GPU atomic histogram with one thread per element.
Fields§
§bins: Vec<u64>Bin counts.
lo: f64Lower bound of the first bin.
hi: f64Upper bound of the last bin (exclusive).
Implementations§
Source§impl Histogram
impl Histogram
Sourcepub fn compute(data: &[f64], lo: f64, hi: f64, n_bins: usize) -> Self
pub fn compute(data: &[f64], lo: f64, hi: f64, n_bins: usize) -> Self
Compute a histogram with n_bins bins over [lo, hi).
Panics if n_bins == 0 or lo >= hi.
Sourcepub fn bin_centre(&self, i: usize) -> f64
pub fn bin_centre(&self, i: usize) -> f64
Centre value of bin i.
Sourcepub fn approx_mean(&self) -> f64
pub fn approx_mean(&self) -> f64
Approximate mean computed from bin centres.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Histogram
impl RefUnwindSafe for Histogram
impl Send for Histogram
impl Sync for Histogram
impl Unpin for Histogram
impl UnsafeUnpin for Histogram
impl UnwindSafe for Histogram
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more