[][src]Struct rv::dist::VonMises

pub struct VonMises { /* fields omitted */ }

VonMises distirbution on the circular interval (0, 2π]

Example

use rv::prelude::*;

let vm = VonMises::new(1.0, 2.0).unwrap();

// x is in (0, 2π]
assert!(!vm.supports(&-0.001_f64));
assert!(!vm.supports(&6.3_f64));

// 103 VonMises draws
let mut rng = rand::thread_rng();
let xs: Vec<f64> = vm.sample(103, &mut rng);
assert_eq!(xs.len(), 103);

Methods

impl VonMises[src]

pub fn set_mu(&mut self, val: f64) -> &mut Self[src]

Mean

impl VonMises[src]

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

Create a new VonMises distribution with mean mu, and precision, k.

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

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

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

Get the mean parameter, mu

Example

let vm = VonMises::new(0.0, 1.0).unwrap();
assert_eq!(vm.mu(), 0.0);

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

Get the precision parameter, k

Example

let vm = VonMises::new(0.0, 1.0).unwrap();
assert_eq!(vm.k(), 1.0);

pub fn set_k(&mut self, k: f64) -> Result<(), VonMisesError>[src]

Set the value of k

Example

let mut vm = VonMises::new(0.0, 1.0).unwrap();
let v1: f64 = vm.variance().unwrap();
assert::close(v1, 0.5536100341034653, 1E-10);

vm.set_mu(0.2);
vm.set_k(2.0);

let v2: f64 = vm.variance().unwrap();
assert::close(v2, 0.3022253420359917, 1E-10);

Trait Implementations

impl Cdf<f32> for VonMises[src]

impl Cdf<f64> for VonMises[src]

impl Clone for VonMises[src]

impl ContinuousDistr<f32> for VonMises[src]

impl ContinuousDistr<f64> for VonMises[src]

impl Debug for VonMises[src]

impl Default for VonMises[src]

impl Display for VonMises[src]

impl Entropy for VonMises[src]

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

impl Mean<f32> for VonMises[src]

impl Mean<f64> for VonMises[src]

impl Median<f32> for VonMises[src]

impl Median<f64> for VonMises[src]

impl Mode<f32> for VonMises[src]

impl Mode<f64> for VonMises[src]

impl PartialEq<VonMises> for VonMises[src]

impl PartialOrd<VonMises> for VonMises[src]

impl Rv<f32> for VonMises[src]

impl Rv<f64> for VonMises[src]

impl StructuralPartialEq for VonMises[src]

impl Support<f32> for VonMises[src]

impl Support<f64> for VonMises[src]

impl Variance<f32> for VonMises[src]

impl Variance<f64> for VonMises[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> 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<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]