Struct rv::dist::Exponential[][src]

pub struct Exponential { /* fields omitted */ }

Exponential distribution, Exp(λ) over x in [0, ∞).

Examples

Compute 50% confidence interval

use rv::prelude::*;

let expon = Exponential::new(1.5).unwrap();
let interval: (f64, f64) = expon.interval(0.5);  // (0.19, 0.92)

Implementations

impl Exponential[src]

pub fn new(rate: f64) -> Result<Self, ExponentialError>[src]

Create a new exponential distribution

Arguments

  • rate: λ > 0, rate or inverse scale

pub fn new_unchecked(rate: f64) -> Self[src]

Creates a new Exponential without checking whether the parameter is valid.

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

Get the rate parameter

Example

let expon = Exponential::new(1.3).unwrap();
assert_eq!(expon.rate(), 1.3);

pub fn set_rate(&mut self, rate: f64) -> Result<(), ExponentialError>[src]

Set the rate parameter

Example

let mut expon = Exponential::new(1.3).unwrap();
assert_eq!(expon.rate(), 1.3);

expon.set_rate(2.1).unwrap();
assert_eq!(expon.rate(), 2.1);

Will error for invalid values

assert!(expon.set_rate(2.1).is_ok());
assert!(expon.set_rate(0.1).is_ok());
assert!(expon.set_rate(0.0).is_err());
assert!(expon.set_rate(-1.0).is_err());
assert!(expon.set_rate(std::f64::INFINITY).is_err());
assert!(expon.set_rate(std::f64::NEG_INFINITY).is_err());
assert!(expon.set_rate(std::f64::NAN).is_err());

pub fn set_rate_unchecked(&mut self, rate: f64)[src]

Set the rate parameter without input validation

Trait Implementations

impl Cdf<f32> for Exponential[src]

impl Cdf<f64> for Exponential[src]

impl Clone for Exponential[src]

impl ContinuousDistr<f32> for Exponential[src]

impl ContinuousDistr<f64> for Exponential[src]

impl Debug for Exponential[src]

impl Display for Exponential[src]

impl Entropy for Exponential[src]

impl InverseCdf<f32> for Exponential[src]

impl InverseCdf<f64> for Exponential[src]

impl KlDivergence for Exponential[src]

impl Kurtosis for Exponential[src]

impl Mean<f32> for Exponential[src]

impl Mean<f64> for Exponential[src]

impl Median<f32> for Exponential[src]

impl Median<f64> for Exponential[src]

impl Mode<f32> for Exponential[src]

impl Mode<f64> for Exponential[src]

impl PartialEq<Exponential> for Exponential[src]

impl Rv<f32> for Exponential[src]

impl Rv<f64> for Exponential[src]

impl Skewness for Exponential[src]

impl StructuralPartialEq for Exponential[src]

impl Support<f32> for Exponential[src]

impl Support<f64> for Exponential[src]

impl Variance<f32> for Exponential[src]

impl Variance<f64> for Exponential[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<T> From<T> for T[src]

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

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>,