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
static class StableSampler.Beta0WeronStableSampler extends StableSampler.BaseStableSampler
Implement the generic stable distribution case:alpha < 2
andbeta == 0
.Implements the same algorithm as the
StableSampler.WeronStableSampler
with thebeta
assumed to be 0.This routine assumes
alpha != 1
;alpha=1, beta=0
is the Cauchy distribution case.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.commons.rng.sampling.distribution.StableSampler
StableSampler.Alpha1CMSStableSampler, StableSampler.Beta0CMSStableSampler, StableSampler.Beta0WeronStableSampler, StableSampler.CMSStableSampler, StableSampler.SpecialMath, StableSampler.WeronStableSampler
-
-
Field Summary
Fields Modifier and Type Field Description protected double
eps
Epsilon (1 - alpha).protected double
epsDiv1mEps
(1 / alpha) - 1 = eps / (1 - eps).protected double
inv1mEps
1 / alpha = 1 / (1 - eps).protected double
meps1
Epsilon (1 - alpha).
-
Constructor Summary
Constructors Constructor Description Beta0WeronStableSampler(UniformRandomProvider rng, double alpha)
Beta0WeronStableSampler(UniformRandomProvider rng, StableSampler.Beta0WeronStableSampler source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
createSample(double phi, double w)
Create the sample.double
sample()
Generate a sample from a stable distribution.StableSampler.Beta0WeronStableSampler
withUniformRandomProvider(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.-
Methods inherited from class org.apache.commons.rng.sampling.distribution.StableSampler.BaseStableSampler
getOmega, getPhi, getPhiBy2
-
Methods inherited from class org.apache.commons.rng.sampling.distribution.StableSampler
nextLong, of, of, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.commons.rng.sampling.distribution.ContinuousSampler
samples, samples
-
-
-
-
Constructor Detail
-
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 Detail
-
sample
public double sample()
Description copied from class:StableSampler
Generate a sample from a stable distribution.The distribution uses the 0-parameterization: S(alpha, beta, gamma, delta; 0).
- Specified by:
sample
in interfaceContinuousSampler
- Specified by:
sample
in 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 -> 0
when the sample is increasingly likely to be +/- infinity.- Parameters:
phi
- Uniform deviate in(-pi/2, pi/2)
w
- Exponential deviate- Returns:
- x
-
withUniformRandomProvider
public StableSampler.Beta0WeronStableSampler withUniformRandomProvider(UniformRandomProvider rng)
Description copied from class:StableSampler
Create a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.- Specified by:
withUniformRandomProvider
in interfaceSharedStateSampler<SharedStateContinuousSampler>
- Specified by:
withUniformRandomProvider
in classStableSampler
- Parameters:
rng
- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-
-