Class StableSampler.BaseStableSampler

java.lang.Object
org.apache.commons.rng.sampling.distribution.StableSampler
org.apache.commons.rng.sampling.distribution.StableSampler.BaseStableSampler
All Implemented Interfaces:
ContinuousSampler, SharedStateContinuousSampler, SharedStateSampler<SharedStateContinuousSampler>
Direct Known Subclasses:
StableSampler.Alpha1CMSStableSampler, StableSampler.Beta0WeronStableSampler, StableSampler.CauchyStableSampler, StableSampler.WeronStableSampler
Enclosing class:
StableSampler

private abstract static class StableSampler.BaseStableSampler extends StableSampler
Base class for implementations of a stable distribution that requires an exponential random deviate.
  • Field Details

  • Constructor Details

    • BaseStableSampler

      BaseStableSampler(UniformRandomProvider rng)
      Parameters:
      rng - Underlying source of randomness
  • Method Details

    • getOmega

      double getOmega()
      Gets a random value for the omega parameter (w). This is an exponential random variable with mean 1.

      Warning: For simplicity this does not check the variate is not 0. The calling CMS algorithm should detect and handle incorrect samples as a result of this unlikely edge case.

      Returns:
      omega
    • getPhi

      double getPhi()
      Gets a random value for the phi parameter. This is a uniform random variable in (-pi/2, pi/2).
      Returns:
      phi
    • getPhiBy2

      double getPhiBy2()
      Gets a random value for the phi parameter divided by 2. This is a uniform random variable in (-pi/4, pi/4).

      Note: Ideally this should not have a value of -pi/4 or pi/4 as the CMS algorithm can generate infinite values when the phi/2 uniform deviate is +/-pi/4. This can result in NaN output. Under certain parameterizations phi/2 close to the limits also create NaN output. Thus output should be checked regardless. Avoiding the extreme values simplifies the number of checks that are required.

      Returns:
      phi / 2