Small improvements to Histogram docs
This commit is contained in:
parent
7f8663c23e
commit
ef41836ec5
@ -23,7 +23,9 @@ macro_rules! define_histogram {
|
|||||||
/// A histogram with a number of bins known at compile time.
|
/// A histogram with a number of bins known at compile time.
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct $name {
|
pub struct $name {
|
||||||
|
/// The ranges defining the bins of the histogram.
|
||||||
range: [f64; LEN + 1],
|
range: [f64; LEN + 1],
|
||||||
|
/// The bins of the histogram.
|
||||||
bin: [u64; LEN],
|
bin: [u64; LEN],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
10
src/lib.rs
10
src/lib.rs
@ -14,7 +14,7 @@
|
|||||||
//! Everything is calculated iteratively in a single pass using constant memory,
|
//! Everything is calculated iteratively in a single pass using constant memory,
|
||||||
//! so the sequence of numbers can be an iterator. The used algorithms try to
|
//! so the sequence of numbers can be an iterator. The used algorithms try to
|
||||||
//! avoid numerical instabilities.
|
//! avoid numerical instabilities.
|
||||||
//!
|
//!
|
||||||
//! If you want [Serde](https://github.com/serde-rs/serde) support,
|
//! If you want [Serde](https://github.com/serde-rs/serde) support,
|
||||||
//! include `"serde"` in your list of features.
|
//! include `"serde"` in your list of features.
|
||||||
//!
|
//!
|
||||||
@ -45,6 +45,7 @@
|
|||||||
//! * Quantiles ([`Quantile`]).
|
//! * Quantiles ([`Quantile`]).
|
||||||
//! * Minimum ([`Min`]) and maximum ([`Max`]).
|
//! * Minimum ([`Min`]) and maximum ([`Max`]).
|
||||||
//!
|
//!
|
||||||
|
//!
|
||||||
//! ## Estimating several statistics at once
|
//! ## Estimating several statistics at once
|
||||||
//!
|
//!
|
||||||
//! The estimators are designed to have minimal state. The recommended way to
|
//! The estimators are designed to have minimal state. The recommended way to
|
||||||
@ -59,6 +60,12 @@
|
|||||||
//! only need to include the highest moment in your struct.
|
//! only need to include the highest moment in your struct.
|
||||||
//!
|
//!
|
||||||
//!
|
//!
|
||||||
|
//! ## Calculating histograms
|
||||||
|
//!
|
||||||
|
//! The [`define_histogram`] macro can be used to define a histogram struct that
|
||||||
|
//! uses constant memory.
|
||||||
|
//!
|
||||||
|
//!
|
||||||
//! [`Mean`]: ./struct.Mean.html
|
//! [`Mean`]: ./struct.Mean.html
|
||||||
//! [`MeanWithError`]: ./type.MeanWithError.html
|
//! [`MeanWithError`]: ./type.MeanWithError.html
|
||||||
//! [`WeightedMean`]: ./struct.WeightedMean.html
|
//! [`WeightedMean`]: ./struct.WeightedMean.html
|
||||||
@ -70,6 +77,7 @@
|
|||||||
//! [`Min`]: ./struct.Min.html
|
//! [`Min`]: ./struct.Min.html
|
||||||
//! [`Max`]: ./struct.Max.html
|
//! [`Max`]: ./struct.Max.html
|
||||||
//! [`concatenate`]: ./macro.concatenate.html
|
//! [`concatenate`]: ./macro.concatenate.html
|
||||||
|
//! [`define_histogram`]: ./macro.define_histogram.html
|
||||||
|
|
||||||
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp))]
|
#![cfg_attr(feature = "cargo-clippy", allow(float_cmp))]
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ pub trait Histogram:
|
|||||||
|
|
||||||
/// Return an iterator over the bin variances.
|
/// Return an iterator over the bin variances.
|
||||||
///
|
///
|
||||||
/// This is more efficient than using `variance()` each bin.
|
/// This is more efficient than calling `variance()` for each bin.
|
||||||
#[inline]
|
#[inline]
|
||||||
fn variances(&self) -> IterVariances<<&Self as IntoIterator>::IntoIter> {
|
fn variances(&self) -> IterVariances<<&Self as IntoIterator>::IntoIter> {
|
||||||
let sum: u64 = self.bins().iter().sum();
|
let sum: u64 = self.bins().iter().sum();
|
||||||
|
Loading…
Reference in New Issue
Block a user