[−][src]Struct rv::dist::Exponential
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]
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]
fn clone(&self) -> Exponential
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[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<'_> From<&'_ Exponential> for String
[src]
fn from(expon: &Exponential) -> String
[src]
impl InverseCdf<f32> for Exponential
[src]
fn invcdf(&self, p: f64) -> f32
[src]
fn quantile(&self, p: f64) -> X
[src]
fn interval(&self, p: f64) -> (X, X)
[src]
impl InverseCdf<f64> for Exponential
[src]
fn invcdf(&self, p: f64) -> f64
[src]
fn quantile(&self, p: f64) -> X
[src]
fn interval(&self, p: f64) -> (X, X)
[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]
fn eq(&self, other: &Exponential) -> bool
[src]
fn ne(&self, other: &Exponential) -> bool
[src]
impl Rv<f32> for Exponential
[src]
fn ln_f(&self, x: &f32) -> f64
[src]
fn draw<R: Rng>(&self, rng: &mut R) -> f32
[src]
fn sample<R: Rng>(&self, n: usize, rng: &mut R) -> Vec<f32>
[src]
fn f(&self, x: &X) -> f64
[src]
fn sample_stream<'r, R: Rng>(
&'r self,
rng: &'r mut R
) -> Box<dyn Iterator<Item = X> + 'r>
[src]
&'r self,
rng: &'r mut R
) -> Box<dyn Iterator<Item = X> + 'r>
impl Rv<f64> for Exponential
[src]
fn ln_f(&self, x: &f64) -> f64
[src]
fn draw<R: Rng>(&self, rng: &mut R) -> f64
[src]
fn sample<R: Rng>(&self, n: usize, rng: &mut R) -> Vec<f64>
[src]
fn f(&self, x: &X) -> f64
[src]
fn sample_stream<'r, R: Rng>(
&'r self,
rng: &'r mut R
) -> Box<dyn Iterator<Item = X> + 'r>
[src]
&'r self,
rng: &'r mut R
) -> Box<dyn Iterator<Item = X> + 'r>
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
impl RefUnwindSafe for Exponential
impl Send for Exponential
impl Sync for Exponential
impl Unpin for Exponential
impl UnwindSafe for Exponential
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<Fx, X> Cdf<X> for Fx where
Fx: Deref,
<Fx as Deref>::Target: Cdf<X>,
[src]
Fx: Deref,
<Fx as Deref>::Target: Cdf<X>,
impl<Fx, X> ContinuousDistr<X> for Fx where
Fx: Deref,
<Fx as Deref>::Target: ContinuousDistr<X>,
[src]
Fx: Deref,
<Fx as Deref>::Target: ContinuousDistr<X>,
impl<Fx> Entropy for Fx where
Fx: Deref,
<Fx as Deref>::Target: Entropy,
[src]
Fx: Deref,
<Fx as Deref>::Target: Entropy,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<Fx, X> InverseCdf<X> for Fx where
Fx: Deref,
<Fx as Deref>::Target: InverseCdf<X>,
[src]
Fx: Deref,
<Fx as Deref>::Target: InverseCdf<X>,
fn invcdf(&Self, f64) -> X
[src]
fn quantile(&Self, f64) -> X
[src]
fn interval(&Self, f64) -> (X, X)
[src]
impl<Fx> KlDivergence for Fx where
Fx: Deref,
<Fx as Deref>::Target: KlDivergence,
[src]
Fx: Deref,
<Fx as Deref>::Target: KlDivergence,
impl<Fx> Kurtosis for Fx where
Fx: Deref,
<Fx as Deref>::Target: Kurtosis,
[src]
Fx: Deref,
<Fx as Deref>::Target: Kurtosis,
impl<Fx, X> Mean<X> for Fx where
Fx: Deref,
<Fx as Deref>::Target: Mean<X>,
[src]
Fx: Deref,
<Fx as Deref>::Target: Mean<X>,
impl<Fx, X> Median<X> for Fx where
Fx: Deref,
<Fx as Deref>::Target: Median<X>,
[src]
Fx: Deref,
<Fx as Deref>::Target: Median<X>,
impl<Fx, X> Mode<X> for Fx where
Fx: Deref,
<Fx as Deref>::Target: Mode<X>,
[src]
Fx: Deref,
<Fx as Deref>::Target: Mode<X>,
impl<Fx, X> Rv<X> for Fx where
Fx: Deref,
<Fx as Deref>::Target: Rv<X>,
[src]
Fx: Deref,
<Fx as Deref>::Target: Rv<X>,
fn ln_f(&Self, &X) -> f64
[src]
fn f(&Self, &X) -> f64
[src]
fn draw<R>(&Self, &mut R) -> X where
R: Rng,
[src]
R: Rng,
fn sample<R>(&Self, usize, &mut R) -> Vec<X> where
R: Rng,
[src]
R: Rng,
fn sample_stream<'r, R: Rng>(
&'r self,
rng: &'r mut R
) -> Box<dyn Iterator<Item = X> + 'r>
[src]
&'r self,
rng: &'r mut R
) -> Box<dyn Iterator<Item = X> + 'r>
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]
Fx: Deref,
<Fx as Deref>::Target: Skewness,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
SS: SubsetOf<SP>,
fn to_subset(&self) -> Option<SS>
fn is_in_subset(&self) -> bool
unsafe fn to_subset_unchecked(&self) -> SS
fn from_subset(element: &SS) -> SP
impl<Fx, X> Support<X> for Fx where
Fx: Deref,
<Fx as Deref>::Target: Support<X>,
[src]
Fx: Deref,
<Fx as Deref>::Target: Support<X>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<Fx, X> Variance<X> for Fx where
Fx: Deref,
<Fx as Deref>::Target: Variance<X>,
[src]
Fx: Deref,
<Fx as Deref>::Target: Variance<X>,