Class StableSampler.Alpha1CMSStableSampler
- 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.Alpha1CMSStableSampler
-
- All Implemented Interfaces:
ContinuousSampler
,SharedStateContinuousSampler
,SharedStateSampler<SharedStateContinuousSampler>
- Enclosing class:
- StableSampler
static class StableSampler.Alpha1CMSStableSampler extends StableSampler.BaseStableSampler
Implement the stable distribution case:alpha == 1
andbeta != 0
.Implements the same algorithm as the
StableSampler.CMSStableSampler
with thealpha
assumed to be 1.This sampler specifically requires that
beta / (pi/2) != 0
; otherwise the parameters equalalpha=1, beta=0
as 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 private double
tau
Cache of expression value used in generation.
-
Constructor Summary
Constructors Constructor Description Alpha1CMSStableSampler(UniformRandomProvider rng, double beta)
Alpha1CMSStableSampler(UniformRandomProvider rng, StableSampler.Alpha1CMSStableSampler source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
sample()
Generate a sample from a stable distribution.StableSampler.Alpha1CMSStableSampler
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
-
Alpha1CMSStableSampler
Alpha1CMSStableSampler(UniformRandomProvider rng, double beta)
- Parameters:
rng
- Underlying source of randomnessbeta
- Skewness parameter. Must be in the interval[-1, 1]
.
-
Alpha1CMSStableSampler
Alpha1CMSStableSampler(UniformRandomProvider rng, StableSampler.Alpha1CMSStableSampler 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.
-
withUniformRandomProvider
public StableSampler.Alpha1CMSStableSampler 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
-
-