You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tn...@apache.org on 2013/09/03 22:39:00 UTC

svn commit: r1519842 - in /commons/proper/math/trunk/src: changes/ main/java/org/apache/commons/math3/distribution/

Author: tn
Date: Tue Sep  3 20:38:59 2013
New Revision: 1519842

URL: http://svn.apache.org/r1519842
Log:
[MATH-1018] Added overloaded constructors which do not require an explicit inverseCumulativeAccuracy parameter, the default one will be used instead.

Modified:
    commons/proper/math/trunk/src/changes/changes.xml
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/BetaDistribution.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/CauchyDistribution.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/ChiSquaredDistribution.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/ExponentialDistribution.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/FDistribution.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/GammaDistribution.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/LogNormalDistribution.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/NormalDistribution.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/ParetoDistribution.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/TDistribution.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/WeibullDistribution.java

Modified: commons/proper/math/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/changes/changes.xml?rev=1519842&r1=1519841&r2=1519842&view=diff
==============================================================================
--- commons/proper/math/trunk/src/changes/changes.xml (original)
+++ commons/proper/math/trunk/src/changes/changes.xml Tue Sep  3 20:38:59 2013
@@ -51,6 +51,11 @@ If the output is not quite correct, chec
   </properties>
   <body>
     <release version="x.y" date="TBD" description="TBD">
+      <action dev="tn" type="add" issue="MATH-1018" due-to="Ajo Fod">
+        Added overloaded constructors for subclasses of "RealDistribution" implementations
+        which do not require an explicit "inverseCumulativeAccuracy". The default accuracy will
+        be used instead.
+      </action>
       <action dev="tn" type="add" issue="MATH-1001" due-to="sebb">
         Added overloaded methods for "Frequency#incrementValue(Comparable, long)" with
         int, long and char primitive arguments.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/BetaDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/BetaDistribution.java?rev=1519842&r1=1519841&r2=1519842&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/BetaDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/BetaDistribution.java Tue Sep  3 20:38:59 2013
@@ -80,6 +80,18 @@ public class BetaDistribution extends Ab
      * @param rng Random number generator.
      * @param alpha First shape parameter (must be positive).
      * @param beta Second shape parameter (must be positive).
