[][src]Struct rv::dist::LogNormal

pub struct LogNormal { /* fields omitted */ }

LogNormal Distribution If x ~ Normal(μ, σ), then e^x ~ LogNormal(μ, σ).

Implementations

impl LogNormal[src]

pub fn new(mu: f64, sigma: f64) -> Result<Self, LogNormalError>[src]

Create a new LogNormal distribution

Arguments

  • mu: log scale mean
  • sigma: log scale standard deviation

pub fn new_unchecked(mu: f64, sigma: f64) -> Self[src]

Creates a new LogNormal without checking whether the parameters are valid.

pub fn standard() -> Self[src]

LogNorma(0, 1)

Example

let lognormal = LogNormal::standard();
assert_eq!(lognormal, LogNormal::new(0.0, 1.0).unwrap());

pub fn mu(&self) -> f64[src]

Get the mu parameter

Example

let lognormal = LogNormal::new(-1.0, 2.0).unwrap();
assert_eq!(lognormal.mu(), -1.0);

pub fn set_mu(&mut self, mu: f64) -> Result<(), LogNormalError>[src]

Set the value of mu

Example

let mut lognormal = LogNormal::new(2.0, 1.5).unwrap();
assert_eq!(lognormal.mu(), 2.0);

lognormal.set_mu(1.3).unwrap();
assert_eq!(lognormal.mu(), 1.3);

Will error for invalid values

assert!(lognormal.set_mu(1.3).is_ok());
assert!(lognormal.set_mu(std::f64::NEG_INFINITY).is_err());
assert!(lognormal.set_mu(std::f64::INFINITY).is_err());
assert!(lognormal.set_mu(std::f64::NAN).is_err());

pub fn set_mu_unchecked(&mut self, mu: f64)[src]

Set the value of mu without input validation

pub fn sigma(&self) -> f64[src]

Get the sigma parameter

Example

let lognormal = LogNormal::new(-1.0, 2.0).unwrap();
assert_eq!(lognormal.sigma(), 2.0);

pub fn set_sigma(&mut self, sigma: f64) -> Result<(), LogNormalError>[src]

Set the value of sigma

Example

let mut lognormal = LogNormal::standard();
assert_eq!(lognormal.sigma(), 1.0);

lognormal.set_sigma(2.3).unwrap();
assert_eq!(lognormal.sigma(), 2.3);

Will error for invalid values

assert!(lognormal.set_sigma(2.3).is_ok());
assert!(lognormal.set_sigma(0.0).is_err());
assert!(lognormal.set_sigma(-1.0).is_err());
assert!(lognormal.set_sigma(std::f64::INFINITY).is_err());
assert!(lognormal.set_sigma(std::f64::NEG_INFINITY).is_err());
assert!(lognormal.set_sigma(std::f64::NAN).is_err());

pub fn set_sigma_unchecked(&mut self, sigma: f64)[src]

Set the value of sigma

Trait Implementations

impl Cdf<f32> for LogNormal[src]

impl Cdf<f64> for LogNormal[src]

impl Clone for LogNormal[src]

impl ContinuousDistr<f32> for LogNormal[src]

impl ContinuousDistr<f64> for LogNormal[src]

impl Debug for LogNormal[src]

impl Default for LogNormal[src]

impl Display for LogNormal[src]

impl Entropy for LogNormal[src]

impl<'_> From<&'_ LogNormal> for String[src]

impl InverseCdf<f32> for LogNormal[src]

impl InverseCdf<f64> for LogNormal[src]

impl Kurtosis for LogNormal[src]

impl Mean<f32> for LogNormal[src]

impl Mean<f64> for LogNormal[src]

impl Median<f32> for LogNormal[src]

impl Median<f64> for LogNormal[src]

impl Mode<f32> for LogNormal[src]

impl Mode<f64> for LogNormal[src]

impl PartialEq<LogNormal> for LogNormal[src]

impl Rv<f32> for LogNormal[src]

impl Rv<f64> for LogNormal[src]

impl Skewness for LogNormal[src]

impl StructuralPartialEq for LogNormal[src]

impl Support<f32> for LogNormal[src]

impl Support<f64> for LogNormal[src]

impl Variance<f64> for LogNormal[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<Fx, X> Cdf<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Cdf<X>, 
[src]

impl<Fx, X> ContinuousDistr<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: ContinuousDistr<X>, 
[src]

impl<Fx> Entropy for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Entropy
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<Fx, X> InverseCdf<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: InverseCdf<X>, 
[src]

impl<Fx> Kurtosis for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Kurtosis
[src]

impl<Fx, X> Mean<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Mean<X>, 
[src]

impl<Fx, X> Median<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Median<X>, 
[src]

impl<Fx, X> Mode<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Mode<X>, 
[src]

impl<Fx, X> Rv<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Rv<X>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<Fx> Skewness for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Skewness
[src]

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<Fx, X> Support<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Support<X>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<Fx, X> Variance<X> for Fx where
    Fx: Deref,
    <Fx as Deref>::Target: Variance<X>, 
[src]