You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2018/01/11 11:42:18 UTC
[1/8] commons-rng git commit: Javadoc.
Repository: commons-rng
Updated Branches:
refs/heads/master 93e35b69d -> fc01a96a5
Javadoc.
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/bb10e983
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/bb10e983
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/bb10e983
Branch: refs/heads/master
Commit: bb10e98328a04a65851a77f801760bf913314bab
Parents: 93e35b6
Author: Gilles <er...@apache.org>
Authored: Wed Jan 10 15:36:47 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Wed Jan 10 15:36:47 2018 +0100
----------------------------------------------------------------------
.../sampling/distribution/AhrensDieterExponentialSampler.java | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/bb10e983/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/AhrensDieterExponentialSampler.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/AhrensDieterExponentialSampler.java b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/AhrensDieterExponentialSampler.java
index 4361dad..c3b2387 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/AhrensDieterExponentialSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/AhrensDieterExponentialSampler.java
@@ -19,9 +19,7 @@ package org.apache.commons.rng.sampling.distribution;
import org.apache.commons.rng.UniformRandomProvider;
/**
- * Sampling from an exponential distribution.
- *
- * @see <a href="http://mathworld.wolfram.com/ExponentialDistribution.html">Exponential distribution (MathWorld)</a>
+ * Sampling from an <a href="http://mathworld.wolfram.com/ExponentialDistribution.html">exponential distribution</a>.
*/
public class AhrensDieterExponentialSampler
extends SamplerBase
[8/8] commons-rng git commit: Userguide (web site).
Posted by er...@apache.org.
Userguide (web site).
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/fc01a96a
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/fc01a96a
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/fc01a96a
Branch: refs/heads/master
Commit: fc01a96a5dd4364c81c46203e13fb19f73c675cd
Parents: 4d83aac
Author: Gilles <er...@apache.org>
Authored: Wed Jan 10 18:24:39 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Wed Jan 10 18:24:39 2018 +0100
----------------------------------------------------------------------
src/site/apt/userguide/dist_density_approx.apt | 41 +++++++++++++++++++++
src/site/apt/userguide/rng.apt | 2 +-
2 files changed, 42 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/fc01a96a/src/site/apt/userguide/dist_density_approx.apt
----------------------------------------------------------------------
diff --git a/src/site/apt/userguide/dist_density_approx.apt b/src/site/apt/userguide/dist_density_approx.apt
new file mode 100644
index 0000000..e3b95b0
--- /dev/null
+++ b/src/site/apt/userguide/dist_density_approx.apt
@@ -0,0 +1,41 @@
+~~
+~~ Licensed to the Apache Software Foundation (ASF) under one or more
+~~ contributor license agreements. See the NOTICE file distributed with
+~~ this work for additional information regarding copyright ownership.
+~~ The ASF licenses this file to You under the Apache License, Version 2.0
+~~ (the "License"); you may not use this file except in compliance with
+~~ the License. You may obtain a copy of the License at
+~~
+~~ http://www.apache.org/licenses/LICENSE-2.0
+~~
+~~ Unless required by applicable law or agreed to in writing, software
+~~ distributed under the License is distributed on an "AS IS" BASIS,
+~~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+~~ See the License for the specific language governing permissions and
+~~ limitations under the License.
+~~
+
+ -----------------------------
+ Using RNG to approximate the probability density of distributions
+ -----------------------------
+
+ The samplers provided in package <<<org.apache.commons.rng.sampling.distribution>>>
+ have been used to generate histogram data for the following figures.
+
+[../images/userguide/dist_density_approx/uniform.png]
+
+[../images/userguide/dist_density_approx/gauss.ziggurat.png]
+
+[../images/userguide/dist_density_approx/lognormal.ziggurat.png]
+
+[../images/userguide/dist_density_approx/exp.png]
+
+[../images/userguide/dist_density_approx/gamma.case1.png]
+
+[../images/userguide/dist_density_approx/gamma.case2.png]
+
+[../images/userguide/dist_density_approx/beta.case1.png]
+
+[../images/userguide/dist_density_approx/beta.case2.png]
+
+[../images/userguide/dist_density_approx/pareto.png]
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/fc01a96a/src/site/apt/userguide/rng.apt
----------------------------------------------------------------------
diff --git a/src/site/apt/userguide/rng.apt b/src/site/apt/userguide/rng.apt
index 32ea0f0..989c69c 100644
--- a/src/site/apt/userguide/rng.apt
+++ b/src/site/apt/userguide/rng.apt
@@ -254,7 +254,7 @@ rngNew.restoreState(stateNew);
+--------------------------+
- * Generation of random deviates for various
+ * Generation of {{{./dist_density_approx.html}random deviates}} for various
{{{../commons-rng-sampling/apidocs/org/apache/commons/rng/sampling/distribution/package-summary.html}distributions}}.
+--------------------------+
[4/8] commons-rng git commit: RNG-43: Use new class.
Posted by er...@apache.org.
RNG-43: Use new class.
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/c76bd300
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/c76bd300
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/c76bd300
Branch: refs/heads/master
Commit: c76bd300351e1e6e2a15a1ae2b1015a1b979d679
Parents: adcf0c5
Author: Gilles <er...@apache.org>
Authored: Wed Jan 10 17:32:39 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Wed Jan 10 17:32:39 2018 +0100
----------------------------------------------------------------------
.../distribution/BoxMullerLogNormalSampler.java | 37 +++++---------------
1 file changed, 8 insertions(+), 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/c76bd300/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/BoxMullerLogNormalSampler.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/BoxMullerLogNormalSampler.java b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/BoxMullerLogNormalSampler.java
index 354b8d4..1db0b7c 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/BoxMullerLogNormalSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/BoxMullerLogNormalSampler.java
@@ -19,42 +19,21 @@ package org.apache.commons.rng.sampling.distribution;
import org.apache.commons.rng.UniformRandomProvider;
/**
- * <a href="https://en.wikipedia.org/wiki/Box%E2%80%93Muller_transform">
- * Box-Muller algorithm</a> for sampling from a Log normal distribution.
+ * Sampling from a <a href="https://en.wikipedia.org/wiki/Log-normal_distribution">
+ * log-normal distribution</a>.
+ * Uses {@link BoxMullerNormalizedGaussianSampler} as the underlying sampler.
*/
public class BoxMullerLogNormalSampler
- extends SamplerBase
- implements ContinuousSampler {
- /** Scale. */
- private final double scale;
- /** Shape. */
- private final double shape;
- /** Gaussian sampling. */
- private final NormalizedGaussianSampler gaussian;
-
+ extends LogNormalSampler {
/**
* @param rng Generator of uniformly distributed random numbers.
- * @param scale Scale of the Log normal distribution.
- * @param shape Shape of the Log normal distribution.
+ * @param scale Scale of the log-normal distribution.
+ * @param shape Shape of the log-normal distribution.
*/
public BoxMullerLogNormalSampler(UniformRandomProvider rng,
double scale,
double shape) {
- super(null); // Not used.
- this.scale = scale;
- this.shape = shape;
- gaussian = new BoxMullerNormalizedGaussianSampler(rng);
- }
-
- /** {@inheritDoc} */
- @Override
- public double sample() {
- return Math.exp(scale + shape * gaussian.sample());
- }
-
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return "Box-Muller Log Normal [" + gaussian.toString() + "]";
+ super(new BoxMullerNormalizedGaussianSampler(rng),
+ scale, shape);
}
}
[5/8] commons-rng git commit: RNG-43: Deprecate obsolete class.
Posted by er...@apache.org.
RNG-43: Deprecate obsolete class.
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/cc9aeef3
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/cc9aeef3
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/cc9aeef3
Branch: refs/heads/master
Commit: cc9aeef3fdf7efa58d66f66136b7c8a64141b366
Parents: c76bd30
Author: Gilles <er...@apache.org>
Authored: Wed Jan 10 17:41:11 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Wed Jan 10 17:41:11 2018 +0100
----------------------------------------------------------------------
.../rng/sampling/distribution/BoxMullerLogNormalSampler.java | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/cc9aeef3/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/BoxMullerLogNormalSampler.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/BoxMullerLogNormalSampler.java b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/BoxMullerLogNormalSampler.java
index 1db0b7c..373fb91 100644
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/BoxMullerLogNormalSampler.java
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/BoxMullerLogNormalSampler.java
@@ -22,7 +22,10 @@ import org.apache.commons.rng.UniformRandomProvider;
* Sampling from a <a href="https://en.wikipedia.org/wiki/Log-normal_distribution">
* log-normal distribution</a>.
* Uses {@link BoxMullerNormalizedGaussianSampler} as the underlying sampler.
+ *
+ * {@deprecated} since 1.1. Please use {@link LogNormalSampler} instead.
*/
+@Deprecated
public class BoxMullerLogNormalSampler
extends LogNormalSampler {
/**
[6/8] commons-rng git commit: RNG-43: Update unit test.
Posted by er...@apache.org.
RNG-43: Update unit test.
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/7467b1d8
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/7467b1d8
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/7467b1d8
Branch: refs/heads/master
Commit: 7467b1d83bb35b040009b91ec09289bdbea0363f
Parents: cc9aeef
Author: Gilles <er...@apache.org>
Authored: Wed Jan 10 17:42:26 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Wed Jan 10 17:42:26 2018 +0100
----------------------------------------------------------------------
.../distribution/ContinuousSamplersList.java | 17 +++++++++++++----
1 file changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/7467b1d8/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
index bf6e925..527758d 100644
--- a/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
+++ b/commons-rng-sampling/src/test/java/org/apache/commons/rng/sampling/distribution/ContinuousSamplersList.java
@@ -134,16 +134,25 @@ public class ContinuousSamplersList {
RandomSource.create(RandomSource.TWO_CMRES));
// Log normal ("inverse method").
- final double scaleLogNormal = 23.45;
+ final double scaleLogNormal = 2.345;
final double shapeLogNormal = 0.1234;
add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(scaleLogNormal, shapeLogNormal),
RandomSource.create(RandomSource.KISS));
- // Log normal ("Box-Muller").
+ // Log-normal (DEPRECATED "Box-Muller").
add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(scaleLogNormal, shapeLogNormal),
new BoxMullerLogNormalSampler(RandomSource.create(RandomSource.XOR_SHIFT_1024_S), scaleLogNormal, shapeLogNormal));
- // Log normal ("Marsaglia").
+ // Log-normal ("Box-Muller").
add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(scaleLogNormal, shapeLogNormal),
- new MarsagliaLogNormalSampler(RandomSource.create(RandomSource.MT_64), scaleLogNormal, shapeLogNormal));
+ new LogNormalSampler(new BoxMullerNormalizedGaussianSampler(RandomSource.create(RandomSource.XOR_SHIFT_1024_S)),
+ scaleLogNormal, shapeLogNormal));
+ // Log-normal ("Marsaglia").
+ add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(scaleLogNormal, shapeLogNormal),
+ new LogNormalSampler(new MarsagliaNormalizedGaussianSampler(RandomSource.create(RandomSource.MT_64)),
+ scaleLogNormal, shapeLogNormal));
+ // Log-normal ("Ziggurat").
+ add(LIST, new org.apache.commons.math3.distribution.LogNormalDistribution(scaleLogNormal, shapeLogNormal),
+ new LogNormalSampler(new ZigguratNormalizedGaussianSampler(RandomSource.create(RandomSource.MWC_256)),
+ scaleLogNormal, shapeLogNormal));
// Logistic ("inverse method").
final double muLogistic = -123.456;
[3/8] commons-rng git commit: RNG-43: Delete unneeded class.
Posted by er...@apache.org.
RNG-43: Delete unneeded class.
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/adcf0c57
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/adcf0c57
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/adcf0c57
Branch: refs/heads/master
Commit: adcf0c578c662598c330dbba0359104dd151235e
Parents: 7583d9e
Author: Gilles <er...@apache.org>
Authored: Wed Jan 10 17:31:45 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Wed Jan 10 17:31:45 2018 +0100
----------------------------------------------------------------------
.../distribution/MarsagliaLogNormalSampler.java | 62 --------------------
1 file changed, 62 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/adcf0c57/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/MarsagliaLogNormalSampler.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/MarsagliaLogNormalSampler.java b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/MarsagliaLogNormalSampler.java
deleted file mode 100644
index 885aeb9..0000000
--- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/MarsagliaLogNormalSampler.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.rng.sampling.distribution;
-
-import org.apache.commons.rng.UniformRandomProvider;
-
-/**
- * <a href="https://en.wikipedia.org/wiki/Marsaglia_polar_method">
- * polar method</a> for sampling from a Log normal distribution.
- *
- * @since 1.1
- */
-public class MarsagliaLogNormalSampler
- extends SamplerBase
- implements ContinuousSampler {
- /** Scale. */
- private final double scale;
- /** Shape. */
- private final double shape;
- /** Gaussian sampling. */
- private final NormalizedGaussianSampler gaussian;
-
- /**
- * @param rng Generator of uniformly distributed random numbers.
- * @param scale Scale of the Log normal distribution.
- * @param shape Shape of the Log normal distribution.
- */
- public MarsagliaLogNormalSampler(UniformRandomProvider rng,
- double scale,
- double shape) {
- super(null); // Not used.
- this.scale = scale;
- this.shape = shape;
- gaussian = new MarsagliaNormalizedGaussianSampler(rng);
- }
-
- /** {@inheritDoc} */
- @Override
- public double sample() {
- return Math.exp(scale + shape * gaussian.sample());
- }
-
- /** {@inheritDoc} */
- @Override
- public String toString() {
- return "Marsaglia Log Normal [" + gaussian.toString() + "]";
- }
-}
[2/8] commons-rng git commit: RNG-43: Log-normal sampler.
Posted by er...@apache.org.
RNG-43: Log-normal sampler.
Class allows to choose the underlying Gaussian sampler.
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/7583d9e2
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/7583d9e2
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/7583d9e2
Branch: refs/heads/master
Commit: 7583d9e2cb2adf378acd31ddc9ba0d1208f9686d
Parents: bb10e98
Author: Gilles <er...@apache.org>
Authored: Wed Jan 10 17:28:18 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Wed Jan 10 17:28:18 2018 +0100
----------------------------------------------------------------------
.../sampling/distribution/LogNormalSampler.java | 56 ++++++++++++++++++++
1 file changed, 56 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/7583d9e2/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/LogNormalSampler.java
----------------------------------------------------------------------
diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/LogNormalSampler.java b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/LogNormalSampler.java
new file mode 100644
index 0000000..07d3b30
--- /dev/null
+++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/LogNormalSampler.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.rng.sampling.distribution;
+
+/**
+ * Sampling from a log-normal distribution.
+ *
+ * @since 1.1
+ */
+public class LogNormalSampler implements ContinuousSampler {
+ /** Scale. */
+ private final double scale;
+ /** Shape. */
+ private final double shape;
+ /** Gaussian sampling. */
+ private final NormalizedGaussianSampler gaussian;
+
+ /**
+ * @param gaussian N(0,1) generator.
+ * @param scale Scale of the log-normal distribution.
+ * @param shape Shape of the log-normal distribution.
+ */
+ public LogNormalSampler(NormalizedGaussianSampler gaussian,
+ double scale,
+ double shape) {
+ this.scale = scale;
+ this.shape = shape;
+ this.gaussian = gaussian;
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public double sample() {
+ return Math.exp(scale + shape * gaussian.sample());
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ public String toString() {
+ return "Log-normal deviate [" + gaussian.toString() + "]";
+ }
+}
[7/8] commons-rng git commit: Remove unneeded or deprecated classes.
Posted by er...@apache.org.
Remove unneeded or deprecated classes.
Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/4d83aacb
Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/4d83aacb
Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/4d83aacb
Branch: refs/heads/master
Commit: 4d83aacba2a5aa3fd09b9ed3037202a483a16146
Parents: 7467b1d
Author: Gilles <er...@apache.org>
Authored: Wed Jan 10 18:22:46 2018 +0100
Committer: Gilles <er...@apache.org>
Committed: Wed Jan 10 18:22:46 2018 +0100
----------------------------------------------------------------------
.../jmh/distribution/SamplersPerformance.java | 28 +++++++++-----------
1 file changed, 13 insertions(+), 15 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/commons-rng/blob/4d83aacb/commons-rng-jmh/src/main/java/org/apache/commons/rng/jmh/distribution/SamplersPerformance.java
----------------------------------------------------------------------
diff --git a/commons-rng-jmh/src/main/java/org/apache/commons/rng/jmh/distribution/SamplersPerformance.java b/commons-rng-jmh/src/main/java/org/apache/commons/rng/jmh/distribution/SamplersPerformance.java
index ba50f3a..37ca30a 100644
--- a/commons-rng-jmh/src/main/java/org/apache/commons/rng/jmh/distribution/SamplersPerformance.java
+++ b/commons-rng-jmh/src/main/java/org/apache/commons/rng/jmh/distribution/SamplersPerformance.java
@@ -35,14 +35,12 @@ import org.apache.commons.rng.UniformRandomProvider;
import org.apache.commons.rng.simple.RandomSource;
import org.apache.commons.rng.sampling.distribution.ContinuousSampler;
import org.apache.commons.rng.sampling.distribution.DiscreteSampler;
-import org.apache.commons.rng.sampling.distribution.BoxMullerGaussianSampler;
import org.apache.commons.rng.sampling.distribution.BoxMullerNormalizedGaussianSampler;
import org.apache.commons.rng.sampling.distribution.MarsagliaNormalizedGaussianSampler;
import org.apache.commons.rng.sampling.distribution.ZigguratNormalizedGaussianSampler;
import org.apache.commons.rng.sampling.distribution.AhrensDieterExponentialSampler;
import org.apache.commons.rng.sampling.distribution.AhrensDieterMarsagliaTsangGammaSampler;
-import org.apache.commons.rng.sampling.distribution.BoxMullerLogNormalSampler;
-import org.apache.commons.rng.sampling.distribution.MarsagliaLogNormalSampler;
+import org.apache.commons.rng.sampling.distribution.LogNormalSampler;
import org.apache.commons.rng.sampling.distribution.ChengBetaSampler;
import org.apache.commons.rng.sampling.distribution.ContinuousUniformSampler;
import org.apache.commons.rng.sampling.distribution.DiscreteUniformSampler;
@@ -139,16 +137,6 @@ public class SamplersPerformance {
* @param bh Data sink.
*/
@Benchmark
- public void runBoxMullerGaussianSampler(Sources sources,
- Blackhole bh) {
- runSample(new BoxMullerGaussianSampler(sources.getGenerator(), 0, 1), bh);
- }
-
- /**
- * @param sources Source of randomness.
- * @param bh Data sink.
- */
- @Benchmark
public void runBoxMullerNormalizedGaussianSampler(Sources sources,
Blackhole bh) {
runSample(new BoxMullerNormalizedGaussianSampler(sources.getGenerator()), bh);
@@ -201,7 +189,7 @@ public class SamplersPerformance {
@Benchmark
public void runBoxMullerLogNormalSampler(Sources sources,
Blackhole bh) {
- runSample(new BoxMullerLogNormalSampler(sources.getGenerator(), 12.3, 4.6), bh);
+ runSample(new LogNormalSampler(new BoxMullerNormalizedGaussianSampler(sources.getGenerator()), 12.3, 4.6), bh);
}
/**
@@ -211,7 +199,17 @@ public class SamplersPerformance {
@Benchmark
public void runMarsagliaLogNormalSampler(Sources sources,
Blackhole bh) {
- runSample(new MarsagliaLogNormalSampler(sources.getGenerator(), 12.3, 4.6), bh);
+ runSample(new LogNormalSampler(new MarsagliaNormalizedGaussianSampler(sources.getGenerator()), 12.3, 4.6), bh);
+ }
+
+ /**
+ * @param sources Source of randomness.
+ * @param bh Data sink.
+ */
+ @Benchmark
+ public void runZigguratLogNormalSampler(Sources sources,
+ Blackhole bh) {
+ runSample(new LogNormalSampler(new ZigguratNormalizedGaussianSampler(sources.getGenerator()), 12.3, 4.6), bh);
}
/**