Skip to main content

ScientificRandomExt

Trait ScientificRandomExt 

Source
pub trait ScientificRandomExt<A, D: Dimension> {
    // Required methods
    fn dirichlet<R>(shape: D, alpha: &[f64], rng: &mut Random<R>) -> Self
       where A: From<f64>,
             R: Rng;
    fn von_mises<R>(shape: D, mu: f64, kappa: f64, rng: &mut Random<R>) -> Self
       where A: From<f64>,
             R: Rng;
    fn multivariate_normal<R>(
        mean: Vec<f64>,
        covariance: Vec<Vec<f64>>,
        n_samples: usize,
        rng: &mut Random<R>,
    ) -> Array<A, Ix2>
       where A: From<f64>,
             R: Rng;
    fn categorical<R, T>(
        shape: D,
        choices: &[T],
        probabilities: &[f64],
        rng: &mut Random<R>,
    ) -> Array<T, D>
       where T: Clone,
             R: Rng;
    fn correlated_normal<R>(
        shape: D,
        correlation_matrix: &Array<f64, Ix2>,
        rng: &mut Random<R>,
    ) -> Self
       where A: From<f64>,
             R: Rng;
    fn sparse<R, Dist>(
        shape: D,
        density: f64,
        distribution: Dist,
        rng: &mut Random<R>,
    ) -> Self
       where A: Clone + Default,
             R: Rng,
             Dist: Distribution<A>;
}
Expand description

Scientific computing specific random array extensions

Required Methods§

Source

fn dirichlet<R>(shape: D, alpha: &[f64], rng: &mut Random<R>) -> Self
where A: From<f64>, R: Rng,

Generate random array from Dirichlet distribution

Source

fn von_mises<R>(shape: D, mu: f64, kappa: f64, rng: &mut Random<R>) -> Self
where A: From<f64>, R: Rng,

Generate random array from Von Mises distribution (circular)

Source

fn multivariate_normal<R>( mean: Vec<f64>, covariance: Vec<Vec<f64>>, n_samples: usize, rng: &mut Random<R>, ) -> Array<A, Ix2>
where A: From<f64>, R: Rng,

Generate multivariate normal samples

Source

fn categorical<R, T>( shape: D, choices: &[T], probabilities: &[f64], rng: &mut Random<R>, ) -> Array<T, D>
where T: Clone, R: Rng,

Generate samples from categorical distribution

Source

fn correlated_normal<R>( shape: D, correlation_matrix: &Array<f64, Ix2>, rng: &mut Random<R>, ) -> Self
where A: From<f64>, R: Rng,

Generate correlated random arrays using Cholesky decomposition

Source

fn sparse<R, Dist>( shape: D, density: f64, distribution: Dist, rng: &mut Random<R>, ) -> Self
where A: Clone + Default, R: Rng, Dist: Distribution<A>,

Generate random sparse arrays with specified density

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<A, S, D> ScientificRandomExt<A, D> for ArrayBase<S, D>
where S: DataOwned<Elem = A>, D: Dimension, A: Clone,