+     * @since 3.3
+     */
+    public BetaDistribution(RandomGenerator rng, double alpha, double beta) {
+        this(rng, alpha, beta, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
+    }
+
+    /**
+     * Creates a &beta; distribution.
+     *
+     * @param rng Random number generator.
+     * @param alpha First shape parameter (must be positive).
+     * @param beta Second shape parameter (must be positive).
      * @param inverseCumAccuracy Maximum absolute error in inverse
      * cumulative probability estimates (defaults to
      * {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/CauchyDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/CauchyDistribution.java?rev=1519842&r1=1519841&r2=1519842&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/CauchyDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/CauchyDistribution.java Tue Sep  3 20:38:59 2013
@@ -86,6 +86,19 @@ public class CauchyDistribution extends 
      * @param rng Random number generator.
      * @param median Median for this distribution.
      * @param scale Scale parameter for this distribution.
+     * @throws NotStrictlyPositiveException if {@code scale <= 0}.
+     * @since 3.3
+     */
+    public CauchyDistribution(RandomGenerator rng, double median, double scale) {
+        this(rng, median, scale, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
+    }
+
+    /**
+     * Creates a Cauchy distribution.
+     *
+     * @param rng Random number generator.
+     * @param median Median for this distribution.
+     * @param scale Scale parameter for this distribution.
      * @param inverseCumAccuracy Maximum absolute error in inverse
      * cumulative probability estimates
      * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/ChiSquaredDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/ChiSquaredDistribution.java?rev=1519842&r1=1519841&r2=1519842&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/ChiSquaredDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/ChiSquaredDistribution.java Tue Sep  3 20:38:59 2013
@@ -64,6 +64,17 @@ public class ChiSquaredDistribution exte
     }
 
     /**
+     * Create a Chi-Squared distribution with the given degrees of freedom.
+     *
+     * @param rng Random number generator.
+     * @param degreesOfFreedom Degrees of freedom.
+     * @since 3.3
+     */
+    public ChiSquaredDistribution(RandomGenerator rng, double degreesOfFreedom) {
+        this(rng, degreesOfFreedom, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
+    }
+
+    /**
      * Create a Chi-Squared distribution with the given degrees of freedom and
      * inverse cumulative probability accuracy.
      *

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/ExponentialDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/ExponentialDistribution.java?rev=1519842&r1=1519841&r2=1519842&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/ExponentialDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/ExponentialDistribution.java Tue Sep  3 20:38:59 2013
@@ -115,6 +115,19 @@ public class ExponentialDistribution ext
      *
      * @param rng Random number generator.
      * @param mean Mean of this distribution.
+     * @throws NotStrictlyPositiveException if {@code mean <= 0}.
+     * @since 3.3
+     */
+    public ExponentialDistribution(RandomGenerator rng, double mean)
+        throws NotStrictlyPositiveException {
+        this(rng, mean, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
+    }
+
+    /**
+     * Creates an exponential distribution.
+     *
+     * @param rng Random number generator.
+     * @param mean Mean of this distribution.
      * @param inverseCumAccuracy Maximum absolute error in inverse
      * cumulative probability estimates (defaults to
      * {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/FDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/FDistribution.java?rev=1519842&r1=1519841&r2=1519842&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/FDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/FDistribution.java Tue Sep  3 20:38:59 2013
@@ -93,10 +93,26 @@ public class FDistribution extends Abstr
      * @param rng Random number generator.
      * @param numeratorDegreesOfFreedom Numerator degrees of freedom.
      * @param denominatorDegreesOfFreedom Denominator degrees of freedom.
+     * @throws NotStrictlyPositiveException if {@code numeratorDegreesOfFreedom <= 0} or
+     * {@code denominatorDegreesOfFreedom <= 0}.
+     * @since 3.3
+     */
+    public FDistribution(RandomGenerator rng,
+                         double numeratorDegreesOfFreedom,
+                         double denominatorDegreesOfFreedom)
+        throws NotStrictlyPositiveException {
+        this(rng, numeratorDegreesOfFreedom, denominatorDegreesOfFreedom, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
+    }
+
+    /**
+     * Creates an F distribution.
+     *
+     * @param rng Random number generator.
+     * @param numeratorDegreesOfFreedom Numerator degrees of freedom.
+     * @param denominatorDegreesOfFreedom Denominator degrees of freedom.
      * @param inverseCumAccuracy the maximum absolute error in inverse
      * cumulative probability estimates.
-     * @throws NotStrictlyPositiveException if
-     * {@code numeratorDegreesOfFreedom <= 0} or
+     * @throws NotStrictlyPositiveException if {@code numeratorDegreesOfFreedom <= 0} or
      * {@code denominatorDegreesOfFreedom <= 0}.
      * @since 3.1
      */

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/GammaDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/GammaDistribution.java?rev=1519842&r1=1519841&r2=1519842&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/GammaDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/GammaDistribution.java Tue Sep  3 20:38:59 2013
@@ -117,6 +117,21 @@ public class GammaDistribution extends A
      * @param rng Random number generator.
      * @param shape the shape parameter
      * @param scale the scale parameter
+     * @throws NotStrictlyPositiveException if {@code shape <= 0} or
+     * {@code scale <= 0}.
+     * @since 3.3
+     */
+    public GammaDistribution(RandomGenerator rng, double shape, double scale)
+        throws NotStrictlyPositiveException {
+        this(rng, shape, scale, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
+    }
+
+    /**
+     * Creates a Gamma distribution.
+     *
+     * @param rng Random number generator.
+     * @param shape the shape parameter
+     * @param scale the scale parameter
      * @param inverseCumAccuracy the maximum absolute error in inverse
      * cumulative probability estimates (defaults to
      * {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/LogNormalDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/LogNormalDistribution.java?rev=1519842&r1=1519841&r2=1519842&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/LogNormalDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/LogNormalDistribution.java Tue Sep  3 20:38:59 2013
@@ -118,6 +118,20 @@ public class LogNormalDistribution exten
      * @param rng Random number generator.
      * @param scale Scale parameter of this distribution.
      * @param shape Shape parameter of this distribution.
+     * @throws NotStrictlyPositiveException if {@code shape <= 0}.
+     * @since 3.3
+     */
+    public LogNormalDistribution(RandomGenerator rng, double scale, double shape)
+        throws NotStrictlyPositiveException {
+        this(rng, scale, shape, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
+    }
+
+    /**
+     * Creates a log-normal distribution.
+     *
+     * @param rng Random number generator.
+     * @param scale Scale parameter of this distribution.
+     * @param shape Shape parameter of this distribution.
      * @param inverseCumAccuracy Inverse cumulative probability accuracy.
      * @throws NotStrictlyPositiveException if {@code shape <= 0}.
      * @since 3.1

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/NormalDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/NormalDistribution.java?rev=1519842&r1=1519841&r2=1519842&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/NormalDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/NormalDistribution.java Tue Sep  3 20:38:59 2013
@@ -93,6 +93,20 @@ public class NormalDistribution extends 
      * @param rng Random number generator.
      * @param mean Mean for this distribution.
      * @param sd Standard deviation for this distribution.
+     * @throws NotStrictlyPositiveException if {@code sd <= 0}.
+     * @since 3.3
+     */
+    public NormalDistribution(RandomGenerator rng, double mean, double sd)
+        throws NotStrictlyPositiveException {
+        this(rng, mean, sd, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
+    }
+
+    /**
+     * Creates a normal distribution.
+     *
+     * @param rng Random number generator.
+     * @param mean Mean for this distribution.
+     * @param sd Standard deviation for this distribution.
      * @param inverseCumAccuracy Inverse cumulative probability accuracy.
      * @throws NotStrictlyPositiveException if {@code sd <= 0}.
      * @since 3.1

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/ParetoDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/ParetoDistribution.java?rev=1519842&r1=1519841&r2=1519842&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/ParetoDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/ParetoDistribution.java Tue Sep  3 20:38:59 2013
@@ -103,6 +103,19 @@ public class ParetoDistribution extends 
      * @param rng Random number generator.
      * @param scale Scale parameter of this distribution.
      * @param shape Shape parameter of this distribution.
+     * @throws NotStrictlyPositiveException if {@code scale <= 0} or {@code shape <= 0}.
+     */
+    public ParetoDistribution(RandomGenerator rng, double scale, double shape)
+        throws NotStrictlyPositiveException {
+        this(rng, scale, shape, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
+    }
+
+    /**
+     * Creates a log-normal distribution.
+     *
+     * @param rng Random number generator.
+     * @param scale Scale parameter of this distribution.
+     * @param shape Shape parameter of this distribution.
      * @param inverseCumAccuracy Inverse cumulative probability accuracy.
      * @throws NotStrictlyPositiveException if {@code scale <= 0} or {@code shape <= 0}.
      */

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/TDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/TDistribution.java?rev=1519842&r1=1519841&r2=1519842&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/TDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/TDistribution.java Tue Sep  3 20:38:59 2013
@@ -76,6 +76,19 @@ public class TDistribution extends Abstr
      *
      * @param rng Random number generator.
      * @param degreesOfFreedom Degrees of freedom.
+     * @throws NotStrictlyPositiveException if {@code degreesOfFreedom <= 0}
+     * @since 3.3
+     */
+    public TDistribution(RandomGenerator rng, double degreesOfFreedom)
+        throws NotStrictlyPositiveException {
+        this(rng, degreesOfFreedom, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
+    }
+
+    /**
+     * Creates a t distribution.
+     *
+     * @param rng Random number generator.
+     * @param degreesOfFreedom Degrees of freedom.
      * @param inverseCumAccuracy the maximum absolute error in inverse
      * cumulative probability estimates
      * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/WeibullDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/WeibullDistribution.java?rev=1519842&r1=1519841&r2=1519842&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/WeibullDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/distribution/WeibullDistribution.java Tue Sep  3 20:38:59 2013
@@ -97,11 +97,24 @@ public class WeibullDistribution extends
      * @param rng Random number generator.
      * @param alpha Shape parameter.
      * @param beta Scale parameter.
+     * @throws NotStrictlyPositiveException if {@code alpha <= 0} or {@code beta <= 0}.
+     * @since 3.3
+     */
+    public WeibullDistribution(RandomGenerator rng, double alpha, double beta)
+        throws NotStrictlyPositiveException {
+        this(rng, alpha, beta, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
+    }
+
+    /**
+     * Creates a Weibull distribution.
+     *
+     * @param rng Random number generator.
+     * @param alpha Shape parameter.
+     * @param beta Scale parameter.
      * @param inverseCumAccuracy Maximum absolute error in inverse
      * cumulative probability estimates
      * (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY}).
-     * @throws NotStrictlyPositiveException if {@code alpha <= 0} or
-     * {@code beta <= 0}.
+     * @throws NotStrictlyPositiveException if {@code alpha <= 0} or {@code beta <= 0}.
      * @since 3.1
      */
     public WeibullDistribution(RandomGenerator rng,