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 class ChengBetaSampler.ChengBBBetaSampler
extends ChengBetaSampler.BaseChengBetaSampler
Computes one sample using Cheng's BB algorithm, when beta distribution
alpha
and
beta
shape parameters are both larger than 1.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final double
The algorithm beta factor.private final double
The algorithm gamma factor.private static final double
1 + natural logarithm of 5.Fields inherited from class org.apache.commons.rng.sampling.distribution.ChengBetaSampler.BaseChengBetaSampler
a, aIsAlphaShape, alpha, b, logAlpha, rng
-
Constructor Summary
ConstructorsModifierConstructorDescription(package private)
ChengBBBetaSampler
(UniformRandomProvider rng, boolean aIsAlphaShape, double a, double b) private
-
Method Summary
Modifier and TypeMethodDescriptiondouble
sample()
Creates adouble
sample.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
-
Field Details
-
LN_5_P1
private static final double LN_5_P11 + natural logarithm of 5. -
beta
private final double betaThe algorithm beta factor. This is not the beta distribution beta shape parameter. -
gamma
private final double gammaThe algorithm gamma factor.
-
-
Constructor Details
-
ChengBBBetaSampler
ChengBBBetaSampler(UniformRandomProvider rng, boolean aIsAlphaShape, double a, double b) - Parameters:
rng
- Generator of uniformly distributed random numbers.aIsAlphaShape
- true ifa
is the beta distribution alpha shape parameter.a
- min(alpha, beta) shape parameter.b
- max(alpha, beta) shape parameter.
-
ChengBBBetaSampler
- Parameters:
rng
- Generator of uniformly distributed random numbers.source
- Source to copy.
-
-
Method Details
-
sample
public double sample()Description copied from interface:ContinuousSampler
Creates adouble
sample.- Returns:
- a sample.
-
withUniformRandomProvider
Description copied from interface:SharedStateSampler
Create 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
-