Skip to main content

Uniform

Struct Uniform 

Source
pub struct Uniform {
    pub a: f64,
    pub b: f64,
}
Expand description

The continuous uniform distribution on [a, b] (SciPy’s uniform(loc=a, scale=b−a)).

Fields§

§a: f64§b: f64

Implementations§

Source§

impl Uniform

Source

pub fn new(a: f64, b: f64) -> Result<Self, ErrorsJSL>

Trait Implementations§

Source§

impl Clone for Uniform

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl ContinuousDistribution for Uniform

Source§

fn pdf(&self, x: f64) -> f64

The probability density.
Source§

fn cdf(&self, x: f64) -> f64

The distribution function P(X ≤ x).
Source§

fn ppf(&self, p: f64) -> f64

The quantile (percent-point) function, the inverse of the distribution function.
Source§

fn support(&self) -> (f64, f64)

The interval [a, b] outside which the density is zero.
Source§

fn mean(&self) -> f64

Source§

fn variance(&self) -> f64

Source§

fn skewness(&self) -> f64

Source§

fn excess_kurtosis(&self) -> f64

The excess kurtosis (zero for the normal distribution), as SciPy’s stats(moments='k').
Source§

fn logpdf(&self, x: f64) -> f64

The log density (more accurate than pdf(x).ln() in the tails where overridden).
Source§

fn sf(&self, x: f64) -> f64

The survival function P(X > x).
Source§

fn isf(&self, q: f64) -> f64

The inverse survival function.
Source§

fn std(&self) -> f64

Source§

fn median(&self) -> f64

Source§

fn interval(&self, confidence: f64) -> (f64, f64)

The central interval containing a fraction confidence of the probability.
Source§

fn log_likelihood(&self, data: &[f64]) -> f64

Σ log f(xᵢ).
Source§

fn sample<U: UniformGenerator>(&self, rng: &mut U) -> f64
where Self: Sized,

A sample by inversion, ppf(U).
Source§

impl Copy for Uniform

Source§

impl Debug for Uniform

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Fit for Uniform

Source§

fn fit(data: &[f64]) -> Result<Self, ErrorsJSL>

The sample minimum and maximum.

Source§

impl PartialEq for Uniform

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Uniform

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.