pub struct GammaDistribution { /* private fields */ }Expand description
Gamma distribution with shape α and rate β (or equivalently scale θ = 1/β).
Uses the (shape, rate) parametrization: X ~ Gamma(α, β).
f(x) = β^α / Γ(α) · x^(α−1) · exp(−βx) for x > 0
§Examples
use u_numflow::distributions::GammaDistribution;
let g = GammaDistribution::new(2.0, 1.0).unwrap();
assert!((g.mean() - 2.0).abs() < 1e-10);
assert!((g.variance() - 2.0).abs() < 1e-10);§Reference
Johnson, N.L., Kotz, S. & Balakrishnan, N. (1994). Continuous Univariate Distributions, Vol. 1, 2nd ed. Wiley.
Implementations§
Source§impl GammaDistribution
impl GammaDistribution
Sourcepub fn new(shape: f64, rate: f64) -> Result<Self, DistributionError>
pub fn new(shape: f64, rate: f64) -> Result<Self, DistributionError>
Creates a Gamma(α, β) distribution with shape α and rate β.
Returns an error if α ≤ 0, β ≤ 0, or either is not finite.
Sourcepub fn from_shape_scale(
shape: f64,
scale: f64,
) -> Result<Self, DistributionError>
pub fn from_shape_scale( shape: f64, scale: f64, ) -> Result<Self, DistributionError>
Creates a Gamma distribution from shape and scale θ = 1/β.
Trait Implementations§
Source§impl Clone for GammaDistribution
impl Clone for GammaDistribution
Source§fn clone(&self) -> GammaDistribution
fn clone(&self) -> GammaDistribution
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GammaDistribution
impl Debug for GammaDistribution
impl Copy for GammaDistribution
Auto Trait Implementations§
impl Freeze for GammaDistribution
impl RefUnwindSafe for GammaDistribution
impl Send for GammaDistribution
impl Sync for GammaDistribution
impl Unpin for GammaDistribution
impl UnwindSafe for GammaDistribution
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