Class ChengBetaSampler.ChengBBBetaSampler
- java.lang.Object
-
- org.apache.commons.rng.sampling.distribution.ChengBetaSampler.BaseChengBetaSampler
-
- org.apache.commons.rng.sampling.distribution.ChengBetaSampler.ChengBBBetaSampler
-
- All Implemented Interfaces:
ContinuousSampler,SharedStateContinuousSampler,SharedStateSampler<SharedStateContinuousSampler>
- Enclosing class:
- ChengBetaSampler
private static final class ChengBetaSampler.ChengBBBetaSampler extends ChengBetaSampler.BaseChengBetaSampler
Computes one sample using Cheng's BB algorithm, when beta distributionalphaandbetashape parameters are both larger than 1.
-
-
Field Summary
Fields Modifier and Type Field Description private doublebetaThe algorithm beta factor.private doublegammaThe algorithm gamma factor.private static doubleLN_5_P11 + natural logarithm of 5.-
Fields inherited from class org.apache.commons.rng.sampling.distribution.ChengBetaSampler.BaseChengBetaSampler
a, aIsAlphaShape, alpha, b, logAlpha, rng
-
-
Constructor Summary
Constructors Modifier Constructor Description (package private)ChengBBBetaSampler(UniformRandomProvider rng, boolean aIsAlphaShape, double a, double b)privateChengBBBetaSampler(UniformRandomProvider rng, ChengBetaSampler.ChengBBBetaSampler source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description doublesample()Creates adoublesample.SharedStateContinuousSamplerwithUniformRandomProvider(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.ChengBetaSampler.BaseChengBetaSampler
computeX, 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
-
ChengBBBetaSampler
ChengBBBetaSampler(UniformRandomProvider rng, boolean aIsAlphaShape, double a, double b)
- Parameters:
rng- Generator of uniformly distributed random numbers.aIsAlphaShape- true ifais the beta distribution alpha shape parameter.a- min(alpha, beta) shape parameter.b- max(alpha, beta) shape parameter.
-
ChengBBBetaSampler
private ChengBBBetaSampler(UniformRandomProvider rng, ChengBetaSampler.ChengBBBetaSampler source)
- Parameters:
rng- Generator of uniformly distributed random numbers.source- Source to copy.
-
-
Method Detail
-
sample
public double sample()
Description copied from interface:ContinuousSamplerCreates adoublesample.- Returns:
- a sample.
-
withUniformRandomProvider
public SharedStateContinuousSampler withUniformRandomProvider(UniformRandomProvider rng)
Description copied from interface:SharedStateSamplerCreate a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.- Parameters:
rng- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-
-