Added @since tags.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@925812 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2010-03-21 15:49:31 +00:00
parent 332f3909cc
commit 8cb2563a2c
23 changed files with 115 additions and 21 deletions

View File

@ -47,7 +47,7 @@ public class LoessInterpolator
/** Default value of the number of robustness iterations. */
public static final int DEFAULT_ROBUSTNESS_ITERS = 2;
/**
/**
* Default value for accuracy.
* @since 2.1
*/

View File

@ -32,10 +32,15 @@ import org.apache.commons.math.analysis.UnivariateRealFunction;
*/
public class BrentSolver extends UnivariateRealSolverImpl {
/** Default absolute accuracy */
/**
* Default absolute accuracy
* @since 2.1
*/
public static final double DEFAULT_ABSOLUTE_ACCURACY = 1E-6;
/** Default maximum number of iterations */
/** Default maximum number of iterations
* @since 2.1
*/
public static final int DEFAULT_MAXIMUM_ITERATIONS = 100;
/** Error message for non-bracketing interval. */
@ -71,6 +76,7 @@ public class BrentSolver extends UnivariateRealSolverImpl {
* Construct a solver with the given absolute accuracy.
*
* @param absoluteAccuracy lower bound for absolute accuracy of solutions returned by the solver
* @since 2.1
*/
public BrentSolver(double absoluteAccuracy) {
super(DEFAULT_MAXIMUM_ITERATIONS, absoluteAccuracy);
@ -81,6 +87,7 @@ public class BrentSolver extends UnivariateRealSolverImpl {
*
* @param maximumIterations maximum number of iterations
* @param absoluteAccuracy lower bound for absolute accuracy of solutions returned by the solver
* @since 2.1
*/
public BrentSolver(int maximumIterations, double absoluteAccuracy) {
super(maximumIterations, absoluteAccuracy);

View File

@ -40,7 +40,10 @@ public abstract class AbstractContinuousDistribution
/** Serializable version identifier */
private static final long serialVersionUID = -38038050983108802L;
/** Solver absolute accuracy for inverse cum computation */
/**
* Solver absolute accuracy for inverse cum computation
* @since 2.1
*/
private double solverAbsoluteAccuracy = BrentSolver.DEFAULT_ABSOLUTE_ACCURACY;
/**
@ -55,6 +58,7 @@ public abstract class AbstractContinuousDistribution
* @param x The point at which the density should be computed.
* @return The pdf at point x.
* @throws MathRuntimeException if the specialized class hasn't implemented this function
* @since 2.1
*/
public double density(double x) throws MathRuntimeException {
throw new MathRuntimeException(new UnsupportedOperationException(),
@ -166,6 +170,7 @@ public abstract class AbstractContinuousDistribution
* Returns the solver absolute accuracy for inverse cum computation.
*
* @return the maximum absolute error in inverse cumulative probability estimates
* @since 2.1
*/
protected double getSolverAbsoluteAccuracy() {
return solverAbsoluteAccuracy;

View File

@ -114,6 +114,7 @@ public class BetaDistributionImpl
*
* @param x The point at which the density should be computed.
* @return The pdf at point x.
* @since 2.1
*/
public double density(double x) {
recomputeZ();

View File

@ -89,6 +89,7 @@ public class CauchyDistributionImpl extends AbstractContinuousDistribution
*
* @param x The point at which the density should be computed.
* @return The pdf at point x.
* @since 2.1
*/
@Override
public double density(double x) {

View File

@ -29,7 +29,10 @@ public class ChiSquaredDistributionImpl
extends AbstractContinuousDistribution
implements ChiSquaredDistribution, Serializable {
/** Default inverse cumulative probability accuracy */
/**
* Default inverse cumulative probability accuracy
* @since 2.1
*/
public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
/** Serializable version identifier */
@ -71,6 +74,7 @@ public class ChiSquaredDistributionImpl
* @param df degrees of freedom.
* @param inverseCumAccuracy the maximum absolute error in inverse cumulative probability estimates
* (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY})
* @since 2.1
*/
public ChiSquaredDistributionImpl(double df, double inverseCumAccuracy) {
super();
@ -120,6 +124,7 @@ public class ChiSquaredDistributionImpl
*
* @param x The point at which the density should be computed.
* @return The pdf at point x.
* @since 2.1
*/
@Override
public double density(double x) {
@ -257,6 +262,7 @@ public class ChiSquaredDistributionImpl
* inverse cumulative probabilities.
*
* @return the solver absolute accuracy
* @since 2.1
*/
@Override
protected double getSolverAbsoluteAccuracy() {

View File

@ -91,6 +91,7 @@ public class ExponentialDistributionImpl extends AbstractContinuousDistribution
*
* @param x The point at which the density should be computed.
* @return The pdf at point x.
* @since 2.1
*/
@Override
public double density(double x) {

View File

@ -32,7 +32,10 @@ public class FDistributionImpl
extends AbstractContinuousDistribution
implements FDistribution, Serializable {
/** Default inverse cumulative probability accuracy */
/**
* Default inverse cumulative probability accurac
* @since 2.1
*/
public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
/** Message for non positive degrees of freddom. */
@ -67,6 +70,7 @@ public class FDistributionImpl
* @param denominatorDegreesOfFreedom the denominator degrees of freedom.
* @param inverseCumAccuracy the maximum absolute error in inverse cumulative probability estimates
* (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY})
* @since 2.1
*/
public FDistributionImpl(double numeratorDegreesOfFreedom, double denominatorDegreesOfFreedom,
double inverseCumAccuracy) {
@ -81,6 +85,7 @@ public class FDistributionImpl
*
* @param x The point at which the density should be computed.
* @return The pdf at point x.
* @since 2.1
*/
@Override
public double density(double x) {
@ -269,6 +274,7 @@ public class FDistributionImpl
* inverse cumulative probabilities.
*
* @return the solver absolute accuracy
* @since 2.1
*/
@Override
protected double getSolverAbsoluteAccuracy() {

View File

@ -30,7 +30,10 @@ import org.apache.commons.math.special.Gamma;
public class GammaDistributionImpl extends AbstractContinuousDistribution
implements GammaDistribution, Serializable {
/** Default inverse cumulative probability accuracy */
/**
* Default inverse cumulative probability accuracy
* @since 2.1
*/
public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
/** Serializable version identifier */
@ -60,6 +63,7 @@ public class GammaDistributionImpl extends AbstractContinuousDistribution
* @param beta the scale parameter.
* @param inverseCumAccuracy the maximum absolute error in inverse cumulative probability estimates
* (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY})
* @since 2.1
*/
public GammaDistributionImpl(double alpha, double beta, double inverseCumAccuracy) {
super();
@ -285,6 +289,7 @@ public class GammaDistributionImpl extends AbstractContinuousDistribution
* inverse cumulative probabilities.
*
* @return the solver absolute accuracy
* @since 2.1
*/
@Override
protected double getSolverAbsoluteAccuracy() {

View File

@ -33,7 +33,10 @@ import org.apache.commons.math.special.Erf;
public class NormalDistributionImpl extends AbstractContinuousDistribution
implements NormalDistribution, Serializable {
/** Default inverse cumulative probability accuracy */
/**
* Default inverse cumulative probability accuracy
* @since 2.1
*/
public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
/** Serializable version identifier */
@ -67,6 +70,7 @@ public class NormalDistributionImpl extends AbstractContinuousDistribution
* @param mean mean for this distribution
* @param sd standard deviation for this distribution
* @param inverseCumAccuracy inverse cumulative probability accuracy
* @since 2.1
*/
public NormalDistributionImpl(double mean, double sd, double inverseCumAccuracy) {
super();
@ -156,6 +160,7 @@ public class NormalDistributionImpl extends AbstractContinuousDistribution
*
* @param x The point at which the density should be computed.
* @return The pdf at point x.
* @since 2.1
*/
public double density(double x) {
double x0 = x - mean;
@ -190,6 +195,7 @@ public class NormalDistributionImpl extends AbstractContinuousDistribution
* inverse cumulative probabilities.
*
* @return the solver absolute accuracy
* @since 2.1
*/
@Override
protected double getSolverAbsoluteAccuracy() {

View File

@ -33,11 +33,13 @@ public class PoissonDistributionImpl extends AbstractIntegerDistribution
/**
* Default maximum number of iterations for cumulative probability calculations.
* @since 2.1
*/
public static final int DEFAULT_MAX_ITERATIONS = 10000000;
/**
* Default convergence criterion
* Default convergence criterion.
* @since 2.1
*/
public static final double DEFAULT_EPSILON = 1E-12;
@ -83,6 +85,7 @@ public class PoissonDistributionImpl extends AbstractIntegerDistribution
* @param p the Poisson mean
* @param epsilon the convergence criteria for cumulative probabilites
* @param maxIterations the maximum number of iterations for cumulative probabilites
* @since 2.1
*/
public PoissonDistributionImpl(double p, double epsilon, int maxIterations) {
setMean(p);
@ -95,6 +98,7 @@ public class PoissonDistributionImpl extends AbstractIntegerDistribution
*
* @param p the Poisson mean
* @param epsilon the convergence criteria for cumulative probabilites
* @since 2.1
*/
public PoissonDistributionImpl(double p, double epsilon) {
setMean(p);
@ -106,6 +110,7 @@ public class PoissonDistributionImpl extends AbstractIntegerDistribution
*
* @param p the Poisson mean
* @param maxIterations the maximum number of iterations for cumulative probabilites
* @since 2.1
*/
public PoissonDistributionImpl(double p, int maxIterations) {
setMean(p);

View File

@ -33,7 +33,10 @@ public class TDistributionImpl
extends AbstractContinuousDistribution
implements TDistribution, Serializable {
/** Default inverse cumulative probability accuracy */
/**
* Default inverse cumulative probability accuracy
* @since 2.1
*/
public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
/** Serializable version identifier */
@ -52,6 +55,7 @@ public class TDistributionImpl
* @param degreesOfFreedom the degrees of freedom.
* @param inverseCumAccuracy the maximum absolute error in inverse cumulative probability estimates
* (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY})
* @since 2.1
*/
public TDistributionImpl(double degreesOfFreedom, double inverseCumAccuracy) {
super();
@ -102,6 +106,7 @@ public class TDistributionImpl
*
* @param x The point at which the density should be computed.
* @return The pdf at point x.
* @since 2.1
*/
@Override
public double density(double x) {
@ -210,6 +215,7 @@ public class TDistributionImpl
* inverse cumulative probabilities.
*
* @return the solver absolute accuracy
* @since 2.1
*/
@Override
protected double getSolverAbsoluteAccuracy() {

View File

@ -31,7 +31,10 @@ import org.apache.commons.math.MathRuntimeException;
public class WeibullDistributionImpl extends AbstractContinuousDistribution
implements WeibullDistribution, Serializable {
/** Default inverse cumulative probability accuracy */
/**
* Default inverse cumulative probability accuracy
* @since 2.1
*/
public static final double DEFAULT_INVERSE_ABSOLUTE_ACCURACY = 1e-9;
/** Serializable version identifier */
@ -63,6 +66,7 @@ public class WeibullDistributionImpl extends AbstractContinuousDistribution
* @param beta the scale parameter.
* @param inverseCumAccuracy the maximum absolute error in inverse cumulative probability estimates
* (defaults to {@link #DEFAULT_INVERSE_ABSOLUTE_ACCURACY})
* @since 2.1
*/
public WeibullDistributionImpl(double alpha, double beta, double inverseCumAccuracy){
super();
@ -107,6 +111,7 @@ public class WeibullDistributionImpl extends AbstractContinuousDistribution
*
* @param x The point at which the density should be computed.
* @return The pdf at point x.
* @since 2.1
*/
@Override
public double density(double x) {
@ -246,6 +251,7 @@ public class WeibullDistributionImpl extends AbstractContinuousDistribution
* inverse cumulative probabilities.
*
* @return the solver absolute accuracy
* @since 2.1
*/
@Override
protected double getSolverAbsoluteAccuracy() {

View File

@ -219,6 +219,7 @@ public class GeneticAlgorithm {
* reach {@link StoppingCondition} in the last run.
*
* @return number of generations evolved
* @since 2.1
*/
public int getGenerationsEvolved() {
return generationsEvolved;

View File

@ -200,6 +200,7 @@ public class OpenMapRealVector extends AbstractRealVector implements SparseRealV
* Determine if this value is within epsilon of zero.
* @param value The value to test
* @return <code>true</code> if this value is within epsilon to zero, <code>false</code> otherwise
* @since 2.1
*/
protected boolean isDefaultValue(double value) {
return Math.abs(value) < epsilon;
@ -279,7 +280,10 @@ public class OpenMapRealVector extends AbstractRealVector implements SparseRealV
return res;
}
/** {@inheritDoc} */
/**
* {@inheritDoc}
* @since 2.1
*/
@Override
public OpenMapRealVector copy() {
return new OpenMapRealVector(this);

View File

@ -63,10 +63,16 @@ public abstract class AbstractLeastSquaresOptimizer implements DifferentiableMul
/** Number of rows of the jacobian matrix. */
protected int rows;
/** Target value for the objective functions at optimum. */
/**
* Target value for the objective functions at optimum.
* @since 2.1
*/
protected double[] targetValues;
/** Weight for the least squares cost computation. */
/**
* Weight for the least squares cost computation.
* @since 2.1
*/
protected double[] residualsWeights;
/** Current point. */

View File

@ -45,7 +45,10 @@ public abstract class AbstractScalarDifferentiableOptimizer
/** Convergence checker. */
protected RealConvergenceChecker checker;
/** Type of optimization. */
/**
* Type of optimization.
* @since 2.1
*/
protected GoalType goal;
/** Current point set. */

View File

@ -37,16 +37,28 @@ public abstract class AbstractLinearOptimizer implements LinearOptimizer {
/** Default maximal number of iterations allowed. */
public static final int DEFAULT_MAX_ITERATIONS = 100;
/** Linear objective function. */
/**
* Linear objective function.
* @since 2.1
*/
protected LinearObjectiveFunction function;
/** Linear constraints. */
/**
* Linear constraints.
* @since 2.1
*/
protected Collection<LinearConstraint> linearConstraints;
/** Type of optimization goal: either {@link GoalType#MAXIMIZE} or {@link GoalType#MINIMIZE}. */
/**
* Type of optimization goal: either {@link GoalType#MAXIMIZE} or {@link GoalType#MINIMIZE}.
* @since 2.1
*/
protected GoalType goal;
/** Whether to restrict the variables to non-negative values. */
/**
* Whether to restrict the variables to non-negative values.
* @since 2.1
*/
protected boolean nonNegative;
/** Maximal number of iterations allowed. */

View File

@ -436,6 +436,7 @@ public class EmpiricalDistributionImpl implements Serializable, EmpiricalDistrib
* bounds now returned by {@link #getGeneratorUpperBounds()}.</p>
*
* @return array of bin upper bounds
* @since 2.1
*/
public double[] getUpperBounds() {
double[] binUpperBounds = new double[binCount];

View File

@ -21,6 +21,7 @@ package org.apache.commons.math.random;
/**
* Generate random vectors isotropically located on the surface of a sphere.
*
* @since 2.1
* @version $Revision$ $Date$
*/

View File

@ -99,7 +99,10 @@ public class EuclideanIntegerPoint implements Clusterable<EuclideanIntegerPoint>
return hashCode;
}
/** {@inheritDoc} */
/**
* {@inheritDoc}
* @since 2.1
*/
@Override
public String toString() {
final StringBuffer buff = new StringBuffer("(");

View File

@ -192,6 +192,7 @@ public class BigReal implements FieldElement<BigReal>, Comparable<BigReal>, Seri
* Gets the rounding mode for division operations
* The default is {@code RoundingMode.HALF_UP}
* @return the rounding mode.
* @since 2.1
*/
public RoundingMode getRoundingMode() {
return roundingMode;
@ -200,6 +201,7 @@ public class BigReal implements FieldElement<BigReal>, Comparable<BigReal>, Seri
/***
* Sets the rounding mode for decimal divisions.
* @param roundingMode rounding mode for decimal divisions
* @since 2.1
*/
public void setRoundingMode(RoundingMode roundingMode) {
this.roundingMode = roundingMode;
@ -209,6 +211,7 @@ public class BigReal implements FieldElement<BigReal>, Comparable<BigReal>, Seri
* Sets the scale for division operations.
* The default is 64
* @return the scale
* @since 2.1
*/
public int getScale() {
return scale;
@ -217,6 +220,7 @@ public class BigReal implements FieldElement<BigReal>, Comparable<BigReal>, Seri
/***
* Sets the scale for division operations.
* @param scale scale for division operations
* @since 2.1
*/
public void setScale(int scale) {
this.scale = scale;

View File

@ -38,7 +38,10 @@ public final class MathUtils {
*/
public static final double SAFE_MIN = 0x1.0p-1022;
/** 2 &pi;. */
/**
* 2 &pi;.
* @since 2.1
*/
public static final double TWO_PI = 2 * Math.PI;
/** -1.0 cast as a byte. */
@ -1141,6 +1144,7 @@ public final class MathUtils {
* @return normalized array
* @throws ArithmeticException if the input array contains infinite elements or sums to zero
* @throws IllegalArgumentException if the target sum is infinite or NaN
* @since 2.1
*/
public static double[] normalizeArray(double[] values, double normalizedSum)
throws ArithmeticException, IllegalArgumentException {