commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject [2/2] commons-rng git commit: Precomputation.
Date Sun, 27 Nov 2016 04:42:43 GMT
Precomputation.


Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/ab462939
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/ab462939
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/ab462939

Branch: refs/heads/master
Commit: ab46293943634b7689761512f8c3dbf47de59e8b
Parents: 9d1e0f3
Author: Gilles <erans@apache.org>
Authored: Sun Nov 27 05:40:19 2016 +0100
Committer: Gilles <erans@apache.org>
Committed: Sun Nov 27 05:40:19 2016 +0100

----------------------------------------------------------------------
 .../apache/commons/rng/sampling/distribution/PoissonSampler.java | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-rng/blob/ab462939/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java
b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java
index 9ac3249..ca2f7ce 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java
@@ -66,7 +66,9 @@ public class PoissonSampler
 
         gaussian = new BoxMullerGaussianSampler(rng, 0, 1);
         exponential = new AhrensDieterExponentialSampler(rng, 1);
-        factorialLog = InternalUtils.FactorialLog.create();
+        factorialLog = mean < PIVOT ?
+            null : // Not used.
+            InternalUtils.FactorialLog.create().withCache((int) Math.min(mean, 2 * PIVOT));
     }
 
     /** {@inheritDoc} */


Mime
View raw message