Class StableSampler.Beta0WeronStableSampler
java.lang.Object
org.apache.commons.rng.sampling.distribution.StableSampler
org.apache.commons.rng.sampling.distribution.StableSampler.BaseStableSampler
org.apache.commons.rng.sampling.distribution.StableSampler.Beta0WeronStableSampler
- All Implemented Interfaces:
ContinuousSampler, SharedStateContinuousSampler, SharedStateSampler<SharedStateContinuousSampler>
- Direct Known Subclasses:
StableSampler.Beta0CMSStableSampler
- Enclosing class:
StableSampler
Implement the generic stable distribution case:
alpha < 2 and beta == 0.
Implements the same algorithm as the StableSampler.WeronStableSampler with
the beta assumed to be 0.
This routine assumes alpha != 1; alpha=1, beta=0 is the Cauchy
distribution case.
- Since:
- 1.4
-
Nested Class Summary
Nested classes/interfaces inherited from class StableSampler
StableSampler.Alpha1CMSStableSampler, StableSampler.Beta0CMSStableSampler, StableSampler.Beta0WeronStableSampler, StableSampler.CMSStableSampler, StableSampler.SpecialMath, StableSampler.WeronStableSampler -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final doubleEpsilon (1 - alpha).protected final double(1 / alpha) - 1 = eps / (1 - eps).protected final double1 / alpha = 1 / (1 - eps).protected final doubleEpsilon (1 - alpha). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected doublecreateSample(double phi, double w) Create the sample.doublesample()Generate a sample from a stable distribution.Create a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.Methods inherited from class StableSampler.BaseStableSampler
getOmega, getPhi, getPhiBy2Methods inherited from class StableSampler
nextLong, of, of, toStringMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ContinuousSampler
samples, samples
-
Field Details
-
eps
protected final double epsEpsilon (1 - alpha). -
meps1
protected final double meps1Epsilon (1 - alpha). -
inv1mEps
protected final double inv1mEps1 / alpha = 1 / (1 - eps). -
epsDiv1mEps
protected final double epsDiv1mEps(1 / alpha) - 1 = eps / (1 - eps).
-
-
Constructor Details
-
Beta0WeronStableSampler
Beta0WeronStableSampler(UniformRandomProvider rng, double alpha) - Parameters:
rng- Underlying source of randomnessalpha- Stability parameter. Must be in the interval(0, 2].
-
Beta0WeronStableSampler
Beta0WeronStableSampler(UniformRandomProvider rng, StableSampler.Beta0WeronStableSampler source) - Parameters:
rng- Underlying source of randomnesssource- Source to copy.
-
-
Method Details
-
sample
public double sample()Description copied from class:StableSamplerGenerate a sample from a stable distribution.The distribution uses the 0-parameterization: S(alpha, beta, gamma, delta; 0).
- Specified by:
samplein interfaceContinuousSampler- Specified by:
samplein classStableSampler- Returns:
- a sample.
-
createSample
protected double createSample(double phi, double w) Create the sample. This routine is robust to edge cases and returns a deviate at the extremes of the support. It correctly handlesalpha -> 0when the sample is increasingly likely to be +/- infinity.- Parameters:
phi- Uniform deviate in(-pi/2, pi/2)w- Exponential deviate- Returns:
- x
-
withUniformRandomProvider
Description copied from class:StableSamplerCreate a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.- Specified by:
withUniformRandomProviderin interfaceSharedStateSampler<SharedStateContinuousSampler>- Specified by:
withUniformRandomProviderin classStableSampler- Parameters:
rng- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-