You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ah...@apache.org on 2021/07/08 08:57:41 UTC
[commons-rng] 03/04: RNG-150: Updated to use the
ZigguratSampler.Exponential
This is an automated email from the ASF dual-hosted git repository.
aherbert pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-rng.git
commit 3c1df6e0d9f74485f3e321316101ca2b91d3e7c0
Author: aherbert <ah...@apache.org>
AuthorDate: Thu Jul 8 09:50:54 2021 +0100
RNG-150: Updated to use the ZigguratSampler.Exponential
---
.../apache/commons/rng/sampling/distribution/GeometricSampler.java | 2 +-
.../commons/rng/sampling/distribution/LargeMeanPoissonSampler.java | 4 ++--
src/changes/changes.xml | 7 ++++---
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/GeometricSampler.java b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/GeometricSampler.java
index d45d6e9..5ea0b56 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/GeometricSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/GeometricSampler.java
@@ -99,7 +99,7 @@ public final class GeometricSampler {
// is noted in the class Javadoc that the use of a small p leads to truncation so
// no checks are made for this case.
final double exponentialMean = 1.0 / (-Math.log1p(-probabilityOfSuccess));
- exponentialSampler = AhrensDieterExponentialSampler.of(rng, exponentialMean);
+ exponentialSampler = ZigguratSampler.Exponential.of(rng, exponentialMean);
}
/**
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/LargeMeanPoissonSampler.java b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/LargeMeanPoissonSampler.java
index 07614e4..41f9eca 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/LargeMeanPoissonSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/LargeMeanPoissonSampler.java
@@ -133,7 +133,7 @@ public class LargeMeanPoissonSampler
this.rng = rng;
gaussian = new ZigguratNormalizedGaussianSampler(rng);
- exponential = ZigguratExponentialSampler.of(rng);
+ exponential = ZigguratSampler.Exponential.of(rng);
// Plain constructor uses the uncached function.
factorialLog = NO_CACHE_FACTORIAL_LOG;
@@ -178,7 +178,7 @@ public class LargeMeanPoissonSampler
this.rng = rng;
gaussian = new ZigguratNormalizedGaussianSampler(rng);
- exponential = ZigguratExponentialSampler.of(rng);
+ exponential = ZigguratSampler.Exponential.of(rng);
// Plain constructor uses the uncached function.
factorialLog = NO_CACHE_FACTORIAL_LOG;
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 15768ce..7e0237f 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -77,13 +77,14 @@ re-run tests that fail, and pass the build if they succeed
within the allotted number of reruns (the test will be marked
as 'flaky' in the report).
">
+ <action dev="aherbert" type="update" issue="150">
+ Update "LargeMeanPoissonSampler" and "GeometricSampler" to use the ZigguratSampler for
+ exponential deviates.
+ </action>
<action dev="aherbert" type="add" issue="151">
New "ZigguratSampler" implementation of the modified "Ziggurat" algorithm for
Gaussian and exponential sampling.
</action>
- <action dev="aherbert" type="update" issue="150">
- "LargeMeanPoissonSampler": Updated to use the ZigguratExponentialSampler.
- </action>
<action dev="aherbert" type="add" issue="149">
New "ZigguratExponentialSampler" implementation of the "Ziggurat" algorithm for
exponential sampling.