pub struct Distribution { /* private fields */ }Expand description
The values a sample of runs gave, sorted, and how many runs were tried. It serializes as
those two, and reads back through Distribution::new’s checks.
Implementations§
Source§impl Distribution
impl Distribution
Sourcepub fn new(values: Vec<f64>, attempted: usize) -> Result<Self, AnalysisError>
pub fn new(values: Vec<f64>, attempted: usize) -> Result<Self, AnalysisError>
The distribution of values, from attempted runs (those that gave no value make up the
difference).
§Errors
AnalysisError::Domainfor a value that isn’t finite.AnalysisError::Countfor more values than runs.
Sourcepub fn missing(&self) -> usize
pub fn missing(&self) -> usize
The runs that gave no value: failed, or without the quantity asked for.
Sourcepub fn mean(&self) -> Option<f64>
pub fn mean(&self) -> Option<f64>
The mean, x₀ + Σ(xᵢ − x₀)/n with x₀ the smallest value; None with no values.
Sourcepub fn standard_deviation(&self) -> Option<f64>
pub fn standard_deviation(&self) -> Option<f64>
The sample standard deviation, √(Σ(dᵢ − d̄)²/(n − 1)) with dᵢ = xᵢ − x₀; None with
fewer than two values.
Sourcepub fn quantile(&self, p: f64) -> Result<Option<f64>, AnalysisError>
pub fn quantile(&self, p: f64) -> Result<Option<f64>, AnalysisError>
The p quantile by Hyndman and Fan’s definition 7 (the module’s docs); None with no
values.
§Errors
AnalysisError::Domain for p outside [0, 1].
Bounds on the share of the runs tried whose value is at least threshold (Share);
None with no runs tried, when there is no share to bound. An infinite threshold is
allowed.
§Errors
AnalysisError::Domain for a threshold that is not a number.
Trait Implementations§
Source§impl Clone for Distribution
impl Clone for Distribution
Source§fn clone(&self) -> Distribution
fn clone(&self) -> Distribution
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Distribution
impl Debug for Distribution
Source§impl<'de> Deserialize<'de> for Distribution
impl<'de> Deserialize<'de> for Distribution
Source§fn 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>,
Source§impl PartialEq for Distribution
impl PartialEq for Distribution
Source§fn eq(&self, other: &Distribution) -> bool
fn eq(&self, other: &Distribution) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for Distribution
impl Serialize for Distribution
impl StructuralPartialEq for Distribution
Auto Trait Implementations§
impl Freeze for Distribution
impl RefUnwindSafe for Distribution
impl Send for Distribution
impl Sync for Distribution
impl Unpin for Distribution
impl UnsafeUnpin for Distribution
impl UnwindSafe for Distribution
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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>
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>
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