Added missing @since tags.

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/math/trunk@1422313 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Phil Steitz 2012-12-15 18:53:41 +00:00
parent 7fc64f6dcb
commit 1a77fde3cd
21 changed files with 70 additions and 4 deletions

View File

@ -420,6 +420,7 @@ public class MatrixUtils {
* @param eps Relative tolerance. * @param eps Relative tolerance.
* @throws NonSquareMatrixException if the matrix is not square. * @throws NonSquareMatrixException if the matrix is not square.
* @throws NonSymmetricMatrixException if the matrix is not symmetric. * @throws NonSymmetricMatrixException if the matrix is not symmetric.
* @since 3.1
*/ */
public static void checkSymmetric(RealMatrix matrix, public static void checkSymmetric(RealMatrix matrix,
double eps) { double eps) {
@ -432,6 +433,7 @@ public class MatrixUtils {
* @param matrix Matrix to check. * @param matrix Matrix to check.
* @param eps Relative tolerance. * @param eps Relative tolerance.
* @return {@code true} if {@code matrix} is symmetric. * @return {@code true} if {@code matrix} is symmetric.
* @since 3.1
*/ */
public static boolean isSymmetric(RealMatrix matrix, public static boolean isSymmetric(RealMatrix matrix,
double eps) { double eps) {

View File

@ -201,6 +201,7 @@ public abstract class RealVector {
* @param end the index of the last entry of the subvector (inclusive) * @param end the index of the last entry of the subvector (inclusive)
* @throws OutOfRangeException if {@code start} of {@code end} are not valid * @throws OutOfRangeException if {@code start} of {@code end} are not valid
* @throws NumberIsTooSmallException if {@code end < start} * @throws NumberIsTooSmallException if {@code end < start}
* @since 3.1
*/ */
protected void checkIndices(final int start, final int end) protected void checkIndices(final int start, final int end)
throws NumberIsTooSmallException, OutOfRangeException { throws NumberIsTooSmallException, OutOfRangeException {
@ -889,7 +890,6 @@ public abstract class RealVector {
return this; return this;
} }
/** /**
* Visits (but does not alter) all entries of this vector in default order * Visits (but does not alter) all entries of this vector in default order
* (increasing index). * (increasing index).
@ -898,6 +898,7 @@ public abstract class RealVector {
* vector * vector
* @return the value returned by {@link RealVectorPreservingVisitor#end()} * @return the value returned by {@link RealVectorPreservingVisitor#end()}
* at the end of the walk * at the end of the walk
* @since 3.1
*/ */
public double walkInDefaultOrder(final RealVectorPreservingVisitor visitor) { public double walkInDefaultOrder(final RealVectorPreservingVisitor visitor) {
final int dim = getDimension(); final int dim = getDimension();
@ -919,6 +920,7 @@ public abstract class RealVector {
* at the end of the walk * at the end of the walk
* @throws NumberIsTooSmallException if {@code end < start}. * @throws NumberIsTooSmallException if {@code end < start}.
* @throws OutOfRangeException if the indices are not valid. * @throws OutOfRangeException if the indices are not valid.
* @since 3.1
*/ */
public double walkInDefaultOrder(final RealVectorPreservingVisitor visitor, public double walkInDefaultOrder(final RealVectorPreservingVisitor visitor,
final int start, final int end) final int start, final int end)
@ -941,6 +943,7 @@ public abstract class RealVector {
* vector * vector
* @return the value returned by {@link RealVectorPreservingVisitor#end()} * @return the value returned by {@link RealVectorPreservingVisitor#end()}
* at the end of the walk * at the end of the walk
* @since 3.1
*/ */
public double walkInOptimizedOrder(final RealVectorPreservingVisitor visitor) { public double walkInOptimizedOrder(final RealVectorPreservingVisitor visitor) {
return walkInDefaultOrder(visitor); return walkInDefaultOrder(visitor);
@ -959,6 +962,7 @@ public abstract class RealVector {
* at the end of the walk * at the end of the walk
* @throws NumberIsTooSmallException if {@code end < start}. * @throws NumberIsTooSmallException if {@code end < start}.
* @throws OutOfRangeException if the indices are not valid. * @throws OutOfRangeException if the indices are not valid.
* @since 3.1
*/ */
public double walkInOptimizedOrder(final RealVectorPreservingVisitor visitor, public double walkInOptimizedOrder(final RealVectorPreservingVisitor visitor,
final int start, final int end) final int start, final int end)
@ -974,6 +978,7 @@ public abstract class RealVector {
* of this vector * of this vector
* @return the value returned by {@link RealVectorChangingVisitor#end()} * @return the value returned by {@link RealVectorChangingVisitor#end()}
* at the end of the walk * at the end of the walk
* @since 3.1
*/ */
public double walkInDefaultOrder(final RealVectorChangingVisitor visitor) { public double walkInDefaultOrder(final RealVectorChangingVisitor visitor) {
final int dim = getDimension(); final int dim = getDimension();
@ -995,6 +1000,7 @@ public abstract class RealVector {
* at the end of the walk * at the end of the walk
* @throws NumberIsTooSmallException if {@code end < start}. * @throws NumberIsTooSmallException if {@code end < start}.
* @throws OutOfRangeException if the indices are not valid. * @throws OutOfRangeException if the indices are not valid.
* @since 3.1
*/ */
public double walkInDefaultOrder(final RealVectorChangingVisitor visitor, public double walkInDefaultOrder(final RealVectorChangingVisitor visitor,
final int start, final int end) final int start, final int end)
@ -1017,6 +1023,7 @@ public abstract class RealVector {
* vector * vector
* @return the value returned by {@link RealVectorChangingVisitor#end()} * @return the value returned by {@link RealVectorChangingVisitor#end()}
* at the end of the walk * at the end of the walk
* @since 3.1
*/ */
public double walkInOptimizedOrder(final RealVectorChangingVisitor visitor) { public double walkInOptimizedOrder(final RealVectorChangingVisitor visitor) {
return walkInDefaultOrder(visitor); return walkInDefaultOrder(visitor);
@ -1035,6 +1042,7 @@ public abstract class RealVector {
* at the end of the walk * at the end of the walk
* @throws NumberIsTooSmallException if {@code end < start}. * @throws NumberIsTooSmallException if {@code end < start}.
* @throws OutOfRangeException if the indices are not valid. * @throws OutOfRangeException if the indices are not valid.
* @since 3.1
*/ */
public double walkInOptimizedOrder(final RealVectorChangingVisitor visitor, public double walkInOptimizedOrder(final RealVectorChangingVisitor visitor,
final int start, final int end) final int start, final int end)

View File

@ -63,6 +63,7 @@ public class RectangularCholeskyDecomposition {
* @param matrix Symmetric positive semidefinite matrix. * @param matrix Symmetric positive semidefinite matrix.
* @exception NonPositiveDefiniteMatrixException if the matrix is not * @exception NonPositiveDefiniteMatrixException if the matrix is not
* positive semidefinite. * positive semidefinite.
* @since 3.1
*/ */
public RectangularCholeskyDecomposition(RealMatrix matrix) public RectangularCholeskyDecomposition(RealMatrix matrix)
throws NonPositiveDefiniteMatrixException { throws NonPositiveDefiniteMatrixException {

View File

@ -136,6 +136,7 @@ public abstract class BaseAbstractMultivariateOptimizer<FUNC extends Multivariat
* </ul> * </ul>
* @return the point/value pair giving the optimal value of the objective * @return the point/value pair giving the optimal value of the objective
* function. * function.
* @since 3.1
*/ */
public PointValuePair optimize(int maxEval, public PointValuePair optimize(int maxEval,
FUNC f, FUNC f,
@ -185,6 +186,7 @@ public abstract class BaseAbstractMultivariateOptimizer<FUNC extends Multivariat
* function. * function.
* @throws TooManyEvaluationsException if the maximal number of * @throws TooManyEvaluationsException if the maximal number of
* evaluations is exceeded. * evaluations is exceeded.
* @since 3.1
*/ */
protected PointValuePair optimizeInternal(int maxEval, protected PointValuePair optimizeInternal(int maxEval,
FUNC f, FUNC f,
@ -246,12 +248,14 @@ public abstract class BaseAbstractMultivariateOptimizer<FUNC extends Multivariat
} }
/** /**
* @return the lower bounds. * @return the lower bounds.
* @since 3.1
*/ */
public double[] getLowerBound() { public double[] getLowerBound() {
return lowerBound == null ? null : lowerBound.clone(); return lowerBound == null ? null : lowerBound.clone();
} }
/** /**
* @return the upper bounds. * @return the upper bounds.
* @since 3.1
*/ */
public double[] getUpperBound() { public double[] getUpperBound() {
return upperBound == null ? null : upperBound.clone(); return upperBound == null ? null : upperBound.clone();

View File

@ -399,6 +399,7 @@ public class CMAESOptimizer
* values are more likely to find a local optimum close to the initial * values are more likely to find a local optimum close to the initial
* guess). * guess).
* Too small values might however lead to early termination. * Too small values might however lead to early termination.
* @since 3.1
*/ */
public static class Sigma implements OptimizationData { public static class Sigma implements OptimizationData {
/** Sigma values. */ /** Sigma values. */
@ -437,6 +438,7 @@ public class CMAESOptimizer
* Increasing the population size improves global search properties * Increasing the population size improves global search properties
* at the expense of speed (which in general decreases at most * at the expense of speed (which in general decreases at most
* linearly with increasing population size). * linearly with increasing population size).
* @since 3.1
*/ */
public static class PopulationSize implements OptimizationData { public static class PopulationSize implements OptimizationData {
/** Population size. */ /** Population size. */

View File

@ -150,6 +150,7 @@ public class PowellOptimizer
* @param lineAbs Absolute threshold for the internal line search optimizer. * @param lineAbs Absolute threshold for the internal line search optimizer.
* @throws NotStrictlyPositiveException if {@code abs <= 0}. * @throws NotStrictlyPositiveException if {@code abs <= 0}.
* @throws NumberIsTooSmallException if {@code rel < 2 * Math.ulp(1d)}. * @throws NumberIsTooSmallException if {@code rel < 2 * Math.ulp(1d)}.
* @since 3.1
*/ */
public PowellOptimizer(double rel, public PowellOptimizer(double rel,
double abs, double abs,

View File

@ -57,6 +57,7 @@ public class PolynomialFitter extends CurveFitter<PolynomialFunction.Parametric>
* Simple constructor. * Simple constructor.
* *
* @param optimizer Optimizer to use for the fitting. * @param optimizer Optimizer to use for the fitting.
* @since 3.1
*/ */
public PolynomialFitter(DifferentiableMultivariateVectorOptimizer optimizer) { public PolynomialFitter(DifferentiableMultivariateVectorOptimizer optimizer) {
super(optimizer); super(optimizer);
@ -88,6 +89,7 @@ public class PolynomialFitter extends CurveFitter<PolynomialFunction.Parametric>
* the number of evaluations exceeds {@code maxEval}. * the number of evaluations exceeds {@code maxEval}.
* @throws org.apache.commons.math3.exception.ConvergenceException * @throws org.apache.commons.math3.exception.ConvergenceException
* if the algorithm failed to converge. * if the algorithm failed to converge.
* @since 3.1
*/ */
public double[] fit(int maxEval, double[] guess) { public double[] fit(int maxEval, double[] guess) {
return fit(maxEval, new PolynomialFunction.Parametric(), guess); return fit(maxEval, new PolynomialFunction.Parametric(), guess);
@ -102,6 +104,7 @@ public class PolynomialFitter extends CurveFitter<PolynomialFunction.Parametric>
* @return the coefficients of the polynomial that best fits the observed points. * @return the coefficients of the polynomial that best fits the observed points.
* @throws org.apache.commons.math3.exception.ConvergenceException * @throws org.apache.commons.math3.exception.ConvergenceException
* if the algorithm failed to converge. * if the algorithm failed to converge.
* @since 3.1
*/ */
public double[] fit(double[] guess) { public double[] fit(double[] guess) {
return fit(new PolynomialFunction.Parametric(), guess); return fit(new PolynomialFunction.Parametric(), guess);

View File

@ -253,6 +253,7 @@ public abstract class AbstractLeastSquaresOptimizer
* Gets the square-root of the weight matrix. * Gets the square-root of the weight matrix.
* *
* @return the square-root of the weight matrix. * @return the square-root of the weight matrix.
* @since 3.1
*/ */
public RealMatrix getWeightSquareRoot() { public RealMatrix getWeightSquareRoot() {
return weightMatrixSqrt.copy(); return weightMatrixSqrt.copy();
@ -320,6 +321,7 @@ public abstract class AbstractLeastSquaresOptimizer
* @return the covariance matrix. * @return the covariance matrix.
* @throws org.apache.commons.math3.linear.SingularMatrixException * @throws org.apache.commons.math3.linear.SingularMatrixException
* if the covariance matrix cannot be computed (singular problem). * if the covariance matrix cannot be computed (singular problem).
* @since 3.1
*/ */
public double[][] computeCovariances(double[] params, public double[][] computeCovariances(double[] params,
double threshold) { double threshold) {
@ -392,6 +394,7 @@ public abstract class AbstractLeastSquaresOptimizer
* @return an estimate of the standard deviation of the optimized parameters * @return an estimate of the standard deviation of the optimized parameters
* @throws org.apache.commons.math3.linear.SingularMatrixException * @throws org.apache.commons.math3.linear.SingularMatrixException
* if the covariance matrix cannot be computed. * if the covariance matrix cannot be computed.
* @since 3.1
*/ */
public double[] computeSigma(double[] params, public double[] computeSigma(double[] params,
double covarianceSingularityThreshold) { double covarianceSingularityThreshold) {
@ -531,6 +534,7 @@ public abstract class AbstractLeastSquaresOptimizer
* @return the residuals. * @return the residuals.
* @throws DimensionMismatchException if {@code params} has a wrong * @throws DimensionMismatchException if {@code params} has a wrong
* length. * length.
* @since 3.1
*/ */
protected double[] computeResiduals(double[] objectiveValue) { protected double[] computeResiduals(double[] objectiveValue) {
final double[] target = getTarget(); final double[] target = getTarget();

View File

@ -106,7 +106,7 @@ import org.apache.commons.math3.util.FastMath;
* </li> * </li>
* </ul> * </ul>
* </p> * </p>
* * @since 3.1
* @version $Id$ * @version $Id$
*/ */
public class RandomDataGenerator implements RandomData, Serializable { public class RandomDataGenerator implements RandomData, Serializable {

View File

@ -61,6 +61,7 @@ public class Gamma {
/** /**
* The value of the {@code g} constant in the Lanczos approximation, see * The value of the {@code g} constant in the Lanczos approximation, see
* {@link #lanczos(double)}. * {@link #lanczos(double)}.
* @since 3.1
*/ */
public static final double LANCZOS_G = 607.0 / 128.0; public static final double LANCZOS_G = 607.0 / 128.0;
@ -506,6 +507,7 @@ public class Gamma {
* equations (1) through (5), and Paul Godfrey's * equations (1) through (5), and Paul Godfrey's
* <a href="http://my.fit.edu/~gabdo/gamma.txt">Note on the computation * <a href="http://my.fit.edu/~gabdo/gamma.txt">Note on the computation
* of the convergent Lanczos complex Gamma approximation</a> * of the convergent Lanczos complex Gamma approximation</a>
* @since 3.1
*/ */
public static double lanczos(final double x) { public static double lanczos(final double x) {
double sum = 0.0; double sum = 0.0;
@ -525,6 +527,7 @@ public class Gamma {
* @return The value of {@code 1.0 / Gamma(1.0 + x) - 1.0}. * @return The value of {@code 1.0 / Gamma(1.0 + x) - 1.0}.
* @throws NumberIsTooSmallException if {@code x < -0.5} * @throws NumberIsTooSmallException if {@code x < -0.5}
* @throws NumberIsTooLargeException if {@code x > 1.5} * @throws NumberIsTooLargeException if {@code x > 1.5}
* @since 3.1
*/ */
public static double invGamma1pm1(final double x) { public static double invGamma1pm1(final double x) {
@ -617,6 +620,7 @@ public class Gamma {
* @return The value of {@code log(Gamma(1 + x))}. * @return The value of {@code log(Gamma(1 + x))}.
* @throws NumberIsTooSmallException if {@code x < -0.5}. * @throws NumberIsTooSmallException if {@code x < -0.5}.
* @throws NumberIsTooLargeException if {@code x > 1.5}. * @throws NumberIsTooLargeException if {@code x > 1.5}.
* @since 3.1
*/ */
public static double logGamma1p(final double x) public static double logGamma1p(final double x)
throws NumberIsTooSmallException, NumberIsTooLargeException { throws NumberIsTooSmallException, NumberIsTooLargeException {
@ -639,6 +643,7 @@ public class Gamma {
* *
* @param x Argument. * @param x Argument.
* @return the value of {@code Gamma(x)}. * @return the value of {@code Gamma(x)}.
* @since 3.1
*/ */
public static double gamma(final double x) { public static double gamma(final double x) {

View File

@ -123,6 +123,7 @@ public class Frequency implements Serializable {
* @param v the value to add. * @param v the value to add.
* @param increment the amount by which the value should be incremented * @param increment the amount by which the value should be incremented
* @throws IllegalArgumentException if <code>v</code> is not comparable with previous entries * @throws IllegalArgumentException if <code>v</code> is not comparable with previous entries
* @since 3.1
*/ */
public void incrementValue(Comparable<?> v, long increment){ public void incrementValue(Comparable<?> v, long increment){
Comparable<?> obj = v; Comparable<?> obj = v;
@ -206,6 +207,7 @@ public class Frequency implements Serializable {
* map entries returned by the Iterator will in this case be Longs.</p> * map entries returned by the Iterator will in this case be Longs.</p>
* *
* @return entry set Iterator * @return entry set Iterator
* @since 3.1
*/ */
public Iterator<Map.Entry<Comparable<?>, Long>> entrySetIterator() { public Iterator<Map.Entry<Comparable<?>, Long>> entrySetIterator() {
return freqTable.entrySet().iterator(); return freqTable.entrySet().iterator();
@ -497,6 +499,7 @@ public class Frequency implements Serializable {
* by the counts represented by other. * by the counts represented by other.
* *
* @param other the other {@link Frequency} object to be merged * @param other the other {@link Frequency} object to be merged
* @since 3.1
*/ */
public void merge(Frequency other) { public void merge(Frequency other) {
for (Iterator<Map.Entry<Comparable<?>, Long>> iter = other.entrySetIterator(); iter.hasNext();) { for (Iterator<Map.Entry<Comparable<?>, Long>> iter = other.entrySetIterator(); iter.hasNext();) {
@ -511,6 +514,7 @@ public class Frequency implements Serializable {
* by the counts represented by each of the others. * by the counts represented by each of the others.
* *
* @param others the other {@link Frequency} objects to be merged * @param others the other {@link Frequency} objects to be merged
* @since 3.1
*/ */
public void merge(Collection<Frequency> others) { public void merge(Collection<Frequency> others) {
for (Iterator<Frequency> iter = others.iterator(); iter.hasNext();) { for (Iterator<Frequency> iter = others.iterator(); iter.hasNext();) {

View File

@ -60,6 +60,7 @@ public class SpearmansCorrelation {
* Create a SpearmansCorrelation with the given ranking algorithm. * Create a SpearmansCorrelation with the given ranking algorithm.
* *
* @param rankingAlgorithm ranking algorithm * @param rankingAlgorithm ranking algorithm
* @since 3.1
*/ */
public SpearmansCorrelation(final RankingAlgorithm rankingAlgorithm) { public SpearmansCorrelation(final RankingAlgorithm rankingAlgorithm) {
data = null; data = null;

View File

@ -367,6 +367,7 @@ public class TestUtils {
/** /**
* @see org.apache.commons.math3.stat.inference.GTest#g(double[], long[]) * @see org.apache.commons.math3.stat.inference.GTest#g(double[], long[])
* @since 3.1
*/ */
public static double g(final double[] expected, final long[] observed) public static double g(final double[] expected, final long[] observed)
throws NotPositiveException, NotStrictlyPositiveException, throws NotPositiveException, NotStrictlyPositiveException,
@ -376,6 +377,7 @@ public class TestUtils {
/** /**
* @see org.apache.commons.math3.stat.inference.GTest#gTest( double[], long[] ) * @see org.apache.commons.math3.stat.inference.GTest#gTest( double[], long[] )
* @since 3.1
*/ */
public static double gTest(final double[] expected, final long[] observed) public static double gTest(final double[] expected, final long[] observed)
throws NotPositiveException, NotStrictlyPositiveException, throws NotPositiveException, NotStrictlyPositiveException,
@ -385,6 +387,7 @@ public class TestUtils {
/** /**
* @see org.apache.commons.math3.stat.inference.GTest#gTestIntrinsic(double[], long[] ) * @see org.apache.commons.math3.stat.inference.GTest#gTestIntrinsic(double[], long[] )
* @since 3.1
*/ */
public static double gTestIntrinsic(final double[] expected, final long[] observed) public static double gTestIntrinsic(final double[] expected, final long[] observed)
throws NotPositiveException, NotStrictlyPositiveException, throws NotPositiveException, NotStrictlyPositiveException,
@ -394,6 +397,7 @@ public class TestUtils {
/** /**
* @see org.apache.commons.math3.stat.inference.GTest#gTest( double[],long[],double) * @see org.apache.commons.math3.stat.inference.GTest#gTest( double[],long[],double)
* @since 3.1
*/ */
public static boolean gTest(final double[] expected, final long[] observed, public static boolean gTest(final double[] expected, final long[] observed,
final double alpha) final double alpha)
@ -404,6 +408,7 @@ public class TestUtils {
/** /**
* @see org.apache.commons.math3.stat.inference.GTest#gDataSetsComparison(long[], long[]) * @see org.apache.commons.math3.stat.inference.GTest#gDataSetsComparison(long[], long[])
* @since 3.1
*/ */
public static double gDataSetsComparison(final long[] observed1, public static double gDataSetsComparison(final long[] observed1,
final long[] observed2) final long[] observed2)
@ -413,6 +418,7 @@ public class TestUtils {
/** /**
* @see org.apache.commons.math3.stat.inference.GTest#rootLogLikelihoodRatio(long, long, long, long) * @see org.apache.commons.math3.stat.inference.GTest#rootLogLikelihoodRatio(long, long, long, long)
* @since 3.1
*/ */
public static double rootLogLikelihoodRatio(final long k11, final long k12, final long k21, final long k22) public static double rootLogLikelihoodRatio(final long k11, final long k12, final long k21, final long k22)
throws DimensionMismatchException, NotPositiveException, ZeroException { throws DimensionMismatchException, NotPositiveException, ZeroException {
@ -422,7 +428,7 @@ public class TestUtils {
/** /**
* @see org.apache.commons.math3.stat.inference.GTest#gTestDataSetsComparison(long[], long[]) * @see org.apache.commons.math3.stat.inference.GTest#gTestDataSetsComparison(long[], long[])
* * @since 3.1
*/ */
public static double gTestDataSetsComparison(final long[] observed1, public static double gTestDataSetsComparison(final long[] observed1,
final long[] observed2) final long[] observed2)
@ -433,6 +439,7 @@ public class TestUtils {
/** /**
* @see org.apache.commons.math3.stat.inference.GTest#gTestDataSetsComparison(long[],long[],double) * @see org.apache.commons.math3.stat.inference.GTest#gTestDataSetsComparison(long[],long[],double)
* @since 3.1
*/ */
public static boolean gTestDataSetsComparison(final long[] observed1, public static boolean gTestDataSetsComparison(final long[] observed1,
final long[] observed2, final long[] observed2,

View File

@ -49,6 +49,8 @@ public enum NaNStrategy {
/** NaNs are left in place */ /** NaNs are left in place */
FIXED, FIXED,
/** NaNs result in an exception */ /** NaNs result in an exception
* @since 3.1
*/
FAILED FAILED
} }

View File

@ -967,6 +967,7 @@ public final class ArithmeticUtils {
* @throws NumberIsTooLargeException if {@code k > n}. * @throws NumberIsTooLargeException if {@code k > n}.
* @throws MathArithmeticException if some overflow happens, typically for n exceeding 25 and * @throws MathArithmeticException if some overflow happens, typically for n exceeding 25 and
* k between 20 and n-2 (S(n,n-1) is handled specifically and does not overflow) * k between 20 and n-2 (S(n,n-1) is handled specifically and does not overflow)
* @since 3.1
*/ */
public static long stirlingS2(final int n, final int k) public static long stirlingS2(final int n, final int k)
throws NotPositiveException, NumberIsTooLargeException, MathArithmeticException { throws NotPositiveException, NumberIsTooLargeException, MathArithmeticException {

View File

@ -1606,6 +1606,7 @@ public class FastMath {
* @param d Number to raise. * @param d Number to raise.
* @param e Exponent. * @param e Exponent.
* @return d<sup>e</sup> * @return d<sup>e</sup>
* @since 3.1
*/ */
public static double pow(double d, int e) { public static double pow(double d, int e) {

View File

@ -54,6 +54,7 @@ public class IterationManager {
* @param callBack the function to be called when the maximum number of * @param callBack the function to be called when the maximum number of
* iterations has been reached * iterations has been reached
* @throws org.apache.commons.math3.exception.NullArgumentException if {@code callBack} is {@code null} * @throws org.apache.commons.math3.exception.NullArgumentException if {@code callBack} is {@code null}
* @since 3.1
*/ */
public IterationManager(final int maxIterations, public IterationManager(final int maxIterations,
final Incrementor.MaxCountExceededCallback callBack) { final Incrementor.MaxCountExceededCallback callBack) {

View File

@ -49,6 +49,7 @@ public class MathArrays {
/** /**
* Real-valued function that operate on an array or a part of it. * Real-valued function that operate on an array or a part of it.
* @since 3.1
*/ */
public interface Function { public interface Function {
/** /**
@ -77,6 +78,7 @@ public class MathArrays {
* @param b Second term of the addition. * @param b Second term of the addition.
* @return a new array {@code r} where {@code r[i] = a[i] + b[i]}. * @return a new array {@code r} where {@code r[i] = a[i] + b[i]}.
* @throws DimensionMismatchException if the array lengths differ. * @throws DimensionMismatchException if the array lengths differ.
* @since 3.1
*/ */
public static double[] ebeAdd(double[] a, public static double[] ebeAdd(double[] a,
double[] b) { double[] b) {
@ -98,6 +100,7 @@ public class MathArrays {
* @param b Element to be subtracted. * @param b Element to be subtracted.
* @return a new array {@code r} where {@code r[i] = a[i] - b[i]}. * @return a new array {@code r} where {@code r[i] = a[i] - b[i]}.
* @throws DimensionMismatchException if the array lengths differ. * @throws DimensionMismatchException if the array lengths differ.
* @since 3.1
*/ */
public static double[] ebeSubtract(double[] a, public static double[] ebeSubtract(double[] a,
double[] b) { double[] b) {
@ -119,6 +122,7 @@ public class MathArrays {
* @param b Second factor of the multiplication. * @param b Second factor of the multiplication.
* @return a new array {@code r} where {@code r[i] = a[i] * b[i]}. * @return a new array {@code r} where {@code r[i] = a[i] * b[i]}.
* @throws DimensionMismatchException if the array lengths differ. * @throws DimensionMismatchException if the array lengths differ.
* @since 3.1
*/ */
public static double[] ebeMultiply(double[] a, public static double[] ebeMultiply(double[] a,
double[] b) { double[] b) {
@ -140,6 +144,7 @@ public class MathArrays {
* @param b Denominator of the division. * @param b Denominator of the division.
* @return a new array {@code r} where {@code r[i] = a[i] / b[i]}. * @return a new array {@code r} where {@code r[i] = a[i] / b[i]}.
* @throws DimensionMismatchException if the array lengths differ. * @throws DimensionMismatchException if the array lengths differ.
* @since 3.1
*/ */
public static double[] ebeDivide(double[] a, public static double[] ebeDivide(double[] a,
double[] b) { double[] b) {
@ -416,6 +421,7 @@ public class MathArrays {
* @param in array to be tested * @param in array to be tested
* @throws NullArgumentException if input array is null * @throws NullArgumentException if input array is null
* @throws DimensionMismatchException if input array is not rectangular * @throws DimensionMismatchException if input array is not rectangular
* @since 3.1
*/ */
public static void checkRectangular(final long[][] in) public static void checkRectangular(final long[][] in)
throws NullArgumentException, DimensionMismatchException { throws NullArgumentException, DimensionMismatchException {
@ -435,6 +441,7 @@ public class MathArrays {
* @param in Array to be tested * @param in Array to be tested
* @throws NotStrictlyPositiveException if any entries of the array are not * @throws NotStrictlyPositiveException if any entries of the array are not
* strictly positive. * strictly positive.
* @since 3.1
*/ */
public static void checkPositive(final double[] in) public static void checkPositive(final double[] in)
throws NotStrictlyPositiveException { throws NotStrictlyPositiveException {
@ -450,6 +457,7 @@ public class MathArrays {
* *
* @param in Array to be tested * @param in Array to be tested
* @throws NotPositiveException if any array entries are less than 0. * @throws NotPositiveException if any array entries are less than 0.
* @since 3.1
*/ */
public static void checkNonNegative(final long[] in) public static void checkNonNegative(final long[] in)
throws NotPositiveException { throws NotPositiveException {
@ -465,6 +473,7 @@ public class MathArrays {
* *
* @param in Array to be tested * @param in Array to be tested
* @throws NotPositiveException if any array entries are less than 0. * @throws NotPositiveException if any array entries are less than 0.
* @since 3.1
*/ */
public static void checkNonNegative(final long[][] in) public static void checkNonNegative(final long[][] in)
throws NotPositiveException { throws NotPositiveException {

View File

@ -78,6 +78,7 @@ public class Pair<K, V> {
* Get the first element of the pair. * Get the first element of the pair.
* *
* @return the first element of the pair. * @return the first element of the pair.
* @since 3.1
*/ */
public K getFirst() { public K getFirst() {
return key; return key;
@ -87,6 +88,7 @@ public class Pair<K, V> {
* Get the second element of the pair. * Get the second element of the pair.
* *
* @return the second element of the pair. * @return the second element of the pair.
* @since 3.1
*/ */
public V getSecond() { public V getSecond() {
return value; return value;

View File

@ -282,6 +282,7 @@ public class Precision {
* @param eps Amount of allowed relative error. * @param eps Amount of allowed relative error.
* @return {@code true} if the values are two adjacent floating point * @return {@code true} if the values are two adjacent floating point
* numbers or they are within range of each other. * numbers or they are within range of each other.
* @since 3.1
*/ */
public static boolean equalsWithRelativeTolerance(double x, double y, double eps) { public static boolean equalsWithRelativeTolerance(double x, double y, double eps) {
if (equals(x, y, 1)) { if (equals(x, y, 1)) {

View File

@ -145,6 +145,7 @@ public class ResizableDoubleArray implements DoubleArray, Serializable {
/** /**
* Specification of expansion algorithm. * Specification of expansion algorithm.
* @since 3.1
*/ */
public static enum ExpansionMode { public static enum ExpansionMode {
/** Multiplicative expansion mode. */ /** Multiplicative expansion mode. */
@ -259,6 +260,7 @@ public class ResizableDoubleArray implements DoubleArray, Serializable {
* @param expansionFactor The array will be expanded based on this * @param expansionFactor The array will be expanded based on this
* parameter. * parameter.
* @throws MathIllegalArgumentException if parameters are not valid. * @throws MathIllegalArgumentException if parameters are not valid.
* @since 3.1
*/ */
public ResizableDoubleArray(int initialCapacity, public ResizableDoubleArray(int initialCapacity,
double expansionFactor) double expansionFactor)
@ -317,6 +319,7 @@ public class ResizableDoubleArray implements DoubleArray, Serializable {
* parameter. * parameter.
* @param contractionCriterion Contraction criterion. * @param contractionCriterion Contraction criterion.
* @throws MathIllegalArgumentException if the parameters are not valid. * @throws MathIllegalArgumentException if the parameters are not valid.
* @since 3.1
*/ */
public ResizableDoubleArray(int initialCapacity, public ResizableDoubleArray(int initialCapacity,
double expansionFactor, double expansionFactor,
@ -541,6 +544,7 @@ public class ResizableDoubleArray implements DoubleArray, Serializable {
* @throws NumberIsTooSmallException if {@code contraction < expansion}. * @throws NumberIsTooSmallException if {@code contraction < expansion}.
* @throws NumberIsTooSmallException if {@code contraction <= 1}. * @throws NumberIsTooSmallException if {@code contraction <= 1}.
* @throws NumberIsTooSmallException if {@code expansion <= 1 }. * @throws NumberIsTooSmallException if {@code expansion <= 1 }.
* @since 3.1
*/ */
protected void checkContractExpand(double contraction, protected void checkContractExpand(double contraction,
double expansion) double expansion)
@ -735,6 +739,7 @@ public class ResizableDoubleArray implements DoubleArray, Serializable {
* <code>contractionFactor.</code> * <code>contractionFactor.</code>
* *
* @return the contraction criterion used to reclaim memory. * @return the contraction criterion used to reclaim memory.
* @since 3.1
*/ */
public double getContractionCriterion() { public double getContractionCriterion() {
return contractionCriterion; return contractionCriterion;
@ -829,6 +834,7 @@ public class ResizableDoubleArray implements DoubleArray, Serializable {
* elements actually stored}. * elements actually stored}.
* *
* @return the length of the internal array. * @return the length of the internal array.
* @since 3.1
*/ */
public int getCapacity() { public int getCapacity() {
return internalArray.length; return internalArray.length;
@ -922,6 +928,7 @@ public class ResizableDoubleArray implements DoubleArray, Serializable {
* *
* @param f Function to be applied on this array. * @param f Function to be applied on this array.
* @return the result. * @return the result.
* @since 3.1
*/ */
public double compute(MathArrays.Function f) { public double compute(MathArrays.Function f) {
return f.evaluate(internalArray, startIndex, numElements); return f.evaluate(internalArray, startIndex, numElements);