Trait InitializeExt

Source
pub trait InitializeExt<A, S, D>: Initialize<A, D, Data = S> + Sized
where A: Clone, D: Dimension, S: RawData<Elem = A>,
{ // Provided methods fn bernoulli<Sh>(shape: Sh, p: f64) -> Result<Self, BernoulliError> where S: DataOwned, Sh: ShapeBuilder<Dim = D>, Bernoulli: Distribution<A> { ... } fn lecun_normal<Sh>(shape: Sh, n: usize) -> Self where A: Float, S: DataOwned, Sh: ShapeBuilder<Dim = D>, StandardNormal: Distribution<A> { ... } fn normal<Sh>(shape: Sh, mean: A, std: A) -> Result<Self, NormalError> where A: Float, S: DataOwned, Sh: ShapeBuilder<Dim = D>, StandardNormal: Distribution<A> { ... } fn randc<Sh>(shape: Sh, re: A, im: A) -> Self where S: DataOwned, Sh: ShapeBuilder<Dim = D>, ComplexDistribution<A, A>: Distribution<A> { ... } fn stdnorm<Sh>(shape: Sh) -> Self where S: DataOwned, Sh: ShapeBuilder<Dim = D>, StandardNormal: Distribution<A> { ... } fn stdnorm_from_seed<Sh>(shape: Sh, seed: u64) -> Self where S: DataOwned, Sh: ShapeBuilder<Dim = D>, StandardNormal: Distribution<A> { ... } fn truncnorm<Sh>(shape: Sh, mean: A, std: A) -> Result<Self, NormalError> where A: Float, S: DataOwned, Sh: ShapeBuilder<Dim = D>, StandardNormal: Distribution<A> { ... } fn uniform<Sh>(shape: Sh, dk: A) -> Self where A: Neg<Output = A> + SampleUniform, S: DataOwned, Sh: ShapeBuilder<Dim = D>, <A as SampleUniform>::Sampler: Clone { ... } fn uniform_from_seed<Sh>(shape: Sh, start: A, stop: A, key: u64) -> Self where A: SampleUniform, S: DataOwned, Sh: ShapeBuilder<Dim = D>, <A as SampleUniform>::Sampler: Clone { ... } fn uniform_along<Sh>(shape: Sh, axis: usize) -> Self where A: Copy + Float + SampleUniform, S: DataOwned, Sh: ShapeBuilder<Dim = D>, <A as SampleUniform>::Sampler: Clone { ... } fn uniform_between<Sh>(shape: Sh, a: A, b: A) -> Self where A: SampleUniform, S: DataOwned, Sh: ShapeBuilder<Dim = D>, <A as SampleUniform>::Sampler: Clone { ... } }
Expand description

This trait extends the Initialize trait with methods for generating random arrays from various distributions.

Provided Methods§

Source

fn bernoulli<Sh>(shape: Sh, p: f64) -> Result<Self, BernoulliError>
where S: DataOwned, Sh: ShapeBuilder<Dim = D>, Bernoulli: Distribution<A>,

Source

fn lecun_normal<Sh>(shape: Sh, n: usize) -> Self
where A: Float, S: DataOwned, Sh: ShapeBuilder<Dim = D>, StandardNormal: Distribution<A>,

Initialize the object according to the Lecun Initialization scheme. LecunNormal distributions are truncated Normal distributions centered at 0 with a standard deviation equal to the square root of the reciprocal of the number of inputs.

Source

fn normal<Sh>(shape: Sh, mean: A, std: A) -> Result<Self, NormalError>
where A: Float, S: DataOwned, Sh: ShapeBuilder<Dim = D>, StandardNormal: Distribution<A>,

Given a shape, mean, and standard deviation generate a new object using the Normal distribution

Source

fn randc<Sh>(shape: Sh, re: A, im: A) -> Self
where S: DataOwned, Sh: ShapeBuilder<Dim = D>, ComplexDistribution<A, A>: Distribution<A>,

Source

fn stdnorm<Sh>(shape: Sh) -> Self
where S: DataOwned, Sh: ShapeBuilder<Dim = D>, StandardNormal: Distribution<A>,

Generate a random array using the StandardNormal distribution

Source

fn stdnorm_from_seed<Sh>(shape: Sh, seed: u64) -> Self
where S: DataOwned, Sh: ShapeBuilder<Dim = D>, StandardNormal: Distribution<A>,

Generate a random array using the StandardNormal distribution with a given seed

Source

fn truncnorm<Sh>(shape: Sh, mean: A, std: A) -> Result<Self, NormalError>
where A: Float, S: DataOwned, Sh: ShapeBuilder<Dim = D>, StandardNormal: Distribution<A>,

Initialize the object using the TruncatedNormal distribution

Source

fn uniform<Sh>(shape: Sh, dk: A) -> Self
where A: Neg<Output = A> + SampleUniform, S: DataOwned, Sh: ShapeBuilder<Dim = D>, <A as SampleUniform>::Sampler: Clone,

A uniform generator with values between u(-dk, dk)

Source

fn uniform_from_seed<Sh>(shape: Sh, start: A, stop: A, key: u64) -> Self
where A: SampleUniform, S: DataOwned, Sh: ShapeBuilder<Dim = D>, <A as SampleUniform>::Sampler: Clone,

Source

fn uniform_along<Sh>(shape: Sh, axis: usize) -> Self
where A: Copy + Float + SampleUniform, S: DataOwned, Sh: ShapeBuilder<Dim = D>, <A as SampleUniform>::Sampler: Clone,

Generate a random array with values between u(-a, a) where a is the reciprocal of the value at the given axis

Source

fn uniform_between<Sh>(shape: Sh, a: A, b: A) -> Self
where A: SampleUniform, S: DataOwned, Sh: ShapeBuilder<Dim = D>, <A as SampleUniform>::Sampler: Clone,

A uniform generator with values between u(-dk, dk)

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<U, A, S, D> InitializeExt<A, S, D> for U
where A: Clone, D: Dimension, S: RawData<Elem = A>, U: Initialize<A, D, Data = S>,