commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1030464 [1/3] - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/ main/java/org/apache/commons/math/analysis/ main/java/org/apache/commons/math/analysis/integration/ main/java/org/apache/commons/math/analysis/interpolat...
Date Wed, 03 Nov 2010 13:46:08 GMT
Author: erans
Date: Wed Nov  3 13:46:04 2010
New Revision: 1030464

URL: http://svn.apache.org/viewvc?rev=1030464&view=rev
Log:
MATH-195
Created an unchecked "FunctionEvaluationException" in package "exception".
Removed "throws" clause from interface "UnivariateRealFunction".
"PolynomialFunctionLagrangeForm": Added early check on the interpolating
array having distinct points; removed redundant test in methods "evaluate"
and "computeCoefficients".
"DividedDifferenceInerpolator": Removed redundant check.
"Mathutils": Added method "sortInPlace". Removed (most) references to the
deprecated "MathRuntimeException" class.
"optimization.direct": Removed deprecated classes.
Javadoc clean up.


Added:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/FunctionEvaluationException.java   (with props)
Removed:
    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/direct/MultiDirectional.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/NelderMead.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/MultiDirectionalTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/NelderMeadTest.java
Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ArgumentOutsideDomainException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/DuplicateSampleAbscissaException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/FunctionEvaluationException.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/BinaryFunction.java
    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/ComposableFunction.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateMatrixFunction.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateRealFunction.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateVectorialFunction.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/UnivariateMatrixFunction.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/UnivariateRealFunction.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/UnivariateVectorialFunction.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegrator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/RombergIntegrator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/SimpsonIntegrator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/TrapezoidIntegrator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegrator.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/DividedDifferenceInterpolator.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionLagrangeForm.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionNewtonForm.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunction.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.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/distribution/AbstractIntegerDistribution.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.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/linear/RealVector.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventState.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultiStartMultivariateRealOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultiStartMultivariateVectorialOptimizer.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/BaseMultivariateVectorialOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/LeastSquaresConverter.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/AbstractSimplex.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractScalarOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractVectorialOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/MultiDirectionalSimplex.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/NelderMeadSimplex.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/PowellOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/SimplexOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/CurveFitter.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/GaussianDerivativeFunction.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/GaussianFitter.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/GaussianFunction.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/HarmonicFitter.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/ParametricGaussianFunction.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/ParametricRealFunction.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/PolynomialFitter.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.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/GaussNewtonOptimizer.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/NonLinearConjugateGradientOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/Preconditioner.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/BaseUnivariateRealOptimizer.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/optimization/univariate/MultiStartUnivariateRealOptimizer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/RealTransformer.java
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java
    commons/proper/math/trunk/src/main/resources/META-INF/localization/LocalizedFormats_fr.properties
    commons/proper/math/trunk/src/site/xdoc/changes.xml
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/BinaryFunctionTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/ComposableFunctionTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/Expm1Function.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/MonitoredFunction.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/QuinticFunction.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/SinFunction.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/SumSincFunction.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegratorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/DividedDifferenceInterpolatorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/interpolation/NevilleInterpolatorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunctionTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/linear/SparseRealVectorTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateRealOptimizerTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/MultiStartDifferentiableMultivariateVectorialOptimizerTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/MultiStartMultivariateRealOptimizerTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/PowellOptimizerTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/SimplexOptimizerMultiDirectionalTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/SimplexOptimizerNelderMeadTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/fitting/CurveFitterTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/fitting/GaussianFitterTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/fitting/ParametricGaussianFunctionTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizerTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/LevenbergMarquardtOptimizerTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/MinpackTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizerTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/univariate/BracketFinderTest.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/MathUtilsTest.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ArgumentOutsideDomainException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ArgumentOutsideDomainException.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ArgumentOutsideDomainException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ArgumentOutsideDomainException.java Wed Nov  3 13:46:04 2010
@@ -22,6 +22,8 @@ package org.apache.commons.math;
  *
  * @since 1.2
  * @version $Revision$ $Date$
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link org.apache.commons.math.exception.OutOfRangeException} instead.
  */
 public class ArgumentOutsideDomainException extends FunctionEvaluationException {
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/DuplicateSampleAbscissaException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/DuplicateSampleAbscissaException.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/DuplicateSampleAbscissaException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/DuplicateSampleAbscissaException.java Wed Nov  3 13:46:04 2010
@@ -23,6 +23,7 @@ import org.apache.commons.math.exception
  *
  * @since 1.2
  * @version $Revision$ $Date$
+ * @deprecated in 2.2 (to be removed in 3.0).
  */
 public class DuplicateSampleAbscissaException extends MathException  {
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/FunctionEvaluationException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/FunctionEvaluationException.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/FunctionEvaluationException.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/FunctionEvaluationException.java Wed Nov  3 13:46:04 2010
@@ -28,6 +28,8 @@ import org.apache.commons.math.linear.Ar
  * caused the function evaluation to fail.
  *
  * @version $Revision$ $Date$
+ * @deprecated in 2.2 (to be removed in 3.0). Please use
+ * {@link org.apache.commons.math.exception.FunctionEvaluationException} instead.
  */
 public class FunctionEvaluationException extends MathException  {
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/BinaryFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/BinaryFunction.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/BinaryFunction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/BinaryFunction.java Wed Nov  3 13:46:04 2010
@@ -17,7 +17,7 @@
 
 package org.apache.commons.math.analysis;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.util.FastMath;
 
 

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=1030464&r1=1030463&r2=1030464&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 Wed Nov  3 13:46:04 2010
@@ -17,7 +17,7 @@
 
 package org.apache.commons.math.analysis;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 
 /**
  * An interface representing a bivariate real function.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/ComposableFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/ComposableFunction.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/ComposableFunction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/ComposableFunction.java Wed Nov  3 13:46:04 2010
@@ -17,7 +17,7 @@
 
 package org.apache.commons.math.analysis;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.util.FastMath;
 
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateMatrixFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateMatrixFunction.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateMatrixFunction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateMatrixFunction.java Wed Nov  3 13:46:04 2010
@@ -18,7 +18,7 @@
 package org.apache.commons.math.analysis;
 
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 
 /**
  * An interface representing a multivariate matrix function.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateRealFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateRealFunction.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateRealFunction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateRealFunction.java Wed Nov  3 13:46:04 2010
@@ -17,7 +17,7 @@
 
 package org.apache.commons.math.analysis;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 
 /**
  * An interface representing a multivariate real function.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateVectorialFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateVectorialFunction.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateVectorialFunction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/MultivariateVectorialFunction.java Wed Nov  3 13:46:04 2010
@@ -17,7 +17,7 @@
 
 package org.apache.commons.math.analysis;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 
 /**
  * An interface representing a multivariate vectorial function.

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=1030464&r1=1030463&r2=1030464&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 Wed Nov  3 13:46:04 2010
@@ -17,7 +17,7 @@
 
 package org.apache.commons.math.analysis;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 
 /**
  * An interface representing a trivariate real function.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/UnivariateMatrixFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/UnivariateMatrixFunction.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/UnivariateMatrixFunction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/UnivariateMatrixFunction.java Wed Nov  3 13:46:04 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.analysis;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 
 /**
  * An interface representing a univariate matrix function.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/UnivariateRealFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/UnivariateRealFunction.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/UnivariateRealFunction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/UnivariateRealFunction.java Wed Nov  3 13:46:04 2010
@@ -16,21 +16,17 @@
  */
 package org.apache.commons.math.analysis;
 
-import org.apache.commons.math.FunctionEvaluationException;
-
 /**
  * An interface representing a univariate real function.
  *
  * @version $Revision$ $Date$
  */
 public interface UnivariateRealFunction {
-
     /**
-     * Compute the value for the function.
-     * @param x the point for which the function value should be computed
-     * @return the value
-     * @throws FunctionEvaluationException if the function evaluation fails
+     * Compute the value of the function.
+     *
+     * @param x Point at which the function value should be computed.
+     * @return the value.
      */
-    double value(double x) throws FunctionEvaluationException;
-
+    double value(double x);
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/UnivariateVectorialFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/UnivariateVectorialFunction.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/UnivariateVectorialFunction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/UnivariateVectorialFunction.java Wed Nov  3 13:46:04 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.analysis;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 
 /**
  * An interface representing a univariate vectorial function.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegrator.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegrator.java Wed Nov  3 13:46:04 2010
@@ -17,7 +17,7 @@
 package org.apache.commons.math.analysis.integration;
 
 import org.apache.commons.math.ConvergenceException;
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/RombergIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/RombergIntegrator.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/RombergIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/RombergIntegrator.java Wed Nov  3 13:46:04 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.analysis.integration;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/SimpsonIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/SimpsonIntegrator.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/SimpsonIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/SimpsonIntegrator.java Wed Nov  3 13:46:04 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.analysis.integration;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/TrapezoidIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/TrapezoidIntegrator.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/TrapezoidIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/TrapezoidIntegrator.java Wed Nov  3 13:46:04 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.analysis.integration;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegrator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegrator.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegrator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/integration/UnivariateRealIntegrator.java Wed Nov  3 13:46:04 2010
@@ -18,7 +18,7 @@ package org.apache.commons.math.analysis
 
 import org.apache.commons.math.ConvergenceException;
 import org.apache.commons.math.ConvergingAlgorithm;
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 
 /**

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=1030464&r1=1030463&r2=1030464&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 Wed Nov  3 13:46:04 2010
@@ -17,7 +17,7 @@
 package org.apache.commons.math.analysis.interpolation;
 
 import org.apache.commons.math.DimensionMismatchException;
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.analysis.BivariateRealFunction;
 import org.apache.commons.math.exception.NoDataException;
 import org.apache.commons.math.exception.OutOfRangeException;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/DividedDifferenceInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/DividedDifferenceInterpolator.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/DividedDifferenceInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/interpolation/DividedDifferenceInterpolator.java Wed Nov  3 13:46:04 2010
@@ -17,8 +17,6 @@
 package org.apache.commons.math.analysis.interpolation;
 
 import java.io.Serializable;
-
-import org.apache.commons.math.DuplicateSampleAbscissaException;
 import org.apache.commons.math.analysis.polynomials.PolynomialFunctionLagrangeForm;
 import org.apache.commons.math.analysis.polynomials.PolynomialFunctionNewtonForm;
 
@@ -35,29 +33,31 @@ import org.apache.commons.math.analysis.
  * @version $Revision$ $Date$
  * @since 1.2
  */
-public class DividedDifferenceInterpolator implements UnivariateRealInterpolator,
-    Serializable {
-
+public class DividedDifferenceInterpolator
+    implements UnivariateRealInterpolator, Serializable {
     /** serializable version identifier */
     private static final long serialVersionUID = 107049519551235069L;
 
     /**
-     * Computes an interpolating function for the data set.
+     * Compute an interpolating function for the dataset.
      *
-     * @param x the interpolating points array
-     * @param y the interpolating values array
-     * @return a function which interpolates the data set
-     * @throws DuplicateSampleAbscissaException if arguments are invalid
+     * @param x Interpolating points array.
+     * @param y Interpolating values array.
+     * @return a function which interpolates the dataset.
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if the array lengths are different.
+     * @throws org.apache.commons.math.exception.NumberIsTooSmallException
+     * if the number of points is less than 2.
+     * @throws org.apache.commons.math.exception.NonMonotonousSequenceException
+     * if {@code x} is not sorted in strictly increasing order.
      */
-    public PolynomialFunctionNewtonForm interpolate(double x[], double y[]) throws
-        DuplicateSampleAbscissaException {
-
+    public PolynomialFunctionNewtonForm interpolate(double x[], double y[]) {
         /**
          * a[] and c[] are defined in the general formula of Newton form:
          * p(x) = a[0] + a[1](x-c[0]) + a[2](x-c[0])(x-c[1]) + ... +
          *        a[n](x-c[0])(x-c[1])...(x-c[n-1])
          */
-        PolynomialFunctionLagrangeForm.verifyInterpolationArray(x, y);
+        PolynomialFunctionLagrangeForm.verifyInterpolationArray(x, y, true);
 
         /**
          * When used for interpolation, the Newton form formula becomes
@@ -72,11 +72,10 @@ public class DividedDifferenceInterpolat
 
         final double[] a = computeDividedDifference(x, y);
         return new PolynomialFunctionNewtonForm(a, c);
-
     }
 
     /**
-     * Returns a copy of the divided difference array.
+     * Return a copy of the divided difference array.
      * <p>
      * The divided difference array is defined recursively by <pre>
      * f[x0] = f(x0)
@@ -85,15 +84,18 @@ public class DividedDifferenceInterpolat
      * <p>
      * The computational complexity is O(N^2).</p>
      *
-     * @param x the interpolating points array
-     * @param y the interpolating values array
-     * @return a fresh copy of the divided difference array
-     * @throws DuplicateSampleAbscissaException if any abscissas coincide
+     * @param x Interpolating points array.
+     * @param y Interpolating values array.
+     * @return a fresh copy of the divided difference array.
+     * @throws org.apache.commons.math.exception.DimensionMismatchException
+     * if the array lengths are different.
+     * @throws org.apache.commons.math.exception.NumberIsTooSmallException
+     * if the number of points is less than 2.
+     * @throws org.apache.commons.math.exception.NonMonotonousSequenceException
+     * if {@code x} is not sorted in strictly increasing order.
      */
-    protected static double[] computeDividedDifference(final double x[], final double y[])
-        throws DuplicateSampleAbscissaException {
-
-        PolynomialFunctionLagrangeForm.verifyInterpolationArray(x, y);
+    protected static double[] computeDividedDifference(final double x[], final double y[]) {
+        PolynomialFunctionLagrangeForm.verifyInterpolationArray(x, y, true);
 
         final double[] divdiff = y.clone(); // initialization
 
@@ -103,10 +105,6 @@ public class DividedDifferenceInterpolat
         for (int i = 1; i < n; i++) {
             for (int j = 0; j < n-i; j++) {
                 final double denominator = x[j+i] - x[j];
-                if (denominator == 0.0) {
-                    // This happens only when two abscissas are identical.
-                    throw new DuplicateSampleAbscissaException(x[j], j, j+i);
-                }
                 divdiff[j] = (divdiff[j+1] - divdiff[j]) / denominator;
             }
             a[i] = divdiff[0];

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionLagrangeForm.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionLagrangeForm.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionLagrangeForm.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionLagrangeForm.java Wed Nov  3 13:46:04 2010
@@ -16,12 +16,12 @@
  */
 package org.apache.commons.math.analysis.polynomials;
 
-import org.apache.commons.math.DuplicateSampleAbscissaException;
-import org.apache.commons.math.FunctionEvaluationException;
-import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
-import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.util.MathUtils;
+import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.NumberIsTooSmallException;
+import org.apache.commons.math.exception.util.LocalizedFormats;
 
 /**
  * Implements the representation of a real polynomial function in
@@ -36,24 +36,20 @@ import org.apache.commons.math.util.Fast
  * @since 1.2
  */
 public class PolynomialFunctionLagrangeForm implements UnivariateRealFunction {
-
     /**
      * The coefficients of the polynomial, ordered by degree -- i.e.
      * coefficients[0] is the constant term and coefficients[n] is the
      * coefficient of x^n where n is the degree of the polynomial.
      */
     private double coefficients[];
-
     /**
      * Interpolating points (abscissas).
      */
     private final double x[];
-
     /**
      * Function values at interpolating points.
      */
     private final double y[];
-
     /**
      * Whether the polynomial coefficients are available.
      */
@@ -69,31 +65,34 @@ public class PolynomialFunctionLagrangeF
      * @param y function values at interpolating points
      * @throws IllegalArgumentException if input arrays are not valid
      */
-    public PolynomialFunctionLagrangeForm(double x[], double y[])
-        throws IllegalArgumentException {
-
-        verifyInterpolationArray(x, y);
+    public PolynomialFunctionLagrangeForm(double x[], double y[]) {
         this.x = new double[x.length];
         this.y = new double[y.length];
         System.arraycopy(x, 0, this.x, 0, x.length);
         System.arraycopy(y, 0, this.y, 0, y.length);
         coefficientsComputed = false;
+
+        if (!verifyInterpolationArray(x, y, false)) {
+            MathUtils.sortInPlace(this.x, this.y);
+            // Second check in case some abscissa is duplicated.
+            verifyInterpolationArray(this.x, this.y, true);
+        }
     }
 
     /**
      * Calculate the function value at the given point.
      *
-     * @param z the point at which the function value is to be computed
-     * @return the function value
-     * @throws FunctionEvaluationException if a runtime error occurs
-     * @see UnivariateRealFunction#value(double)
-     */
-    public double value(double z) throws FunctionEvaluationException {
-        try {
-            return evaluate(x, y, z);
-        } catch (DuplicateSampleAbscissaException e) {
-            throw new FunctionEvaluationException(e, z, e.getLocalizablePattern(), e.getArguments());
-        }
+     * @param z Point at which the function value is to be computed.
+     * @return the function value.
+     * @throws DimensionMismatchException if {@code x} and {@code y} have
+     * different lengths.
+     * @throws org.apache.commons.math.exception.NonMonotonousSequenceException
+     * if {@code x} is not sorted in strictly increasing order.
+     * @throws NumberIsTooSmallException if the size of {@code x} is less
+     * than 2.
+     */
+    public double value(double z) {
+        return evaluateInternal(x, y, z);
     }
 
     /**
@@ -153,23 +152,53 @@ public class PolynomialFunctionLagrangeF
     /**
      * Evaluate the Lagrange polynomial using
      * <a href="http://mathworld.wolfram.com/NevillesAlgorithm.html">
-     * Neville's Algorithm</a>. It takes O(N^2) time.
-     * <p>
-     * This function is made public static so that users can call it directly
-     * without instantiating PolynomialFunctionLagrangeForm object.</p>
+     * Neville's Algorithm</a>. It takes O(n^2) time.
      *
-     * @param x the interpolating points array
-     * @param y the interpolating values array
-     * @param z the point at which the function value is to be computed
-     * @return the function value
-     * @throws DuplicateSampleAbscissaException if the sample has duplicate abscissas
-     * @throws IllegalArgumentException if inputs are not valid
-     */
-    public static double evaluate(double x[], double y[], double z) throws
-        DuplicateSampleAbscissaException, IllegalArgumentException {
+     * @param x Interpolating points array.
+     * @param y Interpolating values array.
+     * @param z Point at which the function value is to be computed.
+     * @return the function value.
+     * @throws DimensionMismatchException if {@code x} and {@code y} have
+     * different lengths.
+     * @throws org.apache.commons.math.exception.NonMonotonousSequenceException
+     * if {@code x} is not sorted in strictly increasing order.
+     * @throws NumberIsTooSmallException if the size of {@code x} is less
+     * than 2.
+     */
+    public static double evaluate(double x[], double y[], double z) {
+        if (verifyInterpolationArray(x, y, false)) {
+            return evaluateInternal(x, y, z);
+        }
 
-        verifyInterpolationArray(x, y);
+        // Array is not sorted.
+        final double[] xNew = new double[x.length];
+        final double[] yNew = new double[y.length];
+        System.arraycopy(x, 0, xNew, 0, x.length);
+        System.arraycopy(y, 0, yNew, 0, y.length);
+
+        MathUtils.sortInPlace(xNew, yNew);
+        // Second check in case some abscissa is duplicated.
+        verifyInterpolationArray(xNew, yNew, true);
+        return evaluateInternal(xNew, yNew, z);
+    }
 
+    /**
+     * Evaluate the Lagrange polynomial using
+     * <a href="http://mathworld.wolfram.com/NevillesAlgorithm.html">
+     * Neville's Algorithm</a>. It takes O(n^2) time.
+     *
+     * @param x Interpolating points array.
+     * @param y Interpolating values array.
+     * @param z Point at which the function value is to be computed.
+     * @return the function value.
+     * @throws DimensionMismatchException if {@code x} and {@code y} have
+     * different lengths.
+     * @throws org.apache.commons.math.exception.NonMonotonousSequenceException
+     * if {@code x} is not sorted in strictly increasing order.
+     * @throws NumberIsTooSmallException if the size of {@code x} is less
+     * than 2.
+     */
+    private static double evaluateInternal(double x[], double y[], double z) {
         int nearest = 0;
         final int n = x.length;
         final double[] c = new double[n];
@@ -195,10 +224,6 @@ public class PolynomialFunctionLagrangeF
                 final double tc = x[j] - z;
                 final double td = x[i+j] - z;
                 final double divider = x[j] - x[i+j];
-                if (divider == 0.0) {
-                    // This happens only when two abscissas are identical.
-                    throw new DuplicateSampleAbscissaException(x[i], i, i+j);
-                }
                 // update the difference arrays
                 final double w = (c[j+1] - d[j]) / divider;
                 c[j] = tc * w;
@@ -218,15 +243,11 @@ public class PolynomialFunctionLagrangeF
 
     /**
      * Calculate the coefficients of Lagrange polynomial from the
-     * interpolation data. It takes O(N^2) time.
-     * <p>
-     * Note this computation can be ill-conditioned. Use with caution
-     * and only when it is necessary.</p>
-     *
-     * @throws ArithmeticException if any abscissas coincide
+     * interpolation data. It takes O(n^2) time.
+     * Note that this computation can be ill-conditioned: Use with caution
+     * and only when it is necessary.
      */
-    protected void computeCoefficients() throws ArithmeticException {
-
+    protected void computeCoefficients() {
         final int n = degree() + 1;
         coefficients = new double[n];
         for (int i = 0; i < n; i++) {
@@ -253,16 +274,6 @@ public class PolynomialFunctionLagrangeF
                     d *= x[i] - x[j];
                 }
             }
-            if (d == 0.0) {
-                // This happens only when two abscissas are identical.
-                for (int k = 0; k < n; ++k) {
-                    if ((i != k) && (x[i] == x[k])) {
-                        throw MathRuntimeException.createArithmeticException(
-                              LocalizedFormats.IDENTICAL_ABSCISSAS_DIVISION_BY_ZERO,
-                              i, k, x[i]);
-                    }
-                }
-            }
             final double t = y[i] / d;
             // Lagrange polynomial is the sum of n terms, each of which is a
             // polynomial of degree n-1. tc[] are the coefficients of the i-th
@@ -279,34 +290,31 @@ public class PolynomialFunctionLagrangeF
     }
 
     /**
-     * Verifies that the interpolation arrays are valid.
-     * <p>
+     * Check that the interpolation arrays are valid.
      * The arrays features checked by this method are that both arrays have the
      * same length and this length is at least 2.
-     * </p>
-     * <p>
-     * The interpolating points must be distinct. However it is not
-     * verified here, it is checked in evaluate() and computeCoefficients().
-     * </p>
      *
-     * @param x the interpolating points array
-     * @param y the interpolating values array
-     * @throws IllegalArgumentException if not valid
+     * @param x Interpolating points array.
+     * @param y Interpolating values array.
+     * @param abort Whether to throw an exception if {@code x} is not sorted.
+     * @throws DimensionMismatchException if the array lengths are different.
+     * @throws NumberIsTooSmallException if the number of points is less than 2.
+     * @throws org.apache.commons.math.exception.NonMonotonousSequenceException
+     * if {@code x} is not sorted in strictly increasing order and {@code abort}
+     * is {@code true}.
+     * @return {@code false} if the {@code x} is not sorted in increasing order,
+     * {@code true} otherwise.
      * @see #evaluate(double[], double[], double)
      * @see #computeCoefficients()
      */
-    public static void verifyInterpolationArray(double x[], double y[])
-        throws IllegalArgumentException {
-
+    public static boolean verifyInterpolationArray(double x[], double y[], boolean abort) {
         if (x.length != y.length) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.DIMENSIONS_MISMATCH_SIMPLE, x.length, y.length);
+            throw new DimensionMismatchException(x.length, y.length);
         }
-
         if (x.length < 2) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.WRONG_NUMBER_OF_POINTS, 2, x.length);
+            throw new NumberIsTooSmallException(LocalizedFormats.WRONG_NUMBER_OF_POINTS, 2, x.length, true);
         }
 
+        return MathUtils.checkOrder(x, MathUtils.OrderDirection.INCREASING, true, abort);
     }
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionNewtonForm.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionNewtonForm.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionNewtonForm.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialFunctionNewtonForm.java Wed Nov  3 13:46:04 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.analysis.polynomials;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.exception.util.LocalizedFormats;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunction.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunction.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunction.java Wed Nov  3 13:46:04 2010
@@ -18,10 +18,13 @@ package org.apache.commons.math.analysis
 
 import java.util.Arrays;
 
-import org.apache.commons.math.ArgumentOutsideDomainException;
-import org.apache.commons.math.MathRuntimeException;
+import org.apache.commons.math.util.MathUtils;
 import org.apache.commons.math.analysis.DifferentiableUnivariateRealFunction;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.exception.OutOfRangeException;
+import org.apache.commons.math.exception.NumberIsTooSmallException;
+import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 
 /**
@@ -58,24 +61,23 @@ import org.apache.commons.math.exception
  *
  * @version $Revision$ $Date$
  */
-public class PolynomialSplineFunction
-    implements DifferentiableUnivariateRealFunction {
-
-    /** Spline segment interval delimiters (knots).   Size is n+1 for n segments. */
+public class PolynomialSplineFunction implements DifferentiableUnivariateRealFunction {
+    /**
+     * Spline segment interval delimiters (knots).
+     * Size is n + 1 for n segments.
+     */
     private final double knots[];
-
     /**
      * The polynomial functions that make up the spline.  The first element
      * determines the value of the spline over the first subinterval, the
      * second over the second, etc.   Spline function values are determined by
-     * evaluating these functions at <code>(x - knot[i])</code> where i is the
+     * evaluating these functions at {@code (x - knot[i])} where i is the
      * knot segment to which x belongs.
      */
     private final PolynomialFunction polynomials[];
-
     /**
-     * Number of spline segments = number of polynomials
-     *  = number of partition points - 1
+     * Number of spline segments. It is equal to the number of polynomials and
+     * to the number of partition points - 1.
      */
     private final int n;
 
@@ -83,33 +85,31 @@ public class PolynomialSplineFunction
     /**
      * Construct a polynomial spline function with the given segment delimiters
      * and interpolating polynomials.
-     * <p>
      * The constructor copies both arrays and assigns the copies to the knots
-     * and polynomials properties, respectively.</p>
+     * and polynomials properties, respectively.
      *
-     * @param knots spline segment interval delimiters
-     * @param polynomials polynomial functions that make up the spline
-     * @throws NullPointerException if either of the input arrays is null
-     * @throws IllegalArgumentException if knots has length less than 2,
-     * <code>polynomials.length != knots.length - 1 </code>, or the knots array
-     * is not strictly increasing.
+     * @param knots Spline segment interval delimiters.
+     * @param polynomials Polynomial functions that make up the spline.
+     * @throws NullArgumentException if either of the input arrays is {@code null}.
+     * @throws NumberIsTooSmallException if knots has length less than 2.
+     * @throws DimensionMismatchException if {@code polynomials.length != knots.length - 1}.
+     * @throws org.apache.commons.math.exception.NonMonotonousSequenceException if
+     * the {@code knots} array is not strictly increasing.
      *
      */
     public PolynomialSplineFunction(double knots[], PolynomialFunction polynomials[]) {
+        if (knots == null ||
+            polynomials == null) {
+            throw new NullArgumentException();
+        }
         if (knots.length < 2) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.NOT_ENOUGH_POINTS_IN_SPLINE_PARTITION,
-                  2, knots.length);
+            throw new NumberIsTooSmallException(LocalizedFormats.NOT_ENOUGH_POINTS_IN_SPLINE_PARTITION,
+                                                2, knots.length, false);
         }
         if (knots.length - 1 != polynomials.length) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.POLYNOMIAL_INTERPOLANTS_MISMATCH_SEGMENTS,
-                  polynomials.length, knots.length);
-        }
-        if (!isStrictlyIncreasing(knots)) {
-            throw MathRuntimeException.createIllegalArgumentException(
-                  LocalizedFormats.NOT_STRICTLY_INCREASING_KNOT_VALUES);
+            throw new DimensionMismatchException(polynomials.length, knots.length);
         }
+        MathUtils.checkOrder(knots);
 
         this.n = knots.length -1;
         this.knots = new double[n + 1];
@@ -120,30 +120,26 @@ public class PolynomialSplineFunction
 
     /**
      * Compute the value for the function.
-     * <p>
-     * Throws FunctionEvaluationException if v is outside of the domain of the
-     * function.  The domain is [smallest knot, largest knot].</p>
-     * <p>
      * See {@link PolynomialSplineFunction} for details on the algorithm for
-     * computing the value of the function.</p>
+     * computing the value of the function.
      *
-     * @param v the point for which the function value should be computed
-     * @return the value
-     * @throws ArgumentOutsideDomainException if v is outside of the domain of
-     * of the spline function (less than the smallest knot point or greater
-     * than the largest knot point)
+     * @param v Point for which the function value should be computed.
+     * @return the value.
+     * @throws OutOfRangeException if {@code v} is outside of the domain of the
+     * spline function (smaller than the smallest knot point or larger than the
+     * largest knot point).
      */
-    public double value(double v) throws ArgumentOutsideDomainException {
+    public double value(double v) {
         if (v < knots[0] || v > knots[n]) {
-            throw new ArgumentOutsideDomainException(v, knots[0], knots[n]);
+            throw new OutOfRangeException(v, knots[0], knots[n]);
         }
         int i = Arrays.binarySearch(knots, v);
         if (i < 0) {
             i = -i - 2;
         }
-        //This will handle the case where v is the last knot value
-        //There are only n-1 polynomials, so if v is the last knot
-        //then we will use the last polynomial to calculate the value.
+        // This will handle the case where v is the last knot value
+        // There are only n-1 polynomials, so if v is the last knot
+        // then we will use the last polynomial to calculate the value.
         if ( i >= polynomials.length ) {
             i--;
         }
@@ -151,17 +147,18 @@ public class PolynomialSplineFunction
     }
 
     /**
-     * Returns the derivative of the polynomial spline function as a UnivariateRealFunction
-     * @return  the derivative function
+     * Get the derivative of the polynomial spline function.
+     *
+     * @return the derivative function.
      */
     public UnivariateRealFunction derivative() {
         return polynomialSplineDerivative();
     }
 
     /**
-     * Returns the derivative of the polynomial spline function as a PolynomialSplineFunction
+     * Get the derivative of the polynomial spline function.
      *
-     * @return  the derivative function
+     * @return the derivative function.
      */
     public PolynomialSplineFunction polynomialSplineDerivative() {
         PolynomialFunction derivativePolynomials[] = new PolynomialFunction[n];
@@ -172,22 +169,21 @@ public class PolynomialSplineFunction
     }
 
     /**
-     * Returns the number of spline segments = the number of polynomials
-     * = the number of knot points - 1.
+     * Get the number of spline segments.
+     * It is also the number of polynomials and the number of knot points - 1.
      *
-     * @return the number of spline segments
+     * @return the number of spline segments.
      */
     public int getN() {
         return n;
     }
 
     /**
-     * Returns a copy of the interpolating polynomials array.
-     * <p>
-     * Returns a fresh copy of the array. Changes made to the copy will
-     * not affect the polynomials property.</p>
+     * Get a copy of the interpolating polynomials array.
+     * It returns a fresh copy of the array. Changes made to the copy will
+     * not affect the polynomials property.
      *
-     * @return the interpolating polynomials
+     * @return the interpolating polynomials.
      */
     public PolynomialFunction[] getPolynomials() {
         PolynomialFunction p[] = new PolynomialFunction[n];
@@ -196,33 +192,15 @@ public class PolynomialSplineFunction
     }
 
     /**
-     * Returns an array copy of the knot points.
-     * <p>
-     * Returns a fresh copy of the array. Changes made to the copy
-     * will not affect the knots property.</p>
+     * Get an array copy of the knot points.
+     * It returns a fresh copy of the array. Changes made to the copy
+     * will not affect the knots property.
      *
-     * @return the knot points
+     * @return the knot points.
      */
     public double[] getKnots() {
         double out[] = new double[n + 1];
         System.arraycopy(knots, 0, out, 0, n + 1);
         return out;
     }
-
-    /**
-     * Determines if the given array is ordered in a strictly increasing
-     * fashion.
-     *
-     * @param x the array to examine.
-     * @return <code>true</code> if the elements in <code>x</code> are ordered
-     * in a stricly increasing manner.  <code>false</code>, otherwise.
-     */
-    private static boolean isStrictlyIncreasing(double[] x) {
-        for (int i = 1; i < x.length; ++i) {
-            if (x[i - 1] >= x[i]) {
-                return false;
-            }
-        }
-        return true;
-    }
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BisectionSolver.java Wed Nov  3 13:46:04 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.analysis.solvers;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.util.FastMath;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/BrentSolver.java Wed Nov  3 13:46:04 2010
@@ -17,7 +17,7 @@
 package org.apache.commons.math.analysis.solvers;
 
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/LaguerreSolver.java Wed Nov  3 13:46:04 2010
@@ -17,7 +17,7 @@
 package org.apache.commons.math.analysis.solvers;
 
 import org.apache.commons.math.ConvergenceException;
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/MullerSolver.java Wed Nov  3 13:46:04 2010
@@ -17,7 +17,7 @@
 package org.apache.commons.math.analysis.solvers;
 
 import org.apache.commons.math.ConvergenceException;
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.util.FastMath;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/NewtonSolver.java Wed Nov  3 13:46:04 2010
@@ -17,7 +17,7 @@
 
 package org.apache.commons.math.analysis.solvers;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.analysis.DifferentiableUnivariateRealFunction;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/RiddersSolver.java Wed Nov  3 13:46:04 2010
@@ -17,7 +17,7 @@
 package org.apache.commons.math.analysis.solvers;
 
 import org.apache.commons.math.ConvergenceException;
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.util.FastMath;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/SecantSolver.java Wed Nov  3 13:46:04 2010
@@ -17,7 +17,7 @@
 package org.apache.commons.math.analysis.solvers;
 
 import org.apache.commons.math.ConvergenceException;
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.MaxIterationsExceededException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolver.java Wed Nov  3 13:46:04 2010
@@ -18,7 +18,7 @@ package org.apache.commons.math.analysis
 
 import org.apache.commons.math.ConvergenceException;
 import org.apache.commons.math.ConvergingAlgorithm;
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverImpl.java Wed Nov  3 13:46:04 2010
@@ -18,7 +18,7 @@
 package org.apache.commons.math.analysis.solvers;
 
 import org.apache.commons.math.ConvergingAlgorithmImpl;
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.exception.util.LocalizedFormats;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/UnivariateRealSolverUtils.java Wed Nov  3 13:46:04 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.analysis.solvers;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.ConvergenceException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;

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=1030464&r1=1030463&r2=1030464&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 Wed Nov  3 13:46:04 2010
@@ -19,7 +19,7 @@ package org.apache.commons.math.distribu
 import java.io.Serializable;
 
 import org.apache.commons.math.ConvergenceException;
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.MathException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.analysis.solvers.BrentSolver;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/distribution/AbstractIntegerDistribution.java Wed Nov  3 13:46:04 2010
@@ -18,7 +18,7 @@ package org.apache.commons.math.distribu
 
 import java.io.Serializable;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.MathException;
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
 import org.apache.commons.math.exception.NumberIsTooSmallException;

Added: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/FunctionEvaluationException.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/FunctionEvaluationException.java?rev=1030464&view=auto
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/FunctionEvaluationException.java (added)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/FunctionEvaluationException.java Wed Nov  3 13:46:04 2010
@@ -0,0 +1,96 @@
+/*
+ * 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.
+ */
+package org.apache.commons.math.exception;
+
+import java.util.Locale;
+
+import org.apache.commons.math.exception.util.ArgUtils;
+import org.apache.commons.math.exception.util.MessageFactory;
+import org.apache.commons.math.exception.util.Localizable;
+import org.apache.commons.math.exception.util.LocalizedFormats;
+
+/**
+ * Exception for signalling that a function object could not return
+ * a valid result.
+ *
+ * @since 3.0
+ * @version $Revision$ $Date$
+ */
+public class FunctionEvaluationException extends RuntimeException {
+    /** Serializable version Id. */
+    private static final long serialVersionUID = -6024911025449780478L;
+    /**
+     * Pattern used to build the message.
+     */
+    private final Localizable specific;
+    /**
+     * Arguments used to build the message.
+     */
+    private final Object[] arguments;
+
+    /**
+     * @param specific Message pattern providing the specific context of
+     * the error.
+     * @param args Arguments.
+     */
+    public FunctionEvaluationException(Localizable specific,
+                                       Object ... args) {
+        this.specific = specific;
+        arguments = ArgUtils.flatten(args);
+    }
+    /**
+     * @param args Arguments.
+     */
+    public FunctionEvaluationException(Object ... args) {
+        this(null, args);
+    }
+
+    /**
+     * Get the arguments.
+     *
+     * @return a (shallow) copy of the arguments.
+     */
+    public Object[] getArguments() {
+        return arguments.clone();
+    }
+
+    /**
+     * Get the message in a specified locale.
+     *
+     * @param locale Locale in which the message should be translated.
+     *
+     * @return the localized message.
+     */
+    public String getMessage(final Locale locale) {
+        return MessageFactory.buildMessage(locale,
+                                           specific,
+                                           LocalizedFormats.EVALUATION,
+                                           arguments);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public String getMessage() {
+        return getMessage(Locale.US);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public String getLocalizedMessage() {
+        return getMessage(Locale.getDefault());
+    }
+}

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

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/exception/util/LocalizedFormats.java Wed Nov  3 13:46:04 2010
@@ -48,8 +48,8 @@ public enum LocalizedFormats implements 
     AT_LEAST_ONE_COLUMN("matrix must have at least one column"),
     AT_LEAST_ONE_ROW("matrix must have at least one row"),
     BANDWIDTH_OUT_OF_INTERVAL("bandwidth must be in the interval [0,1], but got {0}"),
-    BINOMIAL_INVALID_PARAMETERS_ORDER("must have n >= k for binomial coefficient (n,k), got n = {0}, k = {1}"),
-    BINOMIAL_NEGATIVE_PARAMETER("must have n >= 0 for binomial coefficient (n,k), got n = {0}"),
+    BINOMIAL_INVALID_PARAMETERS_ORDER("must have n >= k for binomial coefficient (n, k), got k = {0}, n = {1}"),
+    BINOMIAL_NEGATIVE_PARAMETER("must have n >= 0 for binomial coefficient (n, k), got n = {0}"),
     CANNOT_CLEAR_STATISTIC_CONSTRUCTED_FROM_EXTERNAL_MOMENTS("statistics constructed from external moments cannot be cleared"),
     CANNOT_COMPUTE_0TH_ROOT_OF_UNITY("cannot compute 0-th root of unity, indefinite result"),
     CANNOT_COMPUTE_BETA_DENSITY_AT_0_FOR_SOME_ALPHA("cannot compute beta density at 0 when alpha = {0,number}"),
@@ -95,6 +95,7 @@ public enum LocalizedFormats implements 
     EQUAL_VERTICES_IN_SIMPLEX("equal vertices {0} and {1} in simplex configuration"),
     EULER_ANGLES_SINGULARITY("Euler angles singularity"),
     EVALUATION_FAILED("evaluation failed for argument = {0}"),
+    EVALUATION("evaluation"), /* keep */
     EXPANSION_FACTOR_SMALLER_THAN_ONE("expansion factor smaller than one ({0})"),
     FACTORIAL_NEGATIVE_PARAMETER("must have n >= 0 for n!, got n = {0}"),
     FAILED_BRACKETING("number of iterations={0}, maximum iterations={1}, initial={2}, lower bound={3}, upper bound={4}, final a value={5}, final b value={6}, f(a)={7}, f(b)={8}"),

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=1030464&r1=1030463&r2=1030464&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 Wed Nov  3 13:46:04 2010
@@ -20,7 +20,7 @@ package org.apache.commons.math.linear;
 import java.util.Iterator;
 import java.util.NoSuchElementException;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.exception.MathUnsupportedOperationException;
 import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.exception.OutOfRangeException;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealVector.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealVector.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealVector.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/linear/RealVector.java Wed Nov  3 13:46:04 2010
@@ -18,7 +18,7 @@ package org.apache.commons.math.linear;
 
 import java.util.Iterator;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventState.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventState.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventState.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/events/EventState.java Wed Nov  3 13:46:04 2010
@@ -18,7 +18,7 @@
 package org.apache.commons.math.ode.events;
 
 import org.apache.commons.math.ConvergenceException;
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.analysis.solvers.BrentSolver;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultiStartMultivariateRealOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultiStartMultivariateRealOptimizer.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultiStartMultivariateRealOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultiStartMultivariateRealOptimizer.java Wed Nov  3 13:46:04 2010
@@ -20,7 +20,7 @@ package org.apache.commons.math.optimiza
 import java.util.Arrays;
 import java.util.Comparator;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.exception.MathIllegalStateException;
 import org.apache.commons.math.exception.ConvergenceException;
 import org.apache.commons.math.analysis.MultivariateRealFunction;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultiStartMultivariateVectorialOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultiStartMultivariateVectorialOptimizer.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultiStartMultivariateVectorialOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultiStartMultivariateVectorialOptimizer.java Wed Nov  3 13:46:04 2010
@@ -20,7 +20,7 @@ package org.apache.commons.math.optimiza
 import java.util.Arrays;
 import java.util.Comparator;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.exception.MathIllegalStateException;
 import org.apache.commons.math.exception.ConvergenceException;
 import org.apache.commons.math.analysis.MultivariateVectorialFunction;

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=1030464&r1=1030463&r2=1030464&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 Wed Nov  3 13:46:04 2010
@@ -17,7 +17,7 @@
 
 package org.apache.commons.math.optimization;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.analysis.MultivariateRealFunction;
 
 /**
@@ -45,7 +45,7 @@ public interface BaseMultivariateRealOpt
      * @param startPoint Start point for optimization.
      * @return the point/value pair giving the optimal value for objective
      * function.
-     * @throws org.apache.commons.math.FunctionEvaluationException if the
+     * @throws org.apache.commons.math.exception.FunctionEvaluationException if the
      * objective function throws one during the search.
      * @throws org.apache.commons.math.exception.DimensionMismatchException
      * if the start point dimension is wrong.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultivariateVectorialOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultivariateVectorialOptimizer.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultivariateVectorialOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/BaseMultivariateVectorialOptimizer.java Wed Nov  3 13:46:04 2010
@@ -17,7 +17,7 @@
 
 package org.apache.commons.math.optimization;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.analysis.MultivariateVectorialFunction;
 
 /**

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/LeastSquaresConverter.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/LeastSquaresConverter.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/LeastSquaresConverter.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/LeastSquaresConverter.java Wed Nov  3 13:46:04 2010
@@ -17,7 +17,7 @@
 
 package org.apache.commons.math.optimization;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.MultivariateRealFunction;
 import org.apache.commons.math.analysis.MultivariateVectorialFunction;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/AbstractSimplex.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/AbstractSimplex.java?rev=1030464&r1=1030463&r2=1030464&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/AbstractSimplex.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/AbstractSimplex.java Wed Nov  3 13:46:04 2010
@@ -20,7 +20,7 @@ package org.apache.commons.math.optimiza
 import java.util.Arrays;
 import java.util.Comparator;
 
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.analysis.MultivariateRealFunction;
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
 import org.apache.commons.math.exception.DimensionMismatchException;



Mime
View raw message