Add missing @Override tags, add final for member variables where applicable.

This commit is contained in:
Thomas Neidhart 2015-03-16 21:24:39 +01:00
parent bfb3cf8bba
commit 9e26d9933a
34 changed files with 213 additions and 4 deletions

View File

@ -59,6 +59,7 @@ public abstract class AbstractIntegerDistribution implements IntegerDistribution
*
* @since 4.0, was previously named cumulativeProbability
*/
@Override
public double probability(int x0, int x1) throws NumberIsTooLargeException {
if (x1 < x0) {
throw new NumberIsTooLargeException(LocalizedFormats.LOWER_ENDPOINT_ABOVE_UPPER_ENDPOINT,
@ -78,6 +79,7 @@ public abstract class AbstractIntegerDistribution implements IntegerDistribution
* {@code 0 < p < 1}.</li>
* </ul>
*/
@Override
public int inverseCumulativeProbability(final double p) throws OutOfRangeException {
if (p < 0.0 || p > 1.0) {
throw new OutOfRangeException(p, 0, 1);
@ -158,6 +160,7 @@ public abstract class AbstractIntegerDistribution implements IntegerDistribution
}
/** {@inheritDoc} */
@Override
public void reseedRandomGenerator(long seed) {
random.setSeed(seed);
}
@ -169,6 +172,7 @@ public abstract class AbstractIntegerDistribution implements IntegerDistribution
* <a href="http://en.wikipedia.org/wiki/Inverse_transform_sampling">
* inversion method</a>.
*/
@Override
public int sample() {
return inverseCumulativeProbability(random.nextDouble());
}
@ -179,6 +183,7 @@ public abstract class AbstractIntegerDistribution implements IntegerDistribution
* The default implementation generates the sample by calling
* {@link #sample()} in a loop.
*/
@Override
public int[] sample(int sampleSize) {
if (sampleSize <= 0) {
throw new NotStrictlyPositiveException(
@ -218,6 +223,7 @@ public abstract class AbstractIntegerDistribution implements IntegerDistribution
* <p>
* The default implementation simply computes the logarithm of {@code probability(x)}.
*/
@Override
public double logProbability(int x) {
return FastMath.log(probability(x));
}

View File

@ -43,19 +43,23 @@ public abstract class AbstractMultivariateRealDistribution
}
/** {@inheritDoc} */
@Override
public void reseedRandomGenerator(long seed) {
random.setSeed(seed);
}
/** {@inheritDoc} */
@Override
public int getDimension() {
return dimension;
}
/** {@inheritDoc} */
@Override
public abstract double[] sample();
/** {@inheritDoc} */
@Override
public double[][] sample(final int sampleSize) {
if (sampleSize <= 0) {
throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,

View File

@ -48,7 +48,7 @@ implements RealDistribution, Serializable {
protected final RandomGenerator random;
/** Solver absolute accuracy for inverse cumulative computation */
private double solverAbsoluteAccuracy = SOLVER_DEFAULT_ABSOLUTE_ACCURACY;
private final double solverAbsoluteAccuracy = SOLVER_DEFAULT_ABSOLUTE_ACCURACY;
/**
* @param rng Random number generator.
@ -74,6 +74,7 @@ implements RealDistribution, Serializable {
*
* @since 3.1
*/
@Override
public double probability(double x0,
double x1) {
if (x0 > x1) {
@ -92,6 +93,7 @@ implements RealDistribution, Serializable {
* <li>{@link #getSupportUpperBound()} for {@code p = 1}.</li>
* </ul>
*/
@Override
public double inverseCumulativeProbability(final double p) throws OutOfRangeException {
/*
* IMPLEMENTATION NOTES
@ -165,6 +167,7 @@ implements RealDistribution, Serializable {
final UnivariateFunction toSolve = new UnivariateFunction() {
@Override
public double value(final double x) {
return cumulativeProbability(x) - p;
}
@ -209,6 +212,7 @@ implements RealDistribution, Serializable {
}
/** {@inheritDoc} */
@Override
public void reseedRandomGenerator(long seed) {
random.setSeed(seed);
}
@ -221,6 +225,7 @@ implements RealDistribution, Serializable {
* inversion method.
* </a>
*/
@Override
public double sample() {
return inverseCumulativeProbability(random.nextDouble());
}
@ -231,6 +236,7 @@ implements RealDistribution, Serializable {
* The default implementation generates the sample by calling
* {@link #sample()} in a loop.
*/
@Override
public double[] sample(int sampleSize) {
if (sampleSize <= 0) {
throw new NotStrictlyPositiveException(LocalizedFormats.NUMBER_OF_SAMPLES,
@ -249,6 +255,7 @@ implements RealDistribution, Serializable {
* @return zero.
* @since 3.1
*/
@Override
public double probability(double x) {
return 0d;
}
@ -258,6 +265,7 @@ implements RealDistribution, Serializable {
* <p>
* The default implementation simply computes the logarithm of {@code density(x)}.
*/
@Override
public double logDensity(double x) {
return FastMath.log(density(x));
}

View File

@ -148,6 +148,7 @@ public class BetaDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double density(double x) {
final double logDensity = logDensity(x);
return logDensity == Double.NEGATIVE_INFINITY ? 0 : FastMath.exp(logDensity);
@ -177,6 +178,7 @@ public class BetaDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double cumulativeProbability(double x) {
if (x <= 0) {
return 0;
@ -205,6 +207,7 @@ public class BetaDistribution extends AbstractRealDistribution {
* For first shape parameter {@code alpha} and second shape parameter
* {@code beta}, the mean is {@code alpha / (alpha + beta)}.
*/
@Override
public double getNumericalMean() {
final double a = getAlpha();
return a / (a + getBeta());
@ -217,6 +220,7 @@ public class BetaDistribution extends AbstractRealDistribution {
* {@code beta}, the variance is
* {@code (alpha * beta) / [(alpha + beta)^2 * (alpha + beta + 1)]}.
*/
@Override
public double getNumericalVariance() {
final double a = getAlpha();
final double b = getBeta();
@ -231,6 +235,7 @@ public class BetaDistribution extends AbstractRealDistribution {
*
* @return lower bound of the support (always 0)
*/
@Override
public double getSupportLowerBound() {
return 0;
}
@ -242,6 +247,7 @@ public class BetaDistribution extends AbstractRealDistribution {
*
* @return upper bound of the support (always 1)
*/
@Override
public double getSupportUpperBound() {
return 1;
}
@ -253,6 +259,7 @@ public class BetaDistribution extends AbstractRealDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -104,6 +104,7 @@ public class BinomialDistribution extends AbstractIntegerDistribution {
}
/** {@inheritDoc} */
@Override
public double probability(int x) {
final double logProbability = logProbability(x);
return logProbability == Double.NEGATIVE_INFINITY ? 0 : FastMath.exp(logProbability);
@ -127,6 +128,7 @@ public class BinomialDistribution extends AbstractIntegerDistribution {
}
/** {@inheritDoc} */
@Override
public double cumulativeProbability(int x) {
double ret;
if (x < 0) {
@ -146,6 +148,7 @@ public class BinomialDistribution extends AbstractIntegerDistribution {
* For {@code n} trials and probability parameter {@code p}, the mean is
* {@code n * p}.
*/
@Override
public double getNumericalMean() {
return numberOfTrials * probabilityOfSuccess;
}
@ -156,6 +159,7 @@ public class BinomialDistribution extends AbstractIntegerDistribution {
* For {@code n} trials and probability parameter {@code p}, the variance is
* {@code n * p * (1 - p)}.
*/
@Override
public double getNumericalVariance() {
final double p = probabilityOfSuccess;
return numberOfTrials * p * (1 - p);
@ -169,6 +173,7 @@ public class BinomialDistribution extends AbstractIntegerDistribution {
*
* @return lower bound of the support (0 or the number of trials)
*/
@Override
public int getSupportLowerBound() {
return probabilityOfSuccess < 1.0 ? 0 : numberOfTrials;
}
@ -181,6 +186,7 @@ public class BinomialDistribution extends AbstractIntegerDistribution {
*
* @return upper bound of the support (number of trials or 0)
*/
@Override
public int getSupportUpperBound() {
return probabilityOfSuccess > 0.0 ? numberOfTrials : 0;
}
@ -192,6 +198,7 @@ public class BinomialDistribution extends AbstractIntegerDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -132,6 +132,7 @@ public class CauchyDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double cumulativeProbability(double x) {
return 0.5 + (FastMath.atan((x - median) / scale) / FastMath.PI);
}
@ -155,6 +156,7 @@ public class CauchyDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double density(double x) {
final double dev = x - median;
return (1 / FastMath.PI) * (scale / (dev * dev + scale * scale));
@ -194,6 +196,7 @@ public class CauchyDistribution extends AbstractRealDistribution {
*
* @return mean (always Double.NaN)
*/
@Override
public double getNumericalMean() {
return Double.NaN;
}
@ -205,6 +208,7 @@ public class CauchyDistribution extends AbstractRealDistribution {
*
* @return variance (always Double.NaN)
*/
@Override
public double getNumericalVariance() {
return Double.NaN;
}
@ -217,6 +221,7 @@ public class CauchyDistribution extends AbstractRealDistribution {
*
* @return lower bound of the support (always Double.NEGATIVE_INFINITY)
*/
@Override
public double getSupportLowerBound() {
return Double.NEGATIVE_INFINITY;
}
@ -229,6 +234,7 @@ public class CauchyDistribution extends AbstractRealDistribution {
*
* @return upper bound of the support (always Double.POSITIVE_INFINITY)
*/
@Override
public double getSupportUpperBound() {
return Double.POSITIVE_INFINITY;
}
@ -240,6 +246,7 @@ public class CauchyDistribution extends AbstractRealDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -110,6 +110,7 @@ public class ChiSquaredDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double density(double x) {
return gamma.density(x);
}
@ -121,6 +122,7 @@ public class ChiSquaredDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double cumulativeProbability(double x) {
return gamma.cumulativeProbability(x);
}
@ -136,6 +138,7 @@ public class ChiSquaredDistribution extends AbstractRealDistribution {
*
* For {@code k} degrees of freedom, the mean is {@code k}.
*/
@Override
public double getNumericalMean() {
return getDegreesOfFreedom();
}
@ -145,6 +148,7 @@ public class ChiSquaredDistribution extends AbstractRealDistribution {
*
* @return {@code 2 * k}, where {@code k} is the number of degrees of freedom.
*/
@Override
public double getNumericalVariance() {
return 2 * getDegreesOfFreedom();
}
@ -157,6 +161,7 @@ public class ChiSquaredDistribution extends AbstractRealDistribution {
*
* @return zero.
*/
@Override
public double getSupportLowerBound() {
return 0;
}
@ -169,6 +174,7 @@ public class ChiSquaredDistribution extends AbstractRealDistribution {
*
* @return {@code Double.POSITIVE_INFINITY}.
*/
@Override
public double getSupportUpperBound() {
return Double.POSITIVE_INFINITY;
}
@ -180,6 +186,7 @@ public class ChiSquaredDistribution extends AbstractRealDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -43,11 +43,13 @@ public class ConstantRealDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double density(double x) {
return x == value ? 1 : 0;
}
/** {@inheritDoc} */
@Override
public double cumulativeProbability(double x) {
return x < value ? 0 : 1;
}
@ -64,6 +66,7 @@ public class ConstantRealDistribution extends AbstractRealDistribution {
/**
* {@inheritDoc}
*/
@Override
public double getNumericalMean() {
return value;
}
@ -71,6 +74,7 @@ public class ConstantRealDistribution extends AbstractRealDistribution {
/**
* {@inheritDoc}
*/
@Override
public double getNumericalVariance() {
return 0;
}
@ -78,6 +82,7 @@ public class ConstantRealDistribution extends AbstractRealDistribution {
/**
* {@inheritDoc}
*/
@Override
public double getSupportLowerBound() {
return value;
}
@ -85,6 +90,7 @@ public class ConstantRealDistribution extends AbstractRealDistribution {
/**
* {@inheritDoc}
*/
@Override
public double getSupportUpperBound() {
return value;
}
@ -92,6 +98,7 @@ public class ConstantRealDistribution extends AbstractRealDistribution {
/**
* {@inheritDoc}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -110,6 +110,7 @@ public class EnumeratedIntegerDistribution extends AbstractIntegerDistribution {
/**
* {@inheritDoc}
*/
@Override
public double probability(final int x) {
return innerDistribution.probability(x);
}
@ -117,6 +118,7 @@ public class EnumeratedIntegerDistribution extends AbstractIntegerDistribution {
/**
* {@inheritDoc}
*/
@Override
public double cumulativeProbability(final int x) {
double probability = 0;
@ -134,6 +136,7 @@ public class EnumeratedIntegerDistribution extends AbstractIntegerDistribution {
*
* @return {@code sum(singletons[i] * probabilities[i])}
*/
@Override
public double getNumericalMean() {
double mean = 0;
@ -149,6 +152,7 @@ public class EnumeratedIntegerDistribution extends AbstractIntegerDistribution {
*
* @return {@code sum((singletons[i] - mean) ^ 2 * probabilities[i])}
*/
@Override
public double getNumericalVariance() {
double mean = 0;
double meanOfSquares = 0;
@ -168,6 +172,7 @@ public class EnumeratedIntegerDistribution extends AbstractIntegerDistribution {
*
* @return the lowest value with non-zero probability.
*/
@Override
public int getSupportLowerBound() {
int min = Integer.MAX_VALUE;
for (final Pair<Integer, Double> sample : innerDistribution.getPmf()) {
@ -186,6 +191,7 @@ public class EnumeratedIntegerDistribution extends AbstractIntegerDistribution {
*
* @return the highest value with non-zero probability.
*/
@Override
public int getSupportUpperBound() {
int max = Integer.MIN_VALUE;
for (final Pair<Integer, Double> sample : innerDistribution.getPmf()) {
@ -204,6 +210,7 @@ public class EnumeratedIntegerDistribution extends AbstractIntegerDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -125,6 +125,7 @@ public class EnumeratedRealDistribution extends AbstractRealDistribution {
* @param x the point at which the PMF is evaluated
* @return the value of the probability mass function at point {@code x}
*/
@Override
public double density(final double x) {
return probability(x);
}
@ -132,6 +133,7 @@ public class EnumeratedRealDistribution extends AbstractRealDistribution {
/**
* {@inheritDoc}
*/
@Override
public double cumulativeProbability(final double x) {
double probability = 0;
@ -176,6 +178,7 @@ public class EnumeratedRealDistribution extends AbstractRealDistribution {
*
* @return {@code sum(singletons[i] * probabilities[i])}
*/
@Override
public double getNumericalMean() {
double mean = 0;
@ -191,6 +194,7 @@ public class EnumeratedRealDistribution extends AbstractRealDistribution {
*
* @return {@code sum((singletons[i] - mean) ^ 2 * probabilities[i])}
*/
@Override
public double getNumericalVariance() {
double mean = 0;
double meanOfSquares = 0;
@ -210,6 +214,7 @@ public class EnumeratedRealDistribution extends AbstractRealDistribution {
*
* @return the lowest value with non-zero probability.
*/
@Override
public double getSupportLowerBound() {
double min = Double.POSITIVE_INFINITY;
for (final Pair<Double, Double> sample : innerDistribution.getPmf()) {
@ -228,6 +233,7 @@ public class EnumeratedRealDistribution extends AbstractRealDistribution {
*
* @return the highest value with non-zero probability.
*/
@Override
public double getSupportUpperBound() {
double max = Double.NEGATIVE_INFINITY;
for (final Pair<Double, Double> sample : innerDistribution.getPmf()) {
@ -246,6 +252,7 @@ public class EnumeratedRealDistribution extends AbstractRealDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -174,6 +174,7 @@ public class ExponentialDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double density(double x) {
final double logDensity = logDensity(x);
return logDensity == Double.NEGATIVE_INFINITY ? 0 : FastMath.exp(logDensity);
@ -198,6 +199,7 @@ public class ExponentialDistribution extends AbstractRealDistribution {
* Exponential Distribution</a>, equation (1).</li>
* </ul>
*/
@Override
public double cumulativeProbability(double x) {
double ret;
if (x <= 0.0) {
@ -291,6 +293,7 @@ public class ExponentialDistribution extends AbstractRealDistribution {
*
* For mean parameter {@code k}, the mean is {@code k}.
*/
@Override
public double getNumericalMean() {
return getMean();
}
@ -300,6 +303,7 @@ public class ExponentialDistribution extends AbstractRealDistribution {
*
* For mean parameter {@code k}, the variance is {@code k^2}.
*/
@Override
public double getNumericalVariance() {
final double m = getMean();
return m * m;
@ -312,6 +316,7 @@ public class ExponentialDistribution extends AbstractRealDistribution {
*
* @return lower bound of the support (always 0)
*/
@Override
public double getSupportLowerBound() {
return 0;
}
@ -324,6 +329,7 @@ public class ExponentialDistribution extends AbstractRealDistribution {
*
* @return upper bound of the support (always Double.POSITIVE_INFINITY)
*/
@Override
public double getSupportUpperBound() {
return Double.POSITIVE_INFINITY;
}
@ -335,6 +341,7 @@ public class ExponentialDistribution extends AbstractRealDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -154,6 +154,7 @@ public class FDistribution extends AbstractRealDistribution {
*
* @since 2.1
*/
@Override
public double density(double x) {
return FastMath.exp(logDensity(x));
}
@ -184,6 +185,7 @@ public class FDistribution extends AbstractRealDistribution {
* </li>
* </ul>
*/
@Override
public double cumulativeProbability(double x) {
double ret;
if (x <= 0) {
@ -232,6 +234,7 @@ public class FDistribution extends AbstractRealDistribution {
* <li>else undefined ({@code Double.NaN}).
* </ul>
*/
@Override
public double getNumericalMean() {
final double denominatorDF = getDenominatorDegreesOfFreedom();
@ -255,6 +258,7 @@ public class FDistribution extends AbstractRealDistribution {
* <li>else undefined ({@code Double.NaN}).
* </ul>
*/
@Override
public double getNumericalVariance() {
if (!numericalVarianceIsCalculated) {
numericalVariance = calculateNumericalVariance();
@ -289,6 +293,7 @@ public class FDistribution extends AbstractRealDistribution {
*
* @return lower bound of the support (always 0)
*/
@Override
public double getSupportLowerBound() {
return 0;
}
@ -301,6 +306,7 @@ public class FDistribution extends AbstractRealDistribution {
*
* @return upper bound of the support (always Double.POSITIVE_INFINITY)
*/
@Override
public double getSupportUpperBound() {
return Double.POSITIVE_INFINITY;
}
@ -312,6 +318,7 @@ public class FDistribution extends AbstractRealDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -223,6 +223,7 @@ public class GammaDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double density(double x) {
/* The present method must return the value of
*
@ -322,6 +323,7 @@ public class GammaDistribution extends AbstractRealDistribution {
* </li>
* </ul>
*/
@Override
public double cumulativeProbability(double x) {
double ret;
@ -346,6 +348,7 @@ public class GammaDistribution extends AbstractRealDistribution {
* For shape parameter {@code alpha} and scale parameter {@code beta}, the
* mean is {@code alpha * beta}.
*/
@Override
public double getNumericalMean() {
return shape * scale;
}
@ -358,6 +361,7 @@ public class GammaDistribution extends AbstractRealDistribution {
*
* @return {@inheritDoc}
*/
@Override
public double getNumericalVariance() {
return shape * scale * scale;
}
@ -369,6 +373,7 @@ public class GammaDistribution extends AbstractRealDistribution {
*
* @return lower bound of the support (always 0)
*/
@Override
public double getSupportLowerBound() {
return 0;
}
@ -381,6 +386,7 @@ public class GammaDistribution extends AbstractRealDistribution {
*
* @return upper bound of the support (always Double.POSITIVE_INFINITY)
*/
@Override
public double getSupportUpperBound() {
return Double.POSITIVE_INFINITY;
}
@ -392,6 +398,7 @@ public class GammaDistribution extends AbstractRealDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -80,6 +80,7 @@ public class GeometricDistribution extends AbstractIntegerDistribution {
}
/** {@inheritDoc} */
@Override
public double probability(int x) {
double ret;
if (x < 0) {
@ -105,6 +106,7 @@ public class GeometricDistribution extends AbstractIntegerDistribution {
}
/** {@inheritDoc} */
@Override
public double cumulativeProbability(int x) {
double ret;
if (x < 0) {
@ -121,6 +123,7 @@ public class GeometricDistribution extends AbstractIntegerDistribution {
*
* For probability parameter {@code p}, the mean is {@code (1 - p) / p}.
*/
@Override
public double getNumericalMean() {
final double p = probabilityOfSuccess;
return (1 - p) / p;
@ -132,6 +135,7 @@ public class GeometricDistribution extends AbstractIntegerDistribution {
* For probability parameter {@code p}, the variance is
* {@code (1 - p) / (p * p)}.
*/
@Override
public double getNumericalVariance() {
final double p = probabilityOfSuccess;
return (1 - p) / (p * p);
@ -144,6 +148,7 @@ public class GeometricDistribution extends AbstractIntegerDistribution {
*
* @return lower bound of the support (always 0)
*/
@Override
public int getSupportLowerBound() {
return 0;
}
@ -156,6 +161,7 @@ public class GeometricDistribution extends AbstractIntegerDistribution {
*
* @return upper bound of the support (always Integer.MAX_VALUE)
*/
@Override
public int getSupportUpperBound() {
return Integer.MAX_VALUE;
}
@ -167,6 +173,7 @@ public class GeometricDistribution extends AbstractIntegerDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -104,6 +104,7 @@ public class GumbelDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double density(double x) {
final double z = (x - mu) / beta;
final double t = FastMath.exp(-z);
@ -111,6 +112,7 @@ public class GumbelDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double cumulativeProbability(double x) {
final double z = (x - mu) / beta;
return FastMath.exp(-FastMath.exp(-z));
@ -129,26 +131,31 @@ public class GumbelDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double getNumericalMean() {
return mu + EULER * beta;
}
/** {@inheritDoc} */
@Override
public double getNumericalVariance() {
return (MathUtils.PI_SQUARED) / 6.0 * (beta * beta);
}
/** {@inheritDoc} */
@Override
public double getSupportLowerBound() {
return Double.NEGATIVE_INFINITY;
}
/** {@inheritDoc} */
@Override
public double getSupportUpperBound() {
return Double.POSITIVE_INFINITY;
}
/** {@inheritDoc} */
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -117,6 +117,7 @@ public class HypergeometricDistribution extends AbstractIntegerDistribution {
}
/** {@inheritDoc} */
@Override
public double cumulativeProbability(int x) {
double ret;
@ -198,6 +199,7 @@ public class HypergeometricDistribution extends AbstractIntegerDistribution {
}
/** {@inheritDoc} */
@Override
public double probability(int x) {
final double logProbability = logProbability(x);
return logProbability == Double.NEGATIVE_INFINITY ? 0 : FastMath.exp(logProbability);
@ -277,6 +279,7 @@ public class HypergeometricDistribution extends AbstractIntegerDistribution {
* For population size {@code N}, number of successes {@code m}, and sample
* size {@code n}, the mean is {@code n * m / N}.
*/
@Override
public double getNumericalMean() {
return getSampleSize() * (getNumberOfSuccesses() / (double) getPopulationSize());
}
@ -288,6 +291,7 @@ public class HypergeometricDistribution extends AbstractIntegerDistribution {
* size {@code n}, the variance is
* {@code [n * m * (N - n) * (N - m)] / [N^2 * (N - 1)]}.
*/
@Override
public double getNumericalVariance() {
if (!numericalVarianceIsCalculated) {
numericalVariance = calculateNumericalVariance();
@ -317,6 +321,7 @@ public class HypergeometricDistribution extends AbstractIntegerDistribution {
*
* @return lower bound of the support
*/
@Override
public int getSupportLowerBound() {
return FastMath.max(0,
getSampleSize() + getNumberOfSuccesses() - getPopulationSize());
@ -330,6 +335,7 @@ public class HypergeometricDistribution extends AbstractIntegerDistribution {
*
* @return upper bound of the support
*/
@Override
public int getSupportUpperBound() {
return FastMath.min(getNumberOfSuccesses(), getSampleSize());
}
@ -341,6 +347,7 @@ public class HypergeometricDistribution extends AbstractIntegerDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -23,7 +23,7 @@ import org.apache.commons.math4.exception.OutOfRangeException;
* Interface for distributions on the integers.
*/
public interface IntegerDistribution {
/**
* For a random variable {@code X} whose values are distributed according to
* this distribution, this method returns {@code log(P(X = x))}, where
@ -39,7 +39,7 @@ public interface IntegerDistribution {
* @since 4.0
*/
double logProbability(int x);
/**
* For a random variable {@code X} whose values are distributed according
* to this distribution, this method returns {@code P(X = x)}. In other

View File

@ -96,11 +96,13 @@ public class LaplaceDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double density(double x) {
return FastMath.exp(-FastMath.abs(x - mu) / beta) / (2.0 * beta);
}
/** {@inheritDoc} */
@Override
public double cumulativeProbability(double x) {
if (x <= mu) {
return FastMath.exp((x - mu) / beta) / 2.0;
@ -123,26 +125,31 @@ public class LaplaceDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double getNumericalMean() {
return mu;
}
/** {@inheritDoc} */
@Override
public double getNumericalVariance() {
return 2.0 * beta * beta;
}
/** {@inheritDoc} */
@Override
public double getSupportLowerBound() {
return Double.NEGATIVE_INFINITY;
}
/** {@inheritDoc} */
@Override
public double getSupportUpperBound() {
return Double.POSITIVE_INFINITY;
}
/** {@inheritDoc} */
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -87,6 +87,7 @@ public class LevyDistribution extends AbstractRealDistribution {
* returned, as in these cases the distribution is not defined.
* </p>
*/
@Override
public double density(final double x) {
if (x < mu) {
return Double.NaN;
@ -120,6 +121,7 @@ public class LevyDistribution extends AbstractRealDistribution {
* f(x; u, c) = erfc (&radic; (c / 2 (x - u )))
* </pre>
*/
@Override
public double cumulativeProbability(final double x) {
if (x < mu) {
return Double.NaN;
@ -152,26 +154,31 @@ public class LevyDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double getNumericalMean() {
return Double.POSITIVE_INFINITY;
}
/** {@inheritDoc} */
@Override
public double getNumericalVariance() {
return Double.POSITIVE_INFINITY;
}
/** {@inheritDoc} */
@Override
public double getSupportLowerBound() {
return mu;
}
/** {@inheritDoc} */
@Override
public double getSupportUpperBound() {
return Double.POSITIVE_INFINITY;
}
/** {@inheritDoc} */
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -204,6 +204,7 @@ public class LogNormalDistribution extends AbstractRealDistribution {
* otherwise.</li>
* </ul>
*/
@Override
public double density(double x) {
if (x <= 0) {
return 0;
@ -243,6 +244,7 @@ public class LogNormalDistribution extends AbstractRealDistribution {
* <li>{@code 0.5 + 0.5 * erf((ln(x) - m) / (s * sqrt(2))} otherwise.</li>
* </ul>
*/
@Override
public double cumulativeProbability(double x) {
if (x <= 0) {
return 0;
@ -284,6 +286,7 @@ public class LogNormalDistribution extends AbstractRealDistribution {
* For scale {@code m} and shape {@code s}, the mean is
* {@code exp(m + s^2 / 2)}.
*/
@Override
public double getNumericalMean() {
double s = shape;
return FastMath.exp(scale + (s * s / 2));
@ -295,6 +298,7 @@ public class LogNormalDistribution extends AbstractRealDistribution {
* For scale {@code m} and shape {@code s}, the variance is
* {@code (exp(s^2) - 1) * exp(2 * m + s^2)}.
*/
@Override
public double getNumericalVariance() {
final double s = shape;
final double ss = s * s;
@ -308,6 +312,7 @@ public class LogNormalDistribution extends AbstractRealDistribution {
*
* @return lower bound of the support (always 0)
*/
@Override
public double getSupportLowerBound() {
return 0;
}
@ -321,6 +326,7 @@ public class LogNormalDistribution extends AbstractRealDistribution {
* @return upper bound of the support (always
* {@code Double.POSITIVE_INFINITY})
*/
@Override
public double getSupportUpperBound() {
return Double.POSITIVE_INFINITY;
}
@ -332,6 +338,7 @@ public class LogNormalDistribution extends AbstractRealDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -98,6 +98,7 @@ public class LogisticDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double density(double x) {
double z = (x - mu) / s;
double v = FastMath.exp(-z);
@ -105,6 +106,7 @@ public class LogisticDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double cumulativeProbability(double x) {
double z = 1 / s * (x - mu);
return 1.0 / (1.0 + FastMath.exp(-z));
@ -123,26 +125,31 @@ public class LogisticDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double getNumericalMean() {
return mu;
}
/** {@inheritDoc} */
@Override
public double getNumericalVariance() {
return (MathUtils.PI_SQUARED / 3.0) * (1.0 / (s * s));
}
/** {@inheritDoc} */
@Override
public double getSupportLowerBound() {
return Double.NEGATIVE_INFINITY;
}
/** {@inheritDoc} */
@Override
public double getSupportUpperBound() {
return Double.POSITIVE_INFINITY;
}
/** {@inheritDoc} */
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -103,6 +103,7 @@ public class MixtureMultivariateRealDistribution<T extends MultivariateRealDistr
}
/** {@inheritDoc} */
@Override
public double density(final double[] values) {
double p = 0;
for (int i = 0; i < weight.length; i++) {

View File

@ -180,6 +180,7 @@ public class MultivariateNormalDistribution
}
/** {@inheritDoc} */
@Override
public double density(final double[] vals) throws DimensionMismatchException {
final int dim = getDimension();
if (vals.length != dim) {

View File

@ -136,6 +136,7 @@ public class NakagamiDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double density(double x) {
if (x <= 0) {
return 0.0;
@ -145,32 +146,38 @@ public class NakagamiDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double cumulativeProbability(double x) {
return Gamma.regularizedGammaP(mu, mu * x * x / omega);
}
/** {@inheritDoc} */
@Override
public double getNumericalMean() {
return Gamma.gamma(mu + 0.5) / Gamma.gamma(mu) * FastMath.sqrt(omega / mu);
}
/** {@inheritDoc} */
@Override
public double getNumericalVariance() {
double v = Gamma.gamma(mu + 0.5) / Gamma.gamma(mu);
return omega * (1 - 1 / mu * v * v);
}
/** {@inheritDoc} */
@Override
public double getSupportLowerBound() {
return 0;
}
/** {@inheritDoc} */
@Override
public double getSupportUpperBound() {
return Double.POSITIVE_INFINITY;
}
/** {@inheritDoc} */
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -167,6 +167,7 @@ public class NormalDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double density(double x) {
return FastMath.exp(logDensity(x));
}
@ -186,6 +187,7 @@ public class NormalDistribution extends AbstractRealDistribution {
* is returned, as in these cases the actual value is within
* {@code Double.MIN_VALUE} of 0 or 1.
*/
@Override
public double cumulativeProbability(double x) {
final double dev = x - mean;
if (FastMath.abs(dev) > 40 * standardDeviation) {
@ -231,6 +233,7 @@ public class NormalDistribution extends AbstractRealDistribution {
*
* For mean parameter {@code mu}, the mean is {@code mu}.
*/
@Override
public double getNumericalMean() {
return getMean();
}
@ -240,6 +243,7 @@ public class NormalDistribution extends AbstractRealDistribution {
*
* For standard deviation parameter {@code s}, the variance is {@code s^2}.
*/
@Override
public double getNumericalVariance() {
final double s = getStandardDeviation();
return s * s;
@ -254,6 +258,7 @@ public class NormalDistribution extends AbstractRealDistribution {
* @return lower bound of the support (always
* {@code Double.NEGATIVE_INFINITY})
*/
@Override
public double getSupportLowerBound() {
return Double.NEGATIVE_INFINITY;
}
@ -267,6 +272,7 @@ public class NormalDistribution extends AbstractRealDistribution {
* @return upper bound of the support (always
* {@code Double.POSITIVE_INFINITY})
*/
@Override
public double getSupportUpperBound() {
return Double.POSITIVE_INFINITY;
}
@ -278,6 +284,7 @@ public class NormalDistribution extends AbstractRealDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -18,7 +18,6 @@
package org.apache.commons.math4.distribution;
import org.apache.commons.math4.exception.NotStrictlyPositiveException;
import org.apache.commons.math4.exception.NumberIsTooLargeException;
import org.apache.commons.math4.exception.util.LocalizedFormats;
import org.apache.commons.math4.random.RandomGenerator;
import org.apache.commons.math4.random.Well19937c;
@ -180,6 +179,7 @@ public class ParetoDistribution extends AbstractRealDistribution {
* <li>{@code α * k^α / x^(α + 1)} otherwise.</li>
* </ul>
*/
@Override
public double density(double x) {
if (x < scale) {
return 0;
@ -208,6 +208,7 @@ public class ParetoDistribution extends AbstractRealDistribution {
* <li>{@code 1 - (k / x)^α} otherwise.</li>
* </ul>
*/
@Override
public double cumulativeProbability(double x) {
if (x <= scale) {
return 0;
@ -230,6 +231,7 @@ public class ParetoDistribution extends AbstractRealDistribution {
* <li>{@code α * k / (α - 1)} otherwise.</li>
* </ul>
*/
@Override
public double getNumericalMean() {
if (shape <= 1) {
return Double.POSITIVE_INFINITY;
@ -246,6 +248,7 @@ public class ParetoDistribution extends AbstractRealDistribution {
* <li>{@code k^2 * α / ((α - 1)^2 * (α - 2))} otherwise.</li>
* </ul>
*/
@Override
public double getNumericalVariance() {
if (shape <= 2) {
return Double.POSITIVE_INFINITY;
@ -261,6 +264,7 @@ public class ParetoDistribution extends AbstractRealDistribution {
*
* @return lower bound of the support
*/
@Override
public double getSupportLowerBound() {
return scale;
}
@ -272,6 +276,7 @@ public class ParetoDistribution extends AbstractRealDistribution {
*
* @return upper bound of the support (always {@code Double.POSITIVE_INFINITY})
*/
@Override
public double getSupportUpperBound() {
return Double.POSITIVE_INFINITY;
}
@ -283,6 +288,7 @@ public class ParetoDistribution extends AbstractRealDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -147,6 +147,7 @@ public class PascalDistribution extends AbstractIntegerDistribution {
}
/** {@inheritDoc} */
@Override
public double probability(int x) {
double ret;
if (x < 0) {
@ -176,6 +177,7 @@ public class PascalDistribution extends AbstractIntegerDistribution {
}
/** {@inheritDoc} */
@Override
public double cumulativeProbability(int x) {
double ret;
if (x < 0) {
@ -193,6 +195,7 @@ public class PascalDistribution extends AbstractIntegerDistribution {
* For number of successes {@code r} and probability of success {@code p},
* the mean is {@code r * (1 - p) / p}.
*/
@Override
public double getNumericalMean() {
final double p = getProbabilityOfSuccess();
final double r = getNumberOfSuccesses();
@ -205,6 +208,7 @@ public class PascalDistribution extends AbstractIntegerDistribution {
* For number of successes {@code r} and probability of success {@code p},
* the variance is {@code r * (1 - p) / p^2}.
*/
@Override
public double getNumericalVariance() {
final double p = getProbabilityOfSuccess();
final double r = getNumberOfSuccesses();
@ -218,6 +222,7 @@ public class PascalDistribution extends AbstractIntegerDistribution {
*
* @return lower bound of the support (always 0)
*/
@Override
public int getSupportLowerBound() {
return 0;
}
@ -231,6 +236,7 @@ public class PascalDistribution extends AbstractIntegerDistribution {
* @return upper bound of the support (always {@code Integer.MAX_VALUE}
* for positive infinity)
*/
@Override
public int getSupportUpperBound() {
return Integer.MAX_VALUE;
}
@ -242,6 +248,7 @@ public class PascalDistribution extends AbstractIntegerDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -140,6 +140,7 @@ public class TDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double density(double x) {
return FastMath.exp(logDensity(x));
}
@ -153,6 +154,7 @@ public class TDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double cumulativeProbability(double x) {
double ret;
if (x == 0) {
@ -188,6 +190,7 @@ public class TDistribution extends AbstractRealDistribution {
* <li>else undefined ({@code Double.NaN}).</li>
* </ul>
*/
@Override
public double getNumericalMean() {
final double df = getDegreesOfFreedom();
@ -209,6 +212,7 @@ public class TDistribution extends AbstractRealDistribution {
* <li>else undefined ({@code Double.NaN}).</li>
* </ul>
*/
@Override
public double getNumericalVariance() {
final double df = getDegreesOfFreedom();
@ -232,6 +236,7 @@ public class TDistribution extends AbstractRealDistribution {
* @return lower bound of the support (always
* {@code Double.NEGATIVE_INFINITY})
*/
@Override
public double getSupportLowerBound() {
return Double.NEGATIVE_INFINITY;
}
@ -245,6 +250,7 @@ public class TDistribution extends AbstractRealDistribution {
* @return upper bound of the support (always
* {@code Double.POSITIVE_INFINITY})
*/
@Override
public double getSupportUpperBound() {
return Double.POSITIVE_INFINITY;
}
@ -256,6 +262,7 @@ public class TDistribution extends AbstractRealDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -144,6 +144,7 @@ public class TriangularDistribution extends AbstractRealDistribution {
* <li>{@code 0} otherwise.
* </ul>
*/
@Override
public double density(double x) {
if (x < a) {
return 0;
@ -177,6 +178,7 @@ public class TriangularDistribution extends AbstractRealDistribution {
* <li>{@code 1} if {@code x > b}.</li>
* </ul>
*/
@Override
public double cumulativeProbability(double x) {
if (x < a) {
return 0;
@ -203,6 +205,7 @@ public class TriangularDistribution extends AbstractRealDistribution {
* For lower limit {@code a}, upper limit {@code b}, and mode {@code c},
* the mean is {@code (a + b + c) / 3}.
*/
@Override
public double getNumericalMean() {
return (a + b + c) / 3;
}
@ -213,6 +216,7 @@ public class TriangularDistribution extends AbstractRealDistribution {
* For lower limit {@code a}, upper limit {@code b}, and mode {@code c},
* the variance is {@code (a^2 + b^2 + c^2 - a * b - a * c - b * c) / 18}.
*/
@Override
public double getNumericalVariance() {
return (a * a + b * b + c * c - a * b - a * c - b * c) / 18;
}
@ -225,6 +229,7 @@ public class TriangularDistribution extends AbstractRealDistribution {
*
* @return lower bound of the support
*/
@Override
public double getSupportLowerBound() {
return a;
}
@ -237,6 +242,7 @@ public class TriangularDistribution extends AbstractRealDistribution {
*
* @return upper bound of the support
*/
@Override
public double getSupportUpperBound() {
return b;
}
@ -248,6 +254,7 @@ public class TriangularDistribution extends AbstractRealDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -84,6 +84,7 @@ public class UniformIntegerDistribution extends AbstractIntegerDistribution {
}
/** {@inheritDoc} */
@Override
public double probability(int x) {
if (x < lower || x > upper) {
return 0;
@ -92,6 +93,7 @@ public class UniformIntegerDistribution extends AbstractIntegerDistribution {
}
/** {@inheritDoc} */
@Override
public double cumulativeProbability(int x) {
if (x < lower) {
return 0;
@ -108,6 +110,7 @@ public class UniformIntegerDistribution extends AbstractIntegerDistribution {
* For lower bound {@code lower} and upper bound {@code upper}, the mean is
* {@code 0.5 * (lower + upper)}.
*/
@Override
public double getNumericalMean() {
return 0.5 * (lower + upper);
}
@ -118,6 +121,7 @@ public class UniformIntegerDistribution extends AbstractIntegerDistribution {
* For lower bound {@code lower} and upper bound {@code upper}, and
* {@code n = upper - lower + 1}, the variance is {@code (n^2 - 1) / 12}.
*/
@Override
public double getNumericalVariance() {
double n = upper - lower + 1;
return (n * n - 1) / 12.0;
@ -131,6 +135,7 @@ public class UniformIntegerDistribution extends AbstractIntegerDistribution {
*
* @return lower bound of the support
*/
@Override
public int getSupportLowerBound() {
return lower;
}
@ -143,6 +148,7 @@ public class UniformIntegerDistribution extends AbstractIntegerDistribution {
*
* @return upper bound of the support
*/
@Override
public int getSupportUpperBound() {
return upper;
}
@ -154,6 +160,7 @@ public class UniformIntegerDistribution extends AbstractIntegerDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -99,6 +99,7 @@ public class UniformRealDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double density(double x) {
if (x < lower || x > upper) {
return 0.0;
@ -107,6 +108,7 @@ public class UniformRealDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double cumulativeProbability(double x) {
if (x <= lower) {
return 0;
@ -132,6 +134,7 @@ public class UniformRealDistribution extends AbstractRealDistribution {
* For lower bound {@code lower} and upper bound {@code upper}, the mean is
* {@code 0.5 * (lower + upper)}.
*/
@Override
public double getNumericalMean() {
return 0.5 * (lower + upper);
}
@ -142,6 +145,7 @@ public class UniformRealDistribution extends AbstractRealDistribution {
* For lower bound {@code lower} and upper bound {@code upper}, the
* variance is {@code (upper - lower)^2 / 12}.
*/
@Override
public double getNumericalVariance() {
double ul = upper - lower;
return ul * ul / 12;
@ -155,6 +159,7 @@ public class UniformRealDistribution extends AbstractRealDistribution {
*
* @return lower bound of the support
*/
@Override
public double getSupportLowerBound() {
return lower;
}
@ -167,6 +172,7 @@ public class UniformRealDistribution extends AbstractRealDistribution {
*
* @return upper bound of the support
*/
@Override
public double getSupportUpperBound() {
return upper;
}
@ -178,6 +184,7 @@ public class UniformRealDistribution extends AbstractRealDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -169,6 +169,7 @@ public class WeibullDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double density(double x) {
if (x < 0) {
return 0;
@ -208,6 +209,7 @@ public class WeibullDistribution extends AbstractRealDistribution {
}
/** {@inheritDoc} */
@Override
public double cumulativeProbability(double x) {
double ret;
if (x <= 0.0) {
@ -257,6 +259,7 @@ public class WeibullDistribution extends AbstractRealDistribution {
* The mean is {@code scale * Gamma(1 + (1 / shape))}, where {@code Gamma()}
* is the Gamma-function.
*/
@Override
public double getNumericalMean() {
if (!numericalMeanIsCalculated) {
numericalMean = calculateNumericalMean();
@ -283,6 +286,7 @@ public class WeibullDistribution extends AbstractRealDistribution {
* The variance is {@code scale^2 * Gamma(1 + (2 / shape)) - mean^2}
* where {@code Gamma()} is the Gamma-function.
*/
@Override
public double getNumericalVariance() {
if (!numericalVarianceIsCalculated) {
numericalVariance = calculateNumericalVariance();
@ -312,6 +316,7 @@ public class WeibullDistribution extends AbstractRealDistribution {
*
* @return lower bound of the support (always 0)
*/
@Override
public double getSupportLowerBound() {
return 0;
}
@ -325,6 +330,7 @@ public class WeibullDistribution extends AbstractRealDistribution {
* @return upper bound of the support (always
* {@code Double.POSITIVE_INFINITY})
*/
@Override
public double getSupportUpperBound() {
return Double.POSITIVE_INFINITY;
}
@ -336,6 +342,7 @@ public class WeibullDistribution extends AbstractRealDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -112,6 +112,7 @@ public class ZipfDistribution extends AbstractIntegerDistribution {
}
/** {@inheritDoc} */
@Override
public double probability(final int x) {
if (x <= 0 || x > numberOfElements) {
return 0.0;
@ -131,6 +132,7 @@ public class ZipfDistribution extends AbstractIntegerDistribution {
}
/** {@inheritDoc} */
@Override
public double cumulativeProbability(final int x) {
if (x <= 0) {
return 0.0;
@ -151,6 +153,7 @@ public class ZipfDistribution extends AbstractIntegerDistribution {
* <li>{@code Hs = generalizedHarmonic(N, s)}.</li>
* </ul>
*/
@Override
public double getNumericalMean() {
if (!numericalMeanIsCalculated) {
numericalMean = calculateNumericalMean();
@ -185,6 +188,7 @@ public class ZipfDistribution extends AbstractIntegerDistribution {
* <li>{@code Hs = generalizedHarmonic(N, s)}.</li>
* </ul>
*/
@Override
public double getNumericalVariance() {
if (!numericalVarianceIsCalculated) {
numericalVariance = calculateNumericalVariance();
@ -233,6 +237,7 @@ public class ZipfDistribution extends AbstractIntegerDistribution {
*
* @return lower bound of the support (always 1)
*/
@Override
public int getSupportLowerBound() {
return 1;
}
@ -244,6 +249,7 @@ public class ZipfDistribution extends AbstractIntegerDistribution {
*
* @return upper bound of the support
*/
@Override
public int getSupportUpperBound() {
return getNumberOfElements();
}
@ -255,6 +261,7 @@ public class ZipfDistribution extends AbstractIntegerDistribution {
*
* @return {@code true}
*/
@Override
public boolean isSupportConnected() {
return true;
}

View File

@ -417,6 +417,7 @@ public class MultivariateNormalMixtureExpectationMaximization {
* @param other The other row
* @return int for sorting
*/
@Override
public int compareTo(final DataRow other) {
return mean.compareTo(other.mean);
}