[MATH-1018] Added overloaded constructors which do not require an explicit inverseCumulativeAccuracy parameter, the default one will be used instead.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1519842 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Thomas Neidhart 2013-09-03 20:38:59 +00:00
parent 83b5df5178
commit c4b4a75259
12 changed files with 156 additions and 4 deletions

View File

@ -51,6 +51,11 @@ If the output is not quite correct, check for invisible trailing spaces!
</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.

View File

@ -74,6 +74,18 @@ public class BetaDistribution extends AbstractRealDistribution {
this(new Well19937c(), alpha, beta, inverseCumAccuracy);
}
/**
* 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).
* @since 3.3
*/
public BetaDistribution(RandomGenerator rng, double alpha, double beta) {
this(rng, alpha, beta, DEFAULT_INVERSE_ABSOLUTE_ACCURACY);
}
/**
* Creates a &beta; distribution.
*

View File

@ -80,6 +80,19 @@ public class CauchyDistribution extends AbstractRealDistribution {
this(new Well19937c(), median, scale, inverseCumAccuracy);
}
/**
* Creates a Cauchy distribution.
*
* @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.
*

View File

@ -63,6 +63,17 @@ public class ChiSquaredDistribution extends AbstractRealDistribution {
this(new Well19937c(), degreesOfFreedom, inverseCumAccuracy);
}
/**
* 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.

View File

@ -110,6 +110,19 @@ public class ExponentialDistribution extends AbstractRealDistribution {
this(new Well19937c(), mean, inverseCumAccuracy);
}
/**
* Creates an exponential distribution.
*
* @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.
*

View File

@ -87,6 +87,23 @@ public class FDistribution extends AbstractRealDistribution {
denominatorDegreesOfFreedom, inverseCumAccuracy);
}
/**
* Creates an F distribution.
*
* @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.
*
@ -95,8 +112,7 @@ public class FDistribution extends AbstractRealDistribution {
* @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
*/

View File

@ -111,6 +111,21 @@ public class GammaDistribution extends AbstractRealDistribution {
this(new Well19937c(), shape, scale, inverseCumAccuracy);
}
/**
* Creates a Gamma distribution.
*
* @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.
*

View File

@ -112,6 +112,20 @@ public class LogNormalDistribution extends AbstractRealDistribution {
this(new Well19937c(), scale, shape, inverseCumAccuracy);
}
/**
* Creates a log-normal distribution.
*
* @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.
*

View File

@ -87,6 +87,20 @@ public class NormalDistribution extends AbstractRealDistribution {
this(new Well19937c(), mean, sd, inverseCumAccuracy);
}
/**
* Creates a normal distribution.
*
* @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.
*

View File

@ -97,6 +97,19 @@ public class ParetoDistribution extends AbstractRealDistribution {
this(new Well19937c(), scale, shape, inverseCumAccuracy);
}
/**
* Creates a log-normal distribution.
*
* @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.
*

View File

@ -71,6 +71,19 @@ public class TDistribution extends AbstractRealDistribution {
this(new Well19937c(), degreesOfFreedom, inverseCumAccuracy);
}
/**
* Creates a t distribution.
*
* @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.
*

View File

@ -91,6 +91,20 @@ public class WeibullDistribution extends AbstractRealDistribution {
this(new Well19937c(), alpha, beta, inverseCumAccuracy);
}
/**
* Creates a Weibull distribution.
*
* @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.
*
@ -100,8 +114,7 @@ public class WeibullDistribution extends AbstractRealDistribution {
* @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,