In distribution.AbstractRealDistribution.inverseCumulativeProbability(double), boundary cases (p == 0 and p == 1) are now handled correctly: concrete instances no longer need to override this method, which is removed (MATH-699).

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1210756 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastien Brisard 2011-12-06 02:57:46 +00:00
parent d45a10927e
commit e994c42a8e
6 changed files with 0 additions and 98 deletions

View File

@ -133,18 +133,6 @@ public class BetaDistribution extends AbstractRealDistribution {
}
}
/** {@inheritDoc} */
@Override
public double inverseCumulativeProbability(double p) {
if (p == 0) {
return 0;
} else if (p == 1) {
return 1;
} else {
return super.inverseCumulativeProbability(p);
}
}
/** {@inheritDoc} */
public double cumulativeProbability(double x) {
if (x <= 0) {

View File

@ -91,23 +91,6 @@ public class ChiSquaredDistribution extends AbstractRealDistribution {
return gamma.cumulativeProbability(x);
}
/**
* {@inheritDoc}
*
* Returns {@code 0} when {@code p == 0} and
* {@code Double.POSITIVE_INFINITY} when {@code p == 1}.
*/
@Override
public double inverseCumulativeProbability(final double p) {
if (p == 0) {
return 0d;
}
if (p == 1) {
return Double.POSITIVE_INFINITY;
}
return super.inverseCumulativeProbability(p);
}
/** {@inheritDoc} */
@Override
protected double getSolverAbsoluteAccuracy() {

View File

@ -18,7 +18,6 @@
package org.apache.commons.math.distribution;
import org.apache.commons.math.exception.NotStrictlyPositiveException;
import org.apache.commons.math.exception.OutOfRangeException;
import org.apache.commons.math.exception.util.LocalizedFormats;
import org.apache.commons.math.special.Beta;
import org.apache.commons.math.util.FastMath;
@ -155,23 +154,6 @@ public class FDistribution extends AbstractRealDistribution {
return ret;
}
/**
* {@inheritDoc}
*
* Returns {@code 0} when {@code p == 0} and
* {@code Double.POSITIVE_INFINITY} when {@code p == 1}.
*/
@Override
public double inverseCumulativeProbability(final double p) throws OutOfRangeException {
if (p == 0) {
return 0;
}
if (p == 1) {
return Double.POSITIVE_INFINITY;
}
return super.inverseCumulativeProbability(p);
}
/**
* Access the numerator degrees of freedom.
*

View File

@ -144,23 +144,6 @@ public class GammaDistribution extends AbstractRealDistribution {
return ret;
}
/**
* {@inheritDoc}
*
* Returns {@code 0} when {@code p == 0} and
* {@code Double.POSITIVE_INFINITY} when {@code p == 1}.
*/
@Override
public double inverseCumulativeProbability(final double p) {
if (p == 0) {
return 0;
}
if (p == 1) {
return Double.POSITIVE_INFINITY;
}
return super.inverseCumulativeProbability(p);
}
/** {@inheritDoc} */
@Override
protected double getSolverAbsoluteAccuracy() {

View File

@ -155,23 +155,6 @@ public class NormalDistribution extends AbstractRealDistribution {
return 0.5 * Erf.erf(v0, v1);
}
/**
* {@inheritDoc}
*
* Returns {@code Double.NEGATIVE_INFINITY} when {@code p == 0}
* and {@code Double.POSITIVE_INFINITY} for {@code p == 1}.
*/
@Override
public double inverseCumulativeProbability(final double p) {
if (p == 0) {
return Double.NEGATIVE_INFINITY;
}
if (p == 1) {
return Double.POSITIVE_INFINITY;
}
return super.inverseCumulativeProbability(p);
}
/** {@inheritDoc} */
@Override
protected double getSolverAbsoluteAccuracy() {

View File

@ -126,23 +126,6 @@ public class TDistribution extends AbstractRealDistribution {
return ret;
}
/**
* {@inheritDoc}
*
* Returns {@code Double.NEGATIVE_INFINITY} when {@code p = 0}
* and {@code Double.POSITIVE_INFINITY} when {@code p = 1}.
*/
@Override
public double inverseCumulativeProbability(final double p) {
if (p == 0) {
return Double.NEGATIVE_INFINITY;
}
if (p == 1) {
return Double.POSITIVE_INFINITY;
}
return super.inverseCumulativeProbability(p);
}
/** {@inheritDoc} */
@Override
protected double getSolverAbsoluteAccuracy() {