Class ChengBetaSampler.ChengBCBetaSampler
- java.lang.Object
-
- org.apache.commons.rng.sampling.distribution.ChengBetaSampler.BaseChengBetaSampler
-
- org.apache.commons.rng.sampling.distribution.ChengBetaSampler.ChengBCBetaSampler
-
- All Implemented Interfaces:
ContinuousSampler
,SharedStateContinuousSampler
,SharedStateSampler<SharedStateContinuousSampler>
- Enclosing class:
- ChengBetaSampler
private static class ChengBetaSampler.ChengBCBetaSampler extends ChengBetaSampler.BaseChengBetaSampler
Computes one sample using Cheng's BC algorithm, when at least one of beta distributionalpha
orbeta
shape parameters is smaller than 1.
-
-
Field Summary
Fields Modifier and Type Field Description private double
beta
The algorithm beta factor.private double
delta
The algorithm delta factor.private double
k1
The algorithm k1 factor.private double
k2
The algorithm k2 factor.private static double
ONE_HALF
1/2.private static double
ONE_QUARTER
1/4.-
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)
ChengBCBetaSampler(UniformRandomProvider rng, boolean aIsAlphaShape, double a, double b)
private
ChengBCBetaSampler(UniformRandomProvider rng, ChengBetaSampler.ChengBCBetaSampler source)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
sample()
Creates adouble
sample.SharedStateContinuousSampler
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.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 Detail
-
ONE_HALF
private static final double ONE_HALF
1/2.- See Also:
- Constant Field Values
-
ONE_QUARTER
private static final double ONE_QUARTER
1/4.- See Also:
- Constant Field Values
-
beta
private final double beta
The algorithm beta factor. This is not the beta distribution beta shape parameter.
-
delta
private final double delta
The algorithm delta factor.
-
k1
private final double k1
The algorithm k1 factor.
-
k2
private final double k2
The algorithm k2 factor.
-
-
Constructor Detail
-
ChengBCBetaSampler
ChengBCBetaSampler(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
- max(alpha, beta) shape parameter.b
- min(alpha, beta) shape parameter.
-
ChengBCBetaSampler
private ChengBCBetaSampler(UniformRandomProvider rng, ChengBetaSampler.ChengBCBetaSampler source)
- Parameters:
rng
- Generator of uniformly distributed random numbers.source
- Source to copy.
-
-
Method Detail
-
sample
public double sample()
Description copied from interface:ContinuousSampler
Creates adouble
sample.- Returns:
- a sample.
-
withUniformRandomProvider
public SharedStateContinuousSampler withUniformRandomProvider(UniformRandomProvider rng)
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
-
-