#[non_exhaustive]pub enum Distribution {
Uniform {
lo: f64,
hi: f64,
},
Normal {
mu: f64,
sigma: f64,
},
LogNormal {
mu_log: f64,
sigma_log: f64,
},
Triangular {
lo: f64,
mode: f64,
hi: f64,
},
Beta {
alpha: f64,
beta: f64,
lo: f64,
hi: f64,
},
Gamma {
shape: f64,
scale: f64,
},
Weibull {
shape: f64,
scale: f64,
},
Exponential {
lambda: f64,
},
Bernoulli {
p: f64,
},
DiscreteUniform {
lo: i64,
hi: i64,
},
}Expand description
Factor distributions saltelli supports. Closed enum,
#[non_exhaustive]. Future variants (Truncated, Empirical,
Categorical, …) land non-breaking via follow-on ADRs.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Uniform
Uniform on [lo, hi]. Closed-form quantile.
Normal
Normal N(mu, sigma²). statrs::Normal::inverse_cdf.
LogNormal
Log-normal — exp(N(mu_log, sigma_log²)).
statrs::LogNormal::inverse_cdf.
Triangular
Triangular on [lo, hi] with mode mode. Closed-form
quantile (piecewise sqrt).
Beta
Beta on [lo, hi] with shape parameters alpha, beta.
statrs::Beta::inverse_cdf then affine-mapped to [lo, hi].
Gamma
Gamma with shape shape and scale scale (so mean =
shape × scale). statrs::Gamma parameterizes by rate, so
we pass 1/scale. Closed-form for shape = 1 collapses to
Exponential { lambda: 1/scale }.
Weibull
Weibull with shape shape, scale scale. Closed-form
quantile: scale * (-ln(1 - u))^(1/shape).
Exponential
Exponential with rate lambda. Closed-form quantile:
-ln(1 - u) / lambda.
Bernoulli
Bernoulli with success probability p. Quantile: 0 if
u < 1 - p, else 1.
DiscreteUniform
Discrete uniform on the inclusive integer range [lo, hi].
Implementations§
Source§impl Distribution
impl Distribution
Sourcepub fn quantile(&self, u: f64) -> f64
pub fn quantile(&self, u: f64) -> f64
Inverse CDF. u ∈ [0, 1] (saturated; out-of-range inputs
clamp to the support boundary). Pure function of
(parameters, u).
§Panics
On invalid distribution parameters (sigma ≤ 0, alpha ≤ 0,
Beta with lo ≥ hi, etc.). Problem construction validates
parameters at build time so this never fires for a Problem
produced by ProblemBuilder::build.
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,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.