commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r980981 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/analysis/ main/java/org/apache/commons/math/analysis/interpolation/ main/java/org/apache/commons/math/distribution/ main/java/org/apache/commons/math/exception/ ...
Date Fri, 30 Jul 2010 22:03:05 GMT
Author: luc
Date: Fri Jul 30 22:03:04 2010
New Revision: 980981

URL: http://svn.apache.org/viewvc?rev=980981&view=rev
Log:
fixed numerous checkstyle warnings (javadoc, trailing spaces, tabs, parenthesis, declaration order ...)

Added:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/package.html   (with props)
Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/BivariateRealFunction.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/TrivariateRealFunction.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatingFunction.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/LinearInterpolator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/SmoothingBicubicSplineInterpolator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/SplineInterpolator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolatingFunction.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/TrivariateRealGridInterpolator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathIllegalArgumentException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathIllegalNumberException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NumberIsTooLargeException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NumberIsTooSmallException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/ExtendedFirstOrderDifferentialEquations.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/jacobians/FirstOrderIntegratorWithJacobians.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultivariateRealOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/RealPointValuePair.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/VectorialPointValuePair.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarDifferentiableOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/PowellOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BracketFinder.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BrentOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/DummyLocalizable.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MultidimensionalCounter.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/BivariateRealFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/BivariateRealFunction.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/BivariateRealFunction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/BivariateRealFunction.java Fri Jul 30 22:03:04 2010
@@ -34,7 +34,7 @@ public interface BivariateRealFunction {
      * @return the value.
      * @throws FunctionEvaluationException if the function evaluation fails.
      */
-    public double value(double x, double y)
+    double value(double x, double y)
         throws FunctionEvaluationException;
 
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/TrivariateRealFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/TrivariateRealFunction.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/TrivariateRealFunction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/TrivariateRealFunction.java Fri Jul 30 22:03:04 2010
@@ -35,6 +35,6 @@ public interface TrivariateRealFunction 
      * @return the value.
      * @throws FunctionEvaluationException if the function evaluation fails.
      */
-    public double value(double x, double y, double z)
+    double value(double x, double y, double z)
         throws FunctionEvaluationException;
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatingFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatingFunction.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatingFunction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatingFunction.java Fri Jul 30 22:03:04 2010
@@ -20,7 +20,6 @@ import org.apache.commons.math.Dimension
 import org.apache.commons.math.FunctionEvaluationException;
 import org.apache.commons.math.analysis.BivariateRealFunction;
 import org.apache.commons.math.exception.NoDataException;
-import org.apache.commons.math.exception.NonMonotonousSequenceException;
 import org.apache.commons.math.exception.OutOfRangeException;
 import org.apache.commons.math.util.MathUtils;
 
@@ -86,8 +85,8 @@ public class BicubicSplineInterpolatingF
      * every grid point.
      * @throws DimensionMismatchException if the various arrays do not contain
      * the expected number of elements.
-     * @throws NonMonotonousSequenceException if {@code x} or {@code y} are not strictly
-     * increasing.
+     * @throws org.apache.commons.math.exception.NonMonotonousSequenceException
+     * if {@code x} or {@code y} are not strictly increasing.
      * @throws NoDataException if any of the arrays has zero length.
      */
     public BicubicSplineInterpolatingFunction(double[] x,
@@ -346,23 +345,37 @@ public class BicubicSplineInterpolatingF
  */
 class BicubicSplineFunction
     implements BivariateRealFunction {
+
+    /** Number of points. */
     private static final short N = 4;
+
     /** Coefficients */
-    private final double[][] a = new double[N][N];
-    /** Partial derivatives */
-    BivariateRealFunction partialDerivativeX = null;
-    BivariateRealFunction partialDerivativeY = null;
-    BivariateRealFunction partialDerivativeXX = null;
-    BivariateRealFunction partialDerivativeYY = null;
-    BivariateRealFunction partialDerivativeXY = null;
+    private final double[][] a;
+
+    /** First partial derivative along x. */
+    private BivariateRealFunction partialDerivativeX;
+
+    /** First partial derivative along y. */
+    private BivariateRealFunction partialDerivativeY;
+
+    /** Second partial derivative along x. */
+    private BivariateRealFunction partialDerivativeXX;
+
+    /** Second partial derivative along y. */
+    private BivariateRealFunction partialDerivativeYY;
+
+    /** Second crossed partial derivative. */
+    private BivariateRealFunction partialDerivativeXY;
 
     /**
+     * Simple constructor.
      * @param a Spline coefficients
      */
-    public BicubicSplineFunction(double[] aV) {
+    public BicubicSplineFunction(double[] a) {
+        this.a = new double[N][N];
         for (int i = 0; i < N; i++) {
             for (int j = 0; j < N; j++) {
-                a[i][j] = aV[i + N * j];
+                this.a[i][j] = a[i + N * j];
             }
         }
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/LinearInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/LinearInterpolator.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/LinearInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/LinearInterpolator.java Fri Jul 30 22:03:04 2010
@@ -25,6 +25,7 @@ import org.apache.commons.math.util.Loca
 
 /**
  * Implements a linear function for interpolation of real univariate functions.
+ * @version $Revision$ $Date$
  */
 public class LinearInterpolator implements UnivariateRealInterpolator {
     /**
@@ -34,8 +35,8 @@ public class LinearInterpolator implemen
      * @return a function which interpolates the data set
      * @throws DimensionMismatchException if {@code x} and {@code y}
      * have different sizes.
-     * @throws NonMonotonousSequenceException if {@code x} is not sorted in
-     * strict increasing order.
+     * @throws org.apache.commons.math.exception.NonMonotonousSequenceException
+     * if {@code x} is not sorted in strict increasing order.
      * @throws NumberIsTooSmallException if the size of {@code x} is smaller
      * than 2.
      */

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/SmoothingBicubicSplineInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/SmoothingBicubicSplineInterpolator.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/SmoothingBicubicSplineInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/SmoothingBicubicSplineInterpolator.java Fri Jul 30 22:03:04 2010
@@ -21,6 +21,7 @@ import org.apache.commons.math.MathRunti
 import org.apache.commons.math.MathException;
 import org.apache.commons.math.util.LocalizedFormats;
 import org.apache.commons.math.util.MathUtils;
+import org.apache.commons.math.util.MathUtils.Order;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.analysis.polynomials.PolynomialSplineFunction;
 
@@ -55,8 +56,8 @@ public class SmoothingBicubicSplineInter
             throw new DimensionMismatchException(xval.length, zval.length);
         }
 
-        MathUtils.checkOrder(xval, 1, true);
-        MathUtils.checkOrder(yval, 1, true);
+        MathUtils.checkOrder(xval, Order.Direction.INCREASING, true);
+        MathUtils.checkOrder(yval, Order.Direction.INCREASING, true);
 
         final int xLen = xval.length;
         final int yLen = yval.length;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/SmoothingPolynomialBicubicSplineInterpolator.java Fri Jul 30 22:03:04 2010
@@ -34,7 +34,11 @@ import org.apache.commons.math.analysis.
  */
 public class SmoothingPolynomialBicubicSplineInterpolator
     extends BicubicSplineInterpolator {
+
+    /** Fitter for x. */
     private final PolynomialFitter xFitter;
+
+    /** Fitter for y. */
     private final PolynomialFitter yFitter;
 
     /**

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/SplineInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/SplineInterpolator.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/SplineInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/SplineInterpolator.java Fri Jul 30 22:03:04 2010
@@ -59,8 +59,8 @@ public class SplineInterpolator implemen
      * @return a function which interpolates the data set
      * @throws DimensionMismatchException if {@code x} and {@code y}
      * have different sizes.
-     * @throws NonMonotonousSequenceException if {@code x} is not sorted in
-     * strict increasing order.
+     * @throws org.apache.commons.math.exception.NonMonotonousSequenceException
+     * if {@code x} is not sorted in strict increasing order.
      * @throws NumberIsTooSmallException if the size of {@code x} is smaller
      * than 3.
      */

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolatingFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolatingFunction.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolatingFunction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/TricubicSplineInterpolatingFunction.java Fri Jul 30 22:03:04 2010
@@ -126,6 +126,8 @@ public class TricubicSplineInterpolating
      * to x on every grid point.
      * @param dFdY Values of the partial derivative of function with respect
      * to y on every grid point.
+     * @param dFdZ Values of the partial derivative of function with respect
+     * to z on every grid point.
      * @param d2FdXdY Values of the cross partial derivative of function on
      * every grid point.
      * @param d2FdXdZ Values of the cross partial derivative of function on
@@ -155,8 +157,7 @@ public class TricubicSplineInterpolating
         final int yLen = y.length;
         final int zLen = z.length;
 
-        if (xLen == 0 || yLen == 0 || z.length == 0
-            || f.length == 0 || f[0].length == 0) {
+        if (xLen == 0 || yLen == 0 || z.length == 0 || f.length == 0 || f[0].length == 0) {
             throw new NoDataException();
         }
         if (xLen != f.length) {
@@ -421,8 +422,8 @@ public class TricubicSplineInterpolating
  */
 class TricubicSplineFunction
     implements TrivariateRealFunction {
+    /** Number of points. */
     private static final short N = 4;
-    private static final short N2 = N * N;
     /** Coefficients */
     private final double[][][] a = new double[N][N][N];
 
@@ -433,7 +434,7 @@ class TricubicSplineFunction
         for (int i = 0; i < N; i++) {
             for (int j = 0; j < N; j++) {
                 for (int k = 0; k < N; k++) {
-                    a[i][j][k] = aV[i + N * j + N2 * k];
+                    a[i][j][k] = aV[i + N * (j + N * k)];
                 }
             }
         }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/TrivariateRealGridInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/TrivariateRealGridInterpolator.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/TrivariateRealGridInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/TrivariateRealGridInterpolator.java Fri Jul 30 22:03:04 2010
@@ -39,8 +39,8 @@ public interface TrivariateRealGridInter
      * @param fval the values of the interpolation points on all the grid knots:
      * {@code fval[i][j][k] = f(xval[i], yval[j], zval[k])}.
      * @return a function that interpolates the data set.
-     * @throws NoDataException if any of the arrays has zero length.
-     * @throws DimensionMismatchException if the array lengths are inconsistent.
+     * @throws org.apache.commons.math.exception.NoDataException if any of the arrays has zero length.
+     * @throws org.apache.commons.math.exception.DimensionMismatchException if the array lengths are inconsistent.
      * @throws MathException if arguments violate assumptions made by the
      *         interpolation algorithm.
      */

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractContinuousDistribution.java Fri Jul 30 22:03:04 2010
@@ -41,7 +41,7 @@ public abstract class AbstractContinuous
 
     /** Serializable version identifier */
     private static final long serialVersionUID = -38038050983108802L;
-    
+
     /**
      * RandomData instance used to generate samples from the distribution
      * @since 2.2

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathIllegalArgumentException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathIllegalArgumentException.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathIllegalArgumentException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathIllegalArgumentException.java Fri Jul 30 22:03:04 2010
@@ -48,7 +48,7 @@ public class MathIllegalArgumentExceptio
      * Arguments used to build the message.
      */
     private final Object[] arguments;
-    
+
     /**
      * @param specific Message pattern providing the specific context of
      * the error.
@@ -84,7 +84,7 @@ public class MathIllegalArgumentExceptio
 
         return sb.toString();
     }
-    
+
     /** {@inheritDoc} */
     @Override
     public String getLocalizedMessage() {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathIllegalNumberException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathIllegalNumberException.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathIllegalNumberException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/MathIllegalNumberException.java Fri Jul 30 22:03:04 2010
@@ -40,8 +40,8 @@ public class MathIllegalNumberException 
      *
      * @param specific Localizable pattern.
      * @param general Localizable pattern.
-     * @param arguments Arguments. The first element must be the requested
-     * value that raised the exception.
+     * @param wrong wrong number
+     * @param arguments Arguments.
      */
     protected MathIllegalNumberException(Localizable specific,
                                          Localizable general,
@@ -55,8 +55,8 @@ public class MathIllegalNumberException 
      * Construct an exception.
      *
      * @param general Localizable pattern.
-     * @param arguments Arguments. The first element must be the requested
-     * value that raised the exception.
+     * @param wrong wrong number
+     * @param arguments Arguments.
      */
     protected MathIllegalNumberException(Localizable general,
                                          Number wrong,

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NumberIsTooLargeException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NumberIsTooLargeException.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NumberIsTooLargeException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NumberIsTooLargeException.java Fri Jul 30 22:03:04 2010
@@ -44,6 +44,7 @@ public class NumberIsTooLargeException e
      *
      * @param wrong Value that is larger than the maximum.
      * @param max maximum.
+     * @param boundIsAllowed if true the maximum is included in the allowed range.
      */
     public NumberIsTooLargeException(Number wrong,
                                      Number max,
@@ -56,15 +57,16 @@ public class NumberIsTooLargeException e
      * @param specific Specific contexte pattern .
      * @param wrong Value that is larger than the maximum.
      * @param max maximum.
+     * @param boundIsAllowed if true the maximum is included in the allowed range.
      */
     public NumberIsTooLargeException(Localizable specific,
                                      Number wrong,
                                      Number max,
                                      boolean boundIsAllowed) {
         super(specific,
-              (boundIsAllowed ?
-               LocalizedFormats.NUMBER_TOO_LARGE :
-               LocalizedFormats.NUMBER_TOO_LARGE_BOUND_EXCLUDED),
+              boundIsAllowed ?
+              LocalizedFormats.NUMBER_TOO_LARGE :
+              LocalizedFormats.NUMBER_TOO_LARGE_BOUND_EXCLUDED,
               wrong, max);
 
         this.max = max;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NumberIsTooSmallException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NumberIsTooSmallException.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NumberIsTooSmallException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/NumberIsTooSmallException.java Fri Jul 30 22:03:04 2010
@@ -65,9 +65,9 @@ public class NumberIsTooSmallException e
                                      Number min,
                                      boolean boundIsAllowed) {
         super(specific,
-              (boundIsAllowed ?
-               LocalizedFormats.NUMBER_TOO_SMALL :
-               LocalizedFormats.NUMBER_TOO_SMALL_BOUND_EXCLUDED),
+              boundIsAllowed ?
+              LocalizedFormats.NUMBER_TOO_SMALL :
+              LocalizedFormats.NUMBER_TOO_SMALL_BOUND_EXCLUDED,
               wrong, min);
 
         this.min = min;

Added: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/package.html
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/package.html?rev=980981&view=auto
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/package.html (added)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/package.html Fri Jul 30 22:03:04 2010
@@ -0,0 +1,22 @@
+<html>
+<!--
+   Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+  -->
+    <!-- $Revision$ $Date$ -->
+    <body>
+     Specialized exceptions for algorithms errors.
+    </body>
+</html>

Propchange: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/package.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/package.html
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/AbstractRealVector.java Fri Jul 30 22:03:04 2010
@@ -887,8 +887,8 @@ public abstract class AbstractRealVector
             dim = getDimension();
             current = new EntryImpl();
             next = new EntryImpl();
-            if(next.getValue() == 0){
-            	advance(next);
+            if (next.getValue() == 0) {
+                advance(next);
             }
         }
 
@@ -914,13 +914,13 @@ public abstract class AbstractRealVector
 
         /** {@inheritDoc} */
         public Entry next() {
-        	int index = next.getIndex();
-        	if(index < 0){
-        		throw new NoSuchElementException();
-        	}
-        	current.setIndex(index);
-        	advance(next);
-        	return current;
+            int index = next.getIndex();
+            if (index < 0) {
+                throw new NoSuchElementException();
+            }
+            current.setIndex(index);
+            advance(next);
+            return current;
         }
 
         /** {@inheritDoc} */

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/ExtendedFirstOrderDifferentialEquations.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/ExtendedFirstOrderDifferentialEquations.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/ExtendedFirstOrderDifferentialEquations.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/ExtendedFirstOrderDifferentialEquations.java Fri Jul 30 22:03:04 2010
@@ -63,4 +63,4 @@ public interface ExtendedFirstOrderDiffe
      */
     int getMainSetDimension();
 
-}
\ No newline at end of file
+}

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/jacobians/FirstOrderIntegratorWithJacobians.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/jacobians/FirstOrderIntegratorWithJacobians.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/jacobians/FirstOrderIntegratorWithJacobians.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/jacobians/FirstOrderIntegratorWithJacobians.java Fri Jul 30 22:03:04 2010
@@ -28,7 +28,6 @@ import org.apache.commons.math.MathRunti
 import org.apache.commons.math.MaxEvaluationsExceededException;
 import org.apache.commons.math.ode.DerivativeException;
 import org.apache.commons.math.ode.ExtendedFirstOrderDifferentialEquations;
-import org.apache.commons.math.ode.FirstOrderDifferentialEquations;
 import org.apache.commons.math.ode.FirstOrderIntegrator;
 import org.apache.commons.math.ode.IntegratorException;
 import org.apache.commons.math.ode.events.EventException;
@@ -286,7 +285,7 @@ public class FirstOrderIntegratorWithJac
 
     /** Get the current value of the step start time t<sub>i</sub>.
      * <p>This method can be called during integration (typically by
-     * the object implementing the {@link FirstOrderDifferentialEquations
+     * the object implementing the {@link org.apache.commons.math.ode.FirstOrderDifferentialEquations
      * differential equations} problem) if the value of the current step that
      * is attempted is needed.</p>
      * <p>The result is undefined if the method is called outside of
@@ -299,7 +298,7 @@ public class FirstOrderIntegratorWithJac
 
     /** Get the current signed value of the integration stepsize.
      * <p>This method can be called during integration (typically by
-     * the object implementing the {@link FirstOrderDifferentialEquations
+     * the object implementing the {@link org.apache.commons.math.ode.FirstOrderDifferentialEquations
      * differential equations} problem) if the signed value of the current stepsize
      * that is tried is needed.</p>
      * <p>The result is undefined if the method is called outside of

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/nonstiff/AdaptiveStepsizeIntegrator.java Fri Jul 30 22:03:04 2010
@@ -76,6 +76,9 @@ public abstract class AdaptiveStepsizeIn
     /** Allowed relative vectorial error. */
     protected final double[] vecRelativeTolerance;
 
+    /** Main set dimension. */
+    protected int mainSetDimension;
+
     /** User supplied initial step. */
     private double initialStep;
 
@@ -85,9 +88,6 @@ public abstract class AdaptiveStepsizeIn
     /** Maximal step. */
     private final double maxStep;
 
-    /** Main set dimension. */
-    protected int mainSetDimension;
-
   /** Build an integrator with the given stepsize bounds.
    * The default step handler does nothing.
    * @param name name of the method

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultivariateRealOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultivariateRealOptimizer.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultivariateRealOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultivariateRealOptimizer.java Fri Jul 30 22:03:04 2010
@@ -27,6 +27,7 @@ import org.apache.commons.math.analysis.
  * Commons-Math. Users of the API are advised to base their code on
  * {@link MultivariateRealOptimizer} or on
  * {@link DifferentiableMultivariateRealOptimizer}.
+ * @param <T> the type of the objective function to be optimized
  *
  * @see MultivariateRealOptimizer
  * @see DifferentiableMultivariateRealOptimizer
@@ -98,7 +99,7 @@ public interface BaseMultivariateRealOpt
 
     /**
      * Optimize an objective function.
-     *     
+     *
      * @param f Objective function.
      * @param goalType Type of optimization goal: either {@link GoalType#MAXIMIZE}
      * or {@link GoalType#MINIMIZE}.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/RealPointValuePair.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/RealPointValuePair.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/RealPointValuePair.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/RealPointValuePair.java Fri Jul 30 22:03:04 2010
@@ -44,7 +44,7 @@ public class RealPointValuePair implemen
      * @param value value of an objective function at the point
      */
     public RealPointValuePair(final double[] point, final double value) {
-        this.point = (point == null ? null : point.clone());
+        this.point = (point == null) ? null : point.clone();
         this.value  = value;
     }
 
@@ -57,9 +57,9 @@ public class RealPointValuePair implemen
      */
     public RealPointValuePair(final double[] point, final double value,
                               final boolean copyArray) {
-        this.point = (copyArray ?
-                      (point == null ? null : point.clone()) :
-                      point);
+        this.point = copyArray ?
+                     ((point == null) ? null : point.clone()) :
+                     point;
         this.value  = value;
     }
 
@@ -67,7 +67,7 @@ public class RealPointValuePair implemen
      * @return a copy of the stored point
      */
     public double[] getPoint() {
-        return (point == null ? null : point.clone());
+        return (point == null) ? null : point.clone();
     }
 
     /** Get a reference to the point.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/VectorialPointValuePair.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/VectorialPointValuePair.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/VectorialPointValuePair.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/VectorialPointValuePair.java Fri Jul 30 22:03:04 2010
@@ -44,8 +44,8 @@ public class VectorialPointValuePair imp
      * @param value value of an objective function at the point
      */
     public VectorialPointValuePair(final double[] point, final double[] value) {
-        this.point = (point == null ? null : point.clone());
-        this.value = (value == null ? null : value.clone());
+        this.point = (point == null) ? null : point.clone();
+        this.value = (value == null) ? null : value.clone();
     }
 
     /** Build a point/objective function value pair.
@@ -57,19 +57,19 @@ public class VectorialPointValuePair imp
      */
     public VectorialPointValuePair(final double[] point, final double[] value,
                                    final boolean copyArray) {
-        this.point = (copyArray ?
-                      (point == null ? null : point.clone()) :
-                      point);
-        this.value = (copyArray ?
-                      (value == null ? null : value.clone()) :
-                      value);
+        this.point = copyArray ?
+                      ((point == null) ? null : point.clone()) :
+                      point;
+        this.value = copyArray ?
+                      ((value == null) ? null : value.clone()) :
+                      value;
     }
 
     /** Get the point.
      * @return a copy of the stored point
      */
     public double[] getPoint() {
-        return (point == null ? null : point.clone());
+        return (point == null) ? null : point.clone();
     }
 
     /** Get a reference to the point.
@@ -85,7 +85,7 @@ public class VectorialPointValuePair imp
      * @return a copy of the stored value of the objective function
      */
     public double[] getValue() {
-        return (value == null ? null : value.clone());
+        return (value == null) ? null : value.clone();
     }
 
     /** Get a reference to the value of the objective function.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/DirectSearchOptimizer.java Fri Jul 30 22:03:04 2010
@@ -260,8 +260,8 @@ public abstract class DirectSearchOptimi
         throws FunctionEvaluationException, OptimizationException,
         IllegalArgumentException {
 
-        if (startConfiguration == null
-            || startConfiguration.length != startPoint.length) {
+        if ((startConfiguration == null) ||
+            (startConfiguration.length != startPoint.length)) {
             // no initial configuration has been set up for simplex
             // build a default one from a unit hypercube
             final double[] unit = new double[startPoint.length];

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarDifferentiableOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarDifferentiableOptimizer.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarDifferentiableOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarDifferentiableOptimizer.java Fri Jul 30 22:03:04 2010
@@ -25,7 +25,6 @@ import org.apache.commons.math.optimizat
 import org.apache.commons.math.optimization.OptimizationException;
 import org.apache.commons.math.optimization.RealConvergenceChecker;
 import org.apache.commons.math.optimization.RealPointValuePair;
-import org.apache.commons.math.optimization.SimpleScalarValueChecker;
 
 /**
  * Base class for implementing optimizers for multivariate scalar
@@ -38,10 +37,6 @@ import org.apache.commons.math.optimizat
 public abstract class AbstractScalarDifferentiableOptimizer
     extends BaseAbstractScalarOptimizer<DifferentiableMultivariateRealFunction>
     implements DifferentiableMultivariateRealOptimizer {
-    /** Number of gradient evaluations. */
-    private int gradientEvaluations;
-    /** Objective function gradient. */
-    private MultivariateVectorialFunction gradient;
 
     /** Convergence checker.
      * @deprecated in 2.2 (to be removed in 3.0). Please use the accessor
@@ -60,9 +55,15 @@ public abstract class AbstractScalarDiff
      */
     protected double[] point;
 
+    /** Number of gradient evaluations. */
+    private int gradientEvaluations;
+
+    /** Objective function gradient. */
+    private MultivariateVectorialFunction gradient;
+
     /**
      * Simple constructor with default settings.
-     * The convergence check is set to a {@link SimpleScalarValueChecker},
+     * The convergence check is set to a {@link org.apache.commons.math.optimization.SimpleScalarValueChecker},
      * the allowed number of iterations and evaluations are set to their
      * default values.
      */

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarOptimizer.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractScalarOptimizer.java Fri Jul 30 22:03:04 2010
@@ -20,7 +20,6 @@ package org.apache.commons.math.optimiza
 import org.apache.commons.math.analysis.MultivariateRealFunction;
 import org.apache.commons.math.optimization.MultivariateRealOptimizer;
 import org.apache.commons.math.optimization.RealConvergenceChecker;
-import org.apache.commons.math.optimization.SimpleScalarValueChecker;
 
 /**
  * Base class for implementing optimizers for multivariate (not necessarily
@@ -34,7 +33,7 @@ public abstract class AbstractScalarOpti
     implements MultivariateRealOptimizer {
     /**
      * Simple constructor with default settings.
-     * The convergence check is set to a {@link SimpleScalarValueChecker},
+     * The convergence check is set to a {@link org.apache.commons.math.optimization.SimpleScalarValueChecker},
      * the allowed number of iterations and evaluations are set to their
      * default values.
      */

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizer.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizer.java Fri Jul 30 22:03:04 2010
@@ -230,10 +230,10 @@ public class LevenbergMarquardtOptimizer
      * during QR decomposition, it is considered to be a zero vector and hence the
      * rank of the matrix is reduced.
      * </p>
-     * @param qrRankingThreshold threshold for QR ranking
+     * @param threshold threshold for QR ranking
      */
-    public void setQRRankingThreshold(final double qrRankingThreshold) {
-        this.qrRankingThreshold = qrRankingThreshold;
+    public void setQRRankingThreshold(final double threshold) {
+        this.qrRankingThreshold = threshold;
     }
 
     /** {@inheritDoc} */

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/PowellOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/PowellOptimizer.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/PowellOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/PowellOptimizer.java Fri Jul 30 22:03:04 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.optimization.general;
 
 import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.optimization.GoalType;
 import org.apache.commons.math.optimization.OptimizationException;
@@ -61,7 +62,7 @@ public class PowellOptimizer
     public PowellOptimizer(double lineSearchTolerance) {
         line = new LineSearch(lineSearchTolerance);
     }
-    
+
     /** {@inheritDoc} */
     @Override
     protected RealPointValuePair doOptimize()
@@ -70,35 +71,35 @@ public class PowellOptimizer
         final GoalType goal = getGoalType();
         final double[] guess = getStartPoint();
         final int n = guess.length;
-        
+
         final double[][] direc = new double[n][n];
         for (int i = 0; i < n; i++) {
             direc[i][i] = 1;
         }
-        
+
         double[] x = guess;
         double fVal = computeObjectiveValue(x);
         double[] x1 = x.clone();
         while (true) {
             incrementIterationsCounter();
-            
+
             double fX = fVal;
             double fX2 = 0;
             double delta = 0;
             int bigInd = 0;
             double alphaMin = 0;
-            
+
             double[] direc1 = new double[n];
             for (int i = 0; i < n; i++) {
                 direc1 = direc[i];
-            
+
                 fX2 = fVal;
-            
+
                 line.search(x, direc1);
                 fVal = line.getValueAtOptimum();
                 alphaMin = line.getOptimum();
                 setNewPointAndDirection(x, direc1, alphaMin);
-       
+
                 if ((fX2 - fVal) > delta) {
                     delta = fX2 - fVal;
                     bigInd = i;
@@ -108,14 +109,13 @@ public class PowellOptimizer
             final RealPointValuePair previous = new RealPointValuePair(x1, fX);
             final RealPointValuePair current = new RealPointValuePair(x, fVal);
             if (getConvergenceChecker().converged(getIterations(), previous, current)) {
-                switch (goal) {
-                case MINIMIZE:
-                    return (fVal < fX ? current : previous);
-                case MAXIMIZE:
-                    return (fVal > fX ? current : previous);
+                if (goal == GoalType.MINIMIZE) {
+                    return (fVal < fX) ? current : previous;
+                } else {
+                    return (fVal > fX) ? current : previous;
                 }
             }
-            
+
             double[] x2 = new double[n];
             for (int i = 0; i < n; i++) {
                 direc1[i] = x[i] - x1[i];
@@ -137,7 +137,7 @@ public class PowellOptimizer
                     fVal = line.getValueAtOptimum();
                     alphaMin = line.getOptimum();
                     setNewPointAndDirection(x, direc1, alphaMin);
-                    
+
                     final int lastInd = n - 1;
                     direc[bigInd] = direc[lastInd];
                     direc[lastInd] = direc1;
@@ -200,6 +200,8 @@ public class PowellOptimizer
          *
          * @param p Starting point.
          * @param d Search direction.
+         * @throws OptimizationException if function cannot be evaluated at some test point
+         * or algorithm fails to converge
          */
         public void search(final double[] p,
                            final double[] d)
@@ -225,7 +227,9 @@ public class PowellOptimizer
                                          bracket.getHi(),
                                          bracket.getMid());
                 valueAtOptimum = f.value(optimum);
-            } catch (Exception e) {
+            } catch (FunctionEvaluationException e) {
+                throw new OptimizationException(e);
+            } catch (MaxIterationsExceededException e) {
                 throw new OptimizationException(e);
             }
         }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java Fri Jul 30 22:03:04 2010
@@ -258,6 +258,10 @@ public abstract class AbstractUnivariate
      * classes.
      *
      * @return the optimum.
+     * @throws MaxIterationsExceededException if the maximum iteration count
+     * is exceeded.
+     * @throws FunctionEvaluationException if an error occurs evaluating
+     * the function.
      */
     protected abstract double doOptimize()
         throws MaxIterationsExceededException, FunctionEvaluationException;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BracketFinder.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BracketFinder.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BracketFinder.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BracketFinder.java Fri Jul 30 22:03:04 2010
@@ -26,8 +26,11 @@ import org.apache.commons.math.optimizat
  * Provide an interval that brackets a local optimum of a function.
  * This code is based on a Python implementation (from <em>SciPy</em>,
  * module {@code optimize.py} v0.5).
+ * @version $Revision$ $Date$
+ * @since 2.2
  */
 public class BracketFinder {
+    /** Tolerance to avoid division by zero. */
     private static final double EPS_MIN = 1e-21;
     /**
      * Golden section.
@@ -109,6 +112,10 @@ public class BracketFinder {
      * @param goal {@link GoalType Goal type}.
      * @param xA Initial point.
      * @param xB Initial point.
+     * @throws MaxIterationsExceededException if the maximum iteration count
+     * is exceeded.
+     * @throws FunctionEvaluationException if an error occurs evaluating
+     * the function.
      */
     public void search(UnivariateRealFunction func,
                        GoalType goal,
@@ -117,7 +124,7 @@ public class BracketFinder {
         throws MaxIterationsExceededException,
                FunctionEvaluationException {
         reset();
-        final boolean isMinim = (goal == GoalType.MINIMIZE);
+        final boolean isMinim = goal == GoalType.MINIMIZE;
 
         double fA = eval(func, xA);
         double fB = eval(func, xB);
@@ -140,7 +147,7 @@ public class BracketFinder {
             if (++iterations > maxIterations) {
                 throw new MaxIterationsExceededException(maxIterations);
             }
-            
+
             double tmp1 = (xB - xA) * (fB - fC);
             double tmp2 = (xB - xC) * (fB - fA);
 
@@ -239,9 +246,10 @@ public class BracketFinder {
     }
 
     /**
-     * @param func Function.
+     * @param f Function.
      * @param x Argument.
      * @return {@code f(x)}
+     * @throws FunctionEvaluationException if function cannot be evaluated at x
      */
     private double eval(UnivariateRealFunction f,
                         double x)

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BrentOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BrentOptimizer.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BrentOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BrentOptimizer.java Fri Jul 30 22:03:04 2010
@@ -46,11 +46,7 @@ public class BrentOptimizer extends Abst
         setRelativeAccuracy(1e-9);
     }
 
-    /**
-     * Perform the optimization.
-     *
-     * @return the optimum.
-     */
+    /** {@inheritDoc} */
     protected double doOptimize()
         throws MaxIterationsExceededException, FunctionEvaluationException {
         return localMin(getGoalType() == GoalType.MINIMIZE,
@@ -92,7 +88,8 @@ public class BrentOptimizer extends Abst
         if (t <= 0) {
             throw new NotStrictlyPositiveException(t);
         }
-        double a, b;
+        double a;
+        double b;
         if (lo < hi) {
             a = lo;
             b = hi;
@@ -140,16 +137,15 @@ public class BrentOptimizer extends Abst
                     r = e;
                     e = d;
 
-                    if (p > q * (a - x)
-                        && p < q * (b - x)
-                        && Math.abs(p) < Math.abs(0.5 * q * r)) {
+                    if (p > q * (a - x) &&
+                        p < q * (b - x) &&
+                        Math.abs(p) < Math.abs(0.5 * q * r)) {
                         // Parabolic interpolation step.
                         d = p / q;
                         u = x + d;
 
                         // f must not be evaluated too close to a or b.
-                        if (u - a < tol2
-                            || b - u < tol2) {
+                        if (u - a < tol2 || b - u < tol2) {
                             if (x <= m) {
                                 d = tol1;
                             } else {
@@ -210,15 +206,12 @@ public class BrentOptimizer extends Abst
                     } else {
                         b = u;
                     }
-                    if (fu <= fw
-                        || w == x) {
+                    if (fu <= fw || w == x) {
                         v = w;
                         fv = fw;
                         w = u;
                         fw = fu;
-                    } else if (fu <= fv
-                               || v == x
-                               || v == w) {
+                    } else if (fu <= fv || v == x || v == w) {
                         v = u;
                         fv = fu;
                     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/random/RandomDataImpl.java Fri Jul 30 22:03:04 2010
@@ -829,7 +829,7 @@ public class RandomDataImpl implements R
      * @param k
      *            size of the permutation (must satisfy 0 < k <= n).
      * @return the random permutation as an int array
-     * @throws NumberIsTooLargException if {@code k > n}.
+     * @throws NumberIsTooLargeException if {@code k > n}.
      * @throws NotStrictlyPositiveException if {@code k <= 0}.
      */
     public int[] nextPermutation(int n, int k) {

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/DummyLocalizable.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/DummyLocalizable.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/DummyLocalizable.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/DummyLocalizable.java Fri Jul 30 22:03:04 2010
@@ -32,7 +32,9 @@ public class DummyLocalizable implements
     /** Source string. */
     private final String source;
 
-    /** Simple constructor. */
+    /** Simple constructor.
+     * @param source source text
+     */
     public DummyLocalizable(final String source) {
         this.source = source;
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java Fri Jul 30 22:03:04 2010
@@ -493,7 +493,7 @@ public final class MathUtils {
             yInt = SGN_MASK - yInt;
         }
 
-        final boolean isEqual = (Math.abs(xInt - yInt) <= maxUlps);
+        final boolean isEqual = Math.abs(xInt - yInt) <= maxUlps;
 
         return isEqual && !Double.isNaN(x) && !Double.isNaN(y);
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MultidimensionalCounter.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MultidimensionalCounter.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MultidimensionalCounter.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MultidimensionalCounter.java Fri Jul 30 22:03:04 2010
@@ -40,6 +40,8 @@ import org.apache.commons.math.exception
  *  <li>...</li>
  *  <li>(1, 3, 2) corresponds to 23</li>
  * </ul>
+ * @version $Revision$ $Date$
+ * @since 2.2
  */
 public class MultidimensionalCounter implements Iterable<Integer> {
     /**
@@ -77,7 +79,8 @@ public class MultidimensionalCounter imp
         private int count = -1;
 
         /**
-         * Create an iterator (see {@link MultidimensionalCounter#iterator()}.
+         * Create an iterator
+         * @see #iterator()
          */
         Iterator() {
             counter[last] = -1;
@@ -108,7 +111,7 @@ public class MultidimensionalCounter imp
                     break;
                 }
             }
-            
+
             return ++count;
         }
 
@@ -137,7 +140,7 @@ public class MultidimensionalCounter imp
          * of the iterator.
          * @throws IndexOutOfBoundsException if {@code index} is not in the
          * correct interval (as defined by the length of the argument in the
-         * {@link MultidimensionalCounter#MultidimensionalCounter(int[])
+         * {@link #MultidimensionalCounter(int[])
          * constructor of the enclosing class}).
          */
         public int getCount(int dim) {
@@ -215,9 +218,9 @@ public class MultidimensionalCounter imp
             || index >= totalSize) {
             throw new OutOfRangeException(index, 0, totalSize);
         }
-        
+
         final int[] indices = new int[dimension];
-        
+
         int count = 0;
         for (int i = 0; i < last; i++) {
             int idx = 0;

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java?rev=980981&r1=980980&r2=980981&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/BicubicSplineInterpolatingFunctionTest.java Fri Jul 30 22:03:04 2010
@@ -270,7 +270,6 @@ public final class BicubicSplineInterpol
 
         for (int i = 0; i < N; i++) {
             for (int j = 0; j < N; j++) {
-                final int index = i + N * j;
                 coeff[i + N * j] = (i + 1) * (j + 2);
             }
         }



Mime
View raw message