You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2015/05/04 11:06:24 UTC

[math] Fixed missing javadoc.

Repository: commons-math
Updated Branches:
  refs/heads/MATH_3_X 321269ed9 -> 12675d867


Fixed missing javadoc.

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

Branch: refs/heads/MATH_3_X
Commit: 12675d867b559a9cfb95410052b219fa61c31f93
Parents: 321269e
Author: Luc Maisonobe <lu...@apache.org>
Authored: Mon May 4 11:06:02 2015 +0200
Committer: Luc Maisonobe <lu...@apache.org>
Committed: Mon May 4 11:06:02 2015 +0200

----------------------------------------------------------------------
 .../commons/math3/distribution/BetaDistribution.java  | 14 +++++++++++++-
 .../commons/math3/distribution/ZipfDistribution.java  | 12 +++++++++++-
 2 files changed, 24 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/12675d86/src/main/java/org/apache/commons/math3/distribution/BetaDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/BetaDistribution.java b/src/main/java/org/apache/commons/math3/distribution/BetaDistribution.java
index 944cf3d..204020f 100644
--- a/src/main/java/org/apache/commons/math3/distribution/BetaDistribution.java
+++ b/src/main/java/org/apache/commons/math3/distribution/BetaDistribution.java
@@ -312,6 +312,11 @@ public class BetaDistribution extends AbstractRealDistribution {
 
         /**
          * Returns one sample using Cheng's BB algorithm, when both &alpha; and &beta; are greater than 1.
+         * @param random random generator to use
+         * @param a0 distribution first shape parameter (&alpha;)
+         * @param a min(&alpha;, &beta;) where &alpha;, &beta; are the two distribution shape parameters
+         * @param b max(&alpha;, &beta;) where &alpha;, &beta; are the two distribution shape parameters
+         * @return sampled value
          */
         private static double algorithmBB(RandomGenerator random,
                                           final double a0,
@@ -321,7 +326,9 @@ public class BetaDistribution extends AbstractRealDistribution {
             final double beta = FastMath.sqrt((alpha - 2.) / (2. * a * b - alpha));
             final double gamma = a + 1. / beta;
 
-            double r, w, t;
+            double r;
+            double w;
+            double t;
             do {
                 final double u1 = random.nextDouble();
                 final double u2 = random.nextDouble();
@@ -346,6 +353,11 @@ public class BetaDistribution extends AbstractRealDistribution {
 
         /**
          * Returns one sample using Cheng's BC algorithm, when at least one of &alpha; and &beta; is smaller than 1.
+         * @param random random generator to use
+         * @param a0 distribution first shape parameter (&alpha;)
+         * @param a max(&alpha;, &beta;) where &alpha;, &beta; are the two distribution shape parameters
+         * @param b min(&alpha;, &beta;) where &alpha;, &beta; are the two distribution shape parameters
+         * @return sampled value
          */
         private static double algorithmBC(RandomGenerator random,
                                           final double a0,

http://git-wip-us.apache.org/repos/asf/commons-math/blob/12675d86/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java b/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java
index 3755407..3161293 100644
--- a/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java
+++ b/src/main/java/org/apache/commons/math3/distribution/ZipfDistribution.java
@@ -297,11 +297,20 @@ public class ZipfDistribution extends AbstractIntegerDistribution {
         /** Cached tail weight of instrumental distribution used for rejection sampling */
         private double instrumentalDistributionTailWeight = Double.NaN;
 
+        /**
+         * Simple constructor.
+         * @param numberOfElements number of elements
+         * @param exponent exponent parameter of the distribution
+         */
         ZipfRejectionSampler(final int numberOfElements, final double exponent) {
             this.numberOfElements = numberOfElements;
             this.exponent = exponent;
         }
 
+        /** Generate a random value sampled from this distribution.
+         * @param random random generator to use
+         * @return random value sampled from this distribution
+         */
         int sample(final RandomGenerator random) {
             if (Double.isNaN(instrumentalDistributionTailWeight)) {
                 instrumentalDistributionTailWeight = integratePowerFunction(-exponent, 1.5, numberOfElements+0.5);
@@ -350,7 +359,7 @@ public class ZipfDistribution extends AbstractIntegerDistribution {
          * A Taylor series expansion is used, if x is close to 0.
          *
          * @param q a value in the range [0,1]
-         * @param
+         * @param x free parameter
          * @return log((1-q)+q*exp(x))/x
          */
         static double helper1(final double q, final double x) {
@@ -367,6 +376,7 @@ public class ZipfDistribution extends AbstractIntegerDistribution {
          * <p>
          * A Taylor series expansion is used, if x is close to 0.
          *
+         * @param x free parameter
          * @return (exp(x)-1)/x if x is non-zero, 1 if x=0
          */
         static double helper2(final double x) {