Struct rv::dist::Uniform [−][src]
Continuous uniform distribution, U(a, b) on the interval x in [a, b]
Example
The Uniform CDF is a line
use rv::prelude::*; let u = Uniform::new(2.0, 4.0).unwrap(); // A line representing the CDF let y = |x: f64| { 0.5 * x - 1.0 }; assert!((u.cdf(&3.0_f64) - y(3.0)).abs() < 1E-12); assert!((u.cdf(&3.2_f64) - y(3.2)).abs() < 1E-12);
Fields
a: f64
b: f64
Methods
impl Uniform
[src]
impl Uniform
Trait Implementations
impl Debug for Uniform
[src]
impl Debug for Uniform
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Uniform
[src]
impl Clone for Uniform
fn clone(&self) -> Uniform
[src]
fn clone(&self) -> Uniform
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Default for Uniform
[src]
impl Default for Uniform
impl Skewness for Uniform
[src]
impl Skewness for Uniform
impl Kurtosis for Uniform
[src]
impl Kurtosis for Uniform
impl Entropy for Uniform
[src]
impl Entropy for Uniform
impl Rv<f64> for Uniform
[src]
impl Rv<f64> for Uniform
fn ln_f(&self, x: &f64) -> f64
[src]
fn ln_f(&self, x: &f64) -> f64
Un-normalized probability function Read more
fn ln_normalizer(&self) -> f64
[src]
fn ln_normalizer(&self) -> f64
The log of the constant term in the PDF/PMF. Should not be a function of any of the parameters. Read more
fn draw<R: Rng>(&self, rng: &mut R) -> f64
[src]
fn draw<R: Rng>(&self, rng: &mut R) -> f64
Single draw from the Rv
Read more
fn sample<R: Rng>(&self, n: usize, rng: &mut R) -> Vec<f64>
[src]
fn sample<R: Rng>(&self, n: usize, rng: &mut R) -> Vec<f64>
Multiple draws of the Rv
Read more
fn f(&self, x: &X) -> f64
[src]
fn f(&self, x: &X) -> f64
Un-normalized probability function Read more
fn normalizer(&self) -> f64
[src]
fn normalizer(&self) -> f64
The constant term in the PDF/PMF. Should not be a function of any of the parameters. Read more
impl Support<f64> for Uniform
[src]
impl Support<f64> for Uniform
impl ContinuousDistr<f64> for Uniform
[src]
impl ContinuousDistr<f64> for Uniform
fn pdf(&self, x: &X) -> f64
[src]
fn pdf(&self, x: &X) -> f64
The value of the Probability Density Function (PDF) at x
Read more
fn ln_pdf(&self, x: &X) -> f64
[src]
fn ln_pdf(&self, x: &X) -> f64
The value of the log Probability Density Function (PDF) at x
Read more
impl Mean<f64> for Uniform
[src]
impl Mean<f64> for Uniform
impl Median<f64> for Uniform
[src]
impl Median<f64> for Uniform
impl Variance<f64> for Uniform
[src]
impl Variance<f64> for Uniform
impl Cdf<f64> for Uniform
[src]
impl Cdf<f64> for Uniform
fn cdf(&self, x: &f64) -> f64
[src]
fn cdf(&self, x: &f64) -> f64
The value of the Cumulative Density Function at x
Read more
fn sf(&self, x: &X) -> f64
[src]
fn sf(&self, x: &X) -> f64
Survival function, 1 - CDF(x)
impl InverseCdf<f64> for Uniform
[src]
impl InverseCdf<f64> for Uniform
fn invcdf(&self, p: f64) -> f64
[src]
fn invcdf(&self, p: f64) -> f64
The value of the x
at the given probability in the CDF Read more
fn quantile(&self, p: f64) -> X
[src]
fn quantile(&self, p: f64) -> X
Alias for invcdf
fn interval(&self, p: f64) -> (X, X)
[src]
fn interval(&self, p: f64) -> (X, X)
Interval containing p
proportion for the probability Read more
impl Rv<f32> for Uniform
[src]
impl Rv<f32> for Uniform
fn ln_f(&self, x: &f32) -> f64
[src]
fn ln_f(&self, x: &f32) -> f64
Un-normalized probability function Read more
fn ln_normalizer(&self) -> f64
[src]
fn ln_normalizer(&self) -> f64
The log of the constant term in the PDF/PMF. Should not be a function of any of the parameters. Read more
fn draw<R: Rng>(&self, rng: &mut R) -> f32
[src]
fn draw<R: Rng>(&self, rng: &mut R) -> f32
Single draw from the Rv
Read more
fn sample<R: Rng>(&self, n: usize, rng: &mut R) -> Vec<f32>
[src]
fn sample<R: Rng>(&self, n: usize, rng: &mut R) -> Vec<f32>
Multiple draws of the Rv
Read more
fn f(&self, x: &X) -> f64
[src]
fn f(&self, x: &X) -> f64
Un-normalized probability function Read more
fn normalizer(&self) -> f64
[src]
fn normalizer(&self) -> f64
The constant term in the PDF/PMF. Should not be a function of any of the parameters. Read more
impl Support<f32> for Uniform
[src]
impl Support<f32> for Uniform
impl ContinuousDistr<f32> for Uniform
[src]
impl ContinuousDistr<f32> for Uniform
fn pdf(&self, x: &X) -> f64
[src]
fn pdf(&self, x: &X) -> f64
The value of the Probability Density Function (PDF) at x
Read more
fn ln_pdf(&self, x: &X) -> f64
[src]
fn ln_pdf(&self, x: &X) -> f64
The value of the log Probability Density Function (PDF) at x
Read more
impl Mean<f32> for Uniform
[src]
impl Mean<f32> for Uniform
impl Median<f32> for Uniform
[src]
impl Median<f32> for Uniform
impl Variance<f32> for Uniform
[src]
impl Variance<f32> for Uniform
impl Cdf<f32> for Uniform
[src]
impl Cdf<f32> for Uniform
fn cdf(&self, x: &f32) -> f64
[src]
fn cdf(&self, x: &f32) -> f64
The value of the Cumulative Density Function at x
Read more
fn sf(&self, x: &X) -> f64
[src]
fn sf(&self, x: &X) -> f64
Survival function, 1 - CDF(x)
impl InverseCdf<f32> for Uniform
[src]
impl InverseCdf<f32> for Uniform