ContinuousSampler
, SharedStateContinuousSampler
, SharedStateSampler<SharedStateContinuousSampler>
public class GaussianSampler extends java.lang.Object implements SharedStateContinuousSampler
Constructor | Description |
---|---|
GaussianSampler(NormalizedGaussianSampler normalized,
double mean,
double standardDeviation) |
Modifier and Type | Method | Description |
---|---|---|
static SharedStateContinuousSampler |
of(NormalizedGaussianSampler normalized,
double mean,
double standardDeviation) |
Create a new normalised Gaussian sampler.
|
double |
sample() |
Creates a sample.
|
java.lang.String |
toString() |
|
SharedStateContinuousSampler |
withUniformRandomProvider(org.apache.commons.rng.UniformRandomProvider rng) |
Create a new instance of the sampler with the same underlying state using the given
uniform random provider as the source of randomness.
|
public GaussianSampler(NormalizedGaussianSampler normalized, double mean, double standardDeviation)
normalized
- Generator of N(0,1) Gaussian distributed random numbers.mean
- Mean of the Gaussian distribution.standardDeviation
- Standard deviation of the Gaussian distribution.java.lang.IllegalArgumentException
- if standardDeviation <= 0
public double sample()
sample
in interface ContinuousSampler
public java.lang.String toString()
toString
in class java.lang.Object
public SharedStateContinuousSampler withUniformRandomProvider(org.apache.commons.rng.UniformRandomProvider rng)
Note: This function is available if the underlying NormalizedGaussianSampler
is a SharedStateSampler
.
Otherwise a run-time exception is thrown.
withUniformRandomProvider
in interface SharedStateSampler<SharedStateContinuousSampler>
rng
- Generator of uniformly distributed random numbers.java.lang.UnsupportedOperationException
- if the underlying sampler is not a
SharedStateSampler
or
does not return a NormalizedGaussianSampler
when sharing state.public static SharedStateContinuousSampler of(NormalizedGaussianSampler normalized, double mean, double standardDeviation)
Note: The shared-state functionality is available if the NormalizedGaussianSampler
is a SharedStateSampler
.
Otherwise a run-time exception will be thrown when the sampler is used to share state.
normalized
- Generator of N(0,1) Gaussian distributed random numbers.mean
- Mean of the Gaussian distribution.standardDeviation
- Standard deviation of the Gaussian distribution.java.lang.IllegalArgumentException
- if standardDeviation <= 0
withUniformRandomProvider(UniformRandomProvider)
Copyright © 2016–2019 The Apache Software Foundation. All rights reserved.