pub trait InitializeExt<A, S, D>: Initialize<A, D, Data = S> + Sized{
// 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§
fn bernoulli<Sh>(shape: Sh, p: f64) -> Result<Self, BernoulliError>
Sourcefn lecun_normal<Sh>(shape: Sh, n: usize) -> Self
fn lecun_normal<Sh>(shape: Sh, n: usize) -> Self
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.
Sourcefn normal<Sh>(shape: Sh, mean: A, std: A) -> Result<Self, NormalError>
fn normal<Sh>(shape: Sh, mean: A, std: A) -> Result<Self, NormalError>
Given a shape, mean, and standard deviation generate a new object using the Normal distribution
fn randc<Sh>(shape: Sh, re: A, im: A) -> Self
Sourcefn stdnorm<Sh>(shape: Sh) -> Self
fn stdnorm<Sh>(shape: Sh) -> Self
Generate a random array using the StandardNormal distribution
Sourcefn stdnorm_from_seed<Sh>(shape: Sh, seed: u64) -> Self
fn stdnorm_from_seed<Sh>(shape: Sh, seed: u64) -> Self
Generate a random array using the StandardNormal distribution with a given seed
Sourcefn truncnorm<Sh>(shape: Sh, mean: A, std: A) -> Result<Self, NormalError>
fn truncnorm<Sh>(shape: Sh, mean: A, std: A) -> Result<Self, NormalError>
Initialize the object using the TruncatedNormal distribution
Sourcefn uniform<Sh>(shape: Sh, dk: A) -> Selfwhere
A: Neg<Output = A> + SampleUniform,
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
fn uniform<Sh>(shape: Sh, dk: A) -> Selfwhere
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)
fn uniform_from_seed<Sh>(shape: Sh, start: A, stop: A, key: u64) -> Selfwhere
A: SampleUniform,
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
Sourcefn uniform_along<Sh>(shape: Sh, axis: usize) -> Selfwhere
A: Copy + Float + SampleUniform,
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
fn uniform_along<Sh>(shape: Sh, axis: usize) -> Selfwhere
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
Sourcefn uniform_between<Sh>(shape: Sh, a: A, b: A) -> Selfwhere
A: SampleUniform,
S: DataOwned,
Sh: ShapeBuilder<Dim = D>,
<A as SampleUniform>::Sampler: Clone,
fn uniform_between<Sh>(shape: Sh, a: A, b: A) -> Selfwhere
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.