commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From l..@apache.org
Subject svn commit: r1037328 [3/5] - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/analysis/ main/java/org/apache/commons/math/analysis/integration/ main/java/org/apache/commons/math/analysis/solvers/ main/java/org/apache/commons/math/ex...
Date Sat, 20 Nov 2010 21:01:55 GMT
Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/DummyStepInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/DummyStepInterpolator.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/DummyStepInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/DummyStepInterpolator.java Sat Nov 20 21:01:50 2010
@@ -21,8 +21,6 @@ import java.io.IOException;
 import java.io.ObjectInput;
 import java.io.ObjectOutput;
 
-import org.apache.commons.math.ode.DerivativeException;
-
 /** This class is a step interpolator that does nothing.
  *
  * <p>This class is used when the {@link StepHandler "step handler"}
@@ -98,12 +96,9 @@ public class DummyStepInterpolator
    * (theta is zero at the previous time step and one at the current time step)
    * @param oneMinusThetaH time gap between the interpolated time and
    * the current time
-   * @throws DerivativeException this exception is propagated to the caller if the
-   * underlying user function triggers one
    */
   @Override
-  protected void computeInterpolatedStateAndDerivatives(final double theta, final double oneMinusThetaH)
-    throws DerivativeException {
+  protected void computeInterpolatedStateAndDerivatives(final double theta, final double oneMinusThetaH) {
       System.arraycopy(currentState,      0, interpolatedState,       0, currentState.length);
       System.arraycopy(currentDerivative, 0, interpolatedDerivatives, 0, currentDerivative.length);
   }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/FixedStepHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/FixedStepHandler.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/FixedStepHandler.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/FixedStepHandler.java Sat Nov 20 21:01:50 2010
@@ -17,7 +17,7 @@
 
 package org.apache.commons.math.ode.sampling;
 
-import org.apache.commons.math.ode.DerivativeException;
+import org.apache.commons.math.exception.MathUserException;
 
 /**
  * This interface represents a handler that should be called after
@@ -55,8 +55,8 @@ public interface FixedStepHandler  {
    * provide at the end of the integration a complete array of all
    * steps), it should build a local copy store this copy.
    * @param isLast true if the step is the last one
-   * @throws DerivativeException if some error condition is encountered
+   * @throws MathUserException if some error condition is encountered
    */
-  void handleStep(double t, double[] y, double[] yDot, boolean isLast) throws DerivativeException;
+  void handleStep(double t, double[] y, double[] yDot, boolean isLast) throws MathUserException;
 
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolator.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/NordsieckStepInterpolator.java Sat Nov 20 21:01:50 2010
@@ -22,8 +22,8 @@ import java.io.ObjectInput;
 import java.io.ObjectOutput;
 import java.util.Arrays;
 
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.linear.Array2DRowRealMatrix;
-import org.apache.commons.math.ode.DerivativeException;
 import org.apache.commons.math.util.FastMath;
 
 /**
@@ -171,11 +171,11 @@ public class NordsieckStepInterpolator e
      * to be preserved across several calls.</p>
      * @return state vector at time {@link #getInterpolatedTime}
      * @see #getInterpolatedDerivatives()
-     * @throws DerivativeException if this call induces an automatic
+     * @throws MathUserException if this call induces an automatic
      * step finalization that throws one
      */
     public double[] getInterpolatedStateVariation()
-        throws DerivativeException {
+        throws MathUserException {
         // compute and ignore interpolated state
         // to make sure state variation is computed as a side effect
         getInterpolatedState();

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/StepHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/StepHandler.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/StepHandler.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/StepHandler.java Sat Nov 20 21:01:50 2010
@@ -17,7 +17,7 @@
 
 package org.apache.commons.math.ode.sampling;
 
-import org.apache.commons.math.ode.DerivativeException;
+import org.apache.commons.math.exception.MathUserException;
 
 /**
  * This interface represents a handler that should be called after
@@ -70,9 +70,9 @@ public interface StepHandler {
    * Keeping only a reference to the interpolator and reusing it will
    * result in unpredictable behavior (potentially crashing the application).
    * @param isLast true if the step is the last one
-   * @throws DerivativeException this exception is propagated to the
-   * caller if the underlying user function triggers one
+   * @exception MathUserException if user code called from step interpolator
+   * finalization triggers one
    */
-  void handleStep(StepInterpolator interpolator, boolean isLast) throws DerivativeException;
+  void handleStep(StepInterpolator interpolator, boolean isLast) throws MathUserException;
 
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/StepInterpolator.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/StepInterpolator.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/StepInterpolator.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/StepInterpolator.java Sat Nov 20 21:01:50 2010
@@ -19,7 +19,7 @@ package org.apache.commons.math.ode.samp
 
 import java.io.Externalizable;
 
-import org.apache.commons.math.ode.DerivativeException;
+import org.apache.commons.math.exception.MathUserException;
 
 /** This interface represents an interpolator over the last step
  * during an ODE integration.
@@ -89,10 +89,10 @@ public interface StepInterpolator extend
    * to be preserved across several calls.</p>
    * @return state vector at time {@link #getInterpolatedTime}
    * @see #getInterpolatedDerivatives()
-   * @throws DerivativeException if this call induces an automatic
-   * step finalization that throws one
+   * @exception MathUserException if user code called from step interpolator
+   * finalization triggers one
    */
-  double[] getInterpolatedState() throws DerivativeException;
+  double[] getInterpolatedState() throws MathUserException;
 
   /**
    * Get the derivatives of the state vector of the interpolated point.
@@ -101,11 +101,11 @@ public interface StepInterpolator extend
    * to be preserved across several calls.</p>
    * @return derivatives of the state vector at time {@link #getInterpolatedTime}
    * @see #getInterpolatedState()
-   * @throws DerivativeException if this call induces an automatic
-   * step finalization that throws one
+   * @exception MathUserException if user code called from step interpolator
+   * finalization triggers one
    * @since 2.0
    */
-  double[] getInterpolatedDerivatives() throws DerivativeException;
+  double[] getInterpolatedDerivatives() throws MathUserException;
 
   /** Check if the natural integration direction is forward.
    * <p>This method provides the integration direction as specified by
@@ -123,10 +123,10 @@ public interface StepInterpolator extend
    * original one. Both can be used with different settings for
    * interpolated time without any side effect.</p>
    * @return a deep copy of the instance, which can be used independently.
-   * @throws DerivativeException if this call induces an automatic
-   * step finalization that throws one
+   * @exception MathUserException if user code called from step interpolator
+   * finalization triggers one
    * @see #setInterpolatedTime(double)
    */
-   StepInterpolator copy() throws DerivativeException;
+   StepInterpolator copy() throws MathUserException;
 
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/StepNormalizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/StepNormalizer.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/StepNormalizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/ode/sampling/StepNormalizer.java Sat Nov 20 21:01:50 2010
@@ -17,7 +17,7 @@
 
 package org.apache.commons.math.ode.sampling;
 
-import org.apache.commons.math.ode.DerivativeException;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.util.FastMath;
 
 /**
@@ -109,11 +109,11 @@ public class StepNormalizer implements S
      * should build a local copy using the clone method and store this
      * copy.
      * @param isLast true if the step is the last one
-     * @throws DerivativeException this exception is propagated to the
+     * @throws MathUserException this exception is propagated to the
      * caller if the underlying user function triggers one
      */
     public void handleStep(final StepInterpolator interpolator, final boolean isLast)
-        throws DerivativeException {
+        throws MathUserException {
 
         if (lastState == null) {
 

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=1037328&r1=1037327&r2=1037328&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 Sat Nov 20 21:01:50 2010
@@ -22,7 +22,6 @@ import java.util.Comparator;
 
 import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.MathIllegalStateException;
-import org.apache.commons.math.exception.ConvergenceException;
 import org.apache.commons.math.analysis.MultivariateRealFunction;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.random.RandomVectorGenerator;
@@ -136,7 +135,7 @@ public class BaseMultiStartMultivariateR
      */
     public RealPointValuePair optimize(final FUNC f,
                                        final GoalType goal,
-                                       double[] startPoint) {
+                                       double[] startPoint) throws MathUserException {
         MathUserException lastException = null;
         optima = new RealPointValuePair[starts];
         totalEvaluations = 0;

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=1037328&r1=1037327&r2=1037328&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 Sat Nov 20 21:01:50 2010
@@ -20,9 +20,9 @@ package org.apache.commons.math.optimiza
 import java.util.Arrays;
 import java.util.Comparator;
 
-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.exception.MathUserException;
 import org.apache.commons.math.analysis.MultivariateVectorialFunction;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.random.RandomVectorGenerator;
@@ -137,8 +137,9 @@ public class BaseMultiStartMultivariateV
     public VectorialPointValuePair optimize(final FUNC f,
                                             double[] target, double[] weights,
                                             double[] startPoint)
-        throws FunctionEvaluationException {
+        throws MathUserException {
 
+        MathUserException lastException = null;
         optima = new VectorialPointValuePair[starts];
 
         // Multi-start loop.
@@ -147,7 +148,8 @@ public class BaseMultiStartMultivariateV
             try {
                 optima[i] = optimizer.optimize(f, target, weights,
                                                i == 0 ? startPoint : generator.nextVector());
-            } catch (FunctionEvaluationException fee) {
+            } catch (MathUserException mue) {
+                lastException = mue;
                 optima[i] = null;
             } catch (ConvergenceException oe) {
                 optima[i] = null;
@@ -161,8 +163,7 @@ public class BaseMultiStartMultivariateV
         sortPairs(target, weights);
 
         if (optima[0] == null) {
-            throw new ConvergenceException(LocalizedFormats.NO_CONVERGENCE_WITH_ANY_START_POINT,
-                                           starts);
+            throw lastException;
         }
 
         // Return the found point given the best objective function value.

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=1037328&r1=1037327&r2=1037328&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 Sat Nov 20 21:01:50 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.optimization;
 
 import org.apache.commons.math.analysis.MultivariateRealFunction;
+import org.apache.commons.math.exception.MathUserException;
 
 /**
  * This interface is mainly intended to enforce the internal coherence of
@@ -50,6 +51,7 @@ public interface BaseMultivariateRealOpt
      * if the maximal number of evaluations is exceeded.
      * @throws org.apache.commons.math.exception.NullArgumentException if
      * any argument is {@code null}.
+     * @throws MathUserException if objective function throws one during search
      */
-    RealPointValuePair optimize(FUNC f, GoalType goalType, double[] startPoint);
+    RealPointValuePair optimize(FUNC f, GoalType goalType, double[] startPoint) throws MathUserException;
 }

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=1037328&r1=1037327&r2=1037328&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 Sat Nov 20 21:01:50 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.optimization;
 
 import org.apache.commons.math.analysis.MultivariateVectorialFunction;
+import org.apache.commons.math.exception.MathUserException;
 
 /**
  * This interface is mainly intended to enforce the internal coherence of
@@ -52,7 +53,8 @@ public interface BaseMultivariateVectori
      * if the maximal number of evaluations is exceeded.
      * @throws org.apache.commons.math.exception.NullArgumentException if
      * any argument is {@code null}.
+     * @throws MathUserException if function throws one during search.
      */
     VectorialPointValuePair optimize(FUNC f, double[] target, double[] weight,
-                                     double[] startPoint);
+                                     double[] startPoint) throws MathUserException;
 }

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=1037328&r1=1037327&r2=1037328&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 Sat Nov 20 21:01:50 2010
@@ -17,10 +17,10 @@
 
 package org.apache.commons.math.optimization;
 
-import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.analysis.MultivariateRealFunction;
 import org.apache.commons.math.analysis.MultivariateVectorialFunction;
-import org.apache.commons.math.exception.util.LocalizedFormats;
+import org.apache.commons.math.exception.DimensionMismatchException;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.linear.RealMatrix;
 
 /** This class converts {@link MultivariateVectorialFunction vectorial
@@ -151,7 +151,7 @@ public class LeastSquaresConverter imple
     }
 
     /** {@inheritDoc} */
-    public double value(final double[] point) {
+    public double value(final double[] point) throws MathUserException {
         // compute residuals
         final double[] residuals = function.value(point);
         if (residuals.length != observations.length) {

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=1037328&r1=1037327&r2=1037328&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 Sat Nov 20 21:01:50 2010
@@ -21,6 +21,7 @@ import java.util.Arrays;
 import java.util.Comparator;
 
 import org.apache.commons.math.analysis.MultivariateRealFunction;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
 import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.exception.ZeroException;
@@ -201,9 +202,11 @@ public abstract class AbstractSimplex {
      * to worst.
      * @throws org.apache.commons.math.exception.TooManyEvaluationsException
      * if the algorithm fails to converge.
+     * @throws MathUserException if evaluation function throws one
      */
     public abstract void iterate(final MultivariateRealFunction evaluationFunction,
-                                 final Comparator<RealPointValuePair> comparator);
+                                 final Comparator<RealPointValuePair> comparator)
+        throws MathUserException;
 
     /**
      * Build an initial simplex.
@@ -239,9 +242,11 @@ public abstract class AbstractSimplex {
      * @param comparator Comparator to use to sort simplex vertices from best to worst.
      * @throws org.apache.commons.math.exception.TooManyEvaluationsException
      * if the maximal number of evaluations is exceeded.
+     * @throws MathUserException if evaluation function throws one
      */
     public void evaluate(final MultivariateRealFunction evaluationFunction,
-                         final Comparator<RealPointValuePair> comparator) {
+                         final Comparator<RealPointValuePair> comparator)
+        throws MathUserException {
         // Evaluate the objective function at all non-evaluated simplex points.
         for (int i = 0; i < simplex.length; i++) {
             final RealPointValuePair vertex = simplex[i];

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractScalarOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractScalarOptimizer.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractScalarOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractScalarOptimizer.java Sat Nov 20 21:01:50 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.optimization.direct;
 
 import org.apache.commons.math.util.Incrementor;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.MaxCountExceededException;
 import org.apache.commons.math.exception.TooManyEvaluationsException;
 import org.apache.commons.math.exception.NullArgumentException;
@@ -101,8 +102,9 @@ public abstract class BaseAbstractScalar
      * @return the objective function value at the specified point.
      * @throws TooManyEvaluationsException if the maximal number of
      * evaluations is exceeded.
+     * @throws MathUserException if objective function throws one
      */
-    protected double computeObjectiveValue(double[] point) {
+    protected double computeObjectiveValue(double[] point) throws MathUserException {
         try {
             evaluations.incrementCount();
         } catch (MaxCountExceededException e) {
@@ -114,7 +116,7 @@ public abstract class BaseAbstractScalar
     /** {@inheritDoc} */
     public RealPointValuePair optimize(FUNC f,
                                        GoalType goalType,
-                                       double[] startPoint) {
+                                       double[] startPoint) throws MathUserException {
         // Checks.
         if (f == null) {
             throw new NullArgumentException();
@@ -156,6 +158,7 @@ public abstract class BaseAbstractScalar
      * Perform the bulk of the optimization algorithm.
      *
      * @return the point/value pair giving the optimal value for objective function.
+     * @throws MathUserException if objective function throws one
      */
-    protected abstract RealPointValuePair doOptimize();
+    protected abstract RealPointValuePair doOptimize() throws MathUserException;
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractVectorialOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractVectorialOptimizer.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractVectorialOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/BaseAbstractVectorialOptimizer.java Sat Nov 20 21:01:50 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.optimization.direct;
 
 import org.apache.commons.math.util.Incrementor;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.MaxCountExceededException;
 import org.apache.commons.math.exception.TooManyEvaluationsException;
 import org.apache.commons.math.exception.DimensionMismatchException;
@@ -103,8 +104,9 @@ public abstract class BaseAbstractVector
      * @return the objective function value at the specified point.
      * @throws TooManyEvaluationsException if the maximal number of evaluations is
      * exceeded.
+     * @throws MathUserException if objective function throws one
      */
-    protected double[] computeObjectiveValue(double[] point) {
+    protected double[] computeObjectiveValue(double[] point) throws MathUserException {
         try {
             evaluations.incrementCount();
         } catch (MaxCountExceededException e) {
@@ -114,9 +116,8 @@ public abstract class BaseAbstractVector
     }
 
     /** {@inheritDoc} */
-    public VectorialPointValuePair optimize(FUNC f,
-                                            double[] t, double[] w,
-                                            double[] startPoint) {
+    public VectorialPointValuePair optimize(FUNC f, double[] t, double[] w, double[] startPoint)
+        throws MathUserException {
         // Checks.
         if (f == null) {
             throw new NullArgumentException();
@@ -158,8 +159,9 @@ public abstract class BaseAbstractVector
      * Perform the bulk of the optimization algorithm.
      *
      * @return the point/value pair giving the optimal value for objective function
+     * @throws MathUserException if function throws one during search.
      */
-    protected abstract VectorialPointValuePair doOptimize();
+    protected abstract VectorialPointValuePair doOptimize() throws MathUserException;
 
     /**
      * @return a reference to the {@link #target array}.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/MultiDirectionalSimplex.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/MultiDirectionalSimplex.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/MultiDirectionalSimplex.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/MultiDirectionalSimplex.java Sat Nov 20 21:01:50 2010
@@ -20,6 +20,7 @@ package org.apache.commons.math.optimiza
 import java.util.Comparator;
 
 import org.apache.commons.math.analysis.MultivariateRealFunction;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.optimization.RealPointValuePair;
 
 /**
@@ -153,7 +154,8 @@ public class MultiDirectionalSimplex ext
     /** {@inheritDoc} */
     @Override
     public void iterate(final MultivariateRealFunction evaluationFunction,
-                        final Comparator<RealPointValuePair> comparator) {
+                        final Comparator<RealPointValuePair> comparator)
+        throws MathUserException {
         // Save the original simplex.
         final RealPointValuePair[] original = getPoints();
         final RealPointValuePair best = original[0];
@@ -175,8 +177,8 @@ public class MultiDirectionalSimplex ext
         }
 
         // Compute the contracted simplex.
-        final RealPointValuePair contracted = evaluateNewSimplex(evaluationFunction,
-                                                                 original, gamma, comparator);
+        evaluateNewSimplex(evaluationFunction, original, gamma, comparator);
+
     }
 
     /**
@@ -190,11 +192,13 @@ public class MultiDirectionalSimplex ext
      * @return the best point in the transformed simplex.
      * @throws org.apache.commons.math.exception.TooManyEvaluationsException
      * if the maximal number of evaluations is exceeded.
+     * @throws MathUserException if function cannot be evaluated at some points
      */
     private RealPointValuePair evaluateNewSimplex(final MultivariateRealFunction evaluationFunction,
                                                   final RealPointValuePair[] original,
                                                   final double coeff,
-                                                  final Comparator<RealPointValuePair> comparator) {
+                                                  final Comparator<RealPointValuePair> comparator)
+        throws MathUserException {
         final double[] xSmallest = original[0].getPointRef();
         // Perform a linear transformation on all the simplex points,
         // except the first one.

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/NelderMeadSimplex.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/NelderMeadSimplex.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/NelderMeadSimplex.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/NelderMeadSimplex.java Sat Nov 20 21:01:50 2010
@@ -21,6 +21,7 @@ import java.util.Comparator;
 
 import org.apache.commons.math.optimization.RealPointValuePair;
 import org.apache.commons.math.analysis.MultivariateRealFunction;
+import org.apache.commons.math.exception.MathUserException;
 
 /**
  * This class implements the Nelder-Mead simplex algorithm.
@@ -185,7 +186,8 @@ public class NelderMeadSimplex extends A
     /** {@inheritDoc} */
     @Override
     public void iterate(final MultivariateRealFunction evaluationFunction,
-                        final Comparator<RealPointValuePair> comparator) {
+                        final Comparator<RealPointValuePair> comparator)
+        throws MathUserException {
         // The simplex has n + 1 points if dimension is n.
         final int n = getDimension();
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/PowellOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/PowellOptimizer.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/PowellOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/PowellOptimizer.java Sat Nov 20 21:01:50 2010
@@ -20,6 +20,7 @@ package org.apache.commons.math.optimiza
 import org.apache.commons.math.util.FastMath;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.analysis.MultivariateRealFunction;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.NumberIsTooSmallException;
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
 import org.apache.commons.math.optimization.GoalType;
@@ -107,7 +108,7 @@ public class PowellOptimizer
 
     /** {@inheritDoc} */
     @Override
-    protected RealPointValuePair doOptimize() {
+    protected RealPointValuePair doOptimize() throws MathUserException {
         final GoalType goal = getGoalType();
         final double[] guess = getStartPoint();
         final int n = guess.length;
@@ -254,12 +255,13 @@ public class PowellOptimizer
          * @return the optimum.
          * @throws org.apache.commons.math.exception.TooManyEvaluationsException
          * if the number of evaluations is exceeded.
+         * @throws MathUserException if objective function throws one.
          */
-        public UnivariateRealPointValuePair search(final double[] p,
-                                                   final double[] d) {
+        public UnivariateRealPointValuePair search(final double[] p, final double[] d)
+            throws MathUserException {
             final int n = p.length;
             final UnivariateRealFunction f = new UnivariateRealFunction() {
-                    public double value(double alpha) {
+                    public double value(double alpha) throws MathUserException {
                         final double[] x = new double[n];
                         for (int i = 0; i < n; i++) {
                             x[i] = p[i] + alpha * d[i];

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/SimplexOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/SimplexOptimizer.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/SimplexOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/SimplexOptimizer.java Sat Nov 20 21:01:50 2010
@@ -20,6 +20,7 @@ package org.apache.commons.math.optimiza
 import java.util.Comparator;
 
 import org.apache.commons.math.analysis.MultivariateRealFunction;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.NullArgumentException;
 import org.apache.commons.math.optimization.GoalType;
 import org.apache.commons.math.optimization.ConvergenceChecker;
@@ -107,7 +108,7 @@ public class SimplexOptimizer
 
     /** {@inheritDoc} */
     @Override
-    protected RealPointValuePair doOptimize() {
+    protected RealPointValuePair doOptimize() throws MathUserException {
         if (simplex == null) {
             throw new NullArgumentException();
         }
@@ -116,7 +117,7 @@ public class SimplexOptimizer
         // evaluations counter.
         final MultivariateRealFunction evalFunc
             = new MultivariateRealFunction() {
-                public double value(double[] point) {
+                public double value(double[] point) throws MathUserException {
                     return computeObjectiveValue(point);
                 }
             };

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/CurveFitter.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/CurveFitter.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/CurveFitter.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/fitting/CurveFitter.java Sat Nov 20 21:01:50 2010
@@ -22,6 +22,7 @@ import java.util.List;
 
 import org.apache.commons.math.analysis.DifferentiableMultivariateVectorialFunction;
 import org.apache.commons.math.analysis.MultivariateMatrixFunction;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.optimization.DifferentiableMultivariateVectorialOptimizer;
 import org.apache.commons.math.optimization.VectorialPointValuePair;
 
@@ -120,9 +121,10 @@ public class CurveFitter {
      * if the algorithm failed to converge.
      * @exception org.apache.commons.math.exception.DimensionMismatchException
      * if the start point dimension is wrong.
+     * @throws MathUserException if the parametric function throws one
      */
     public double[] fit(final ParametricRealFunction f,
-                        final double[] initialGuess) {
+                        final double[] initialGuess) throws MathUserException {
         // prepare least squares problem
         double[] target  = new double[observations.size()];
         double[] weights = new double[observations.size()];

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/AbstractLeastSquaresOptimizer.java Sat Nov 20 21:01:50 2010
@@ -17,6 +17,7 @@
 
 package org.apache.commons.math.optimization.general;
 
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.NumberIsTooSmallException;
 import org.apache.commons.math.exception.DimensionMismatchException;
 import org.apache.commons.math.analysis.DifferentiableMultivariateVectorialFunction;
@@ -97,8 +98,9 @@ public abstract class AbstractLeastSquar
      *
      * @throws DimensionMismatchException if the Jacobian dimension does not
      * match problem dimension.
+     * @throws MathUserException if users jacobian function throws one
      */
-    protected void updateJacobian() {
+    protected void updateJacobian() throws MathUserException {
         ++jacobianEvaluations;
         weightedResidualJacobian = jF.value(point);
         if (weightedResidualJacobian.length != rows) {
@@ -124,7 +126,7 @@ public abstract class AbstractLeastSquar
      * @throws org.apache.commons.math.exception.TooManyEvaluationsException
      * if the maximal number of evaluations is exceeded.
      */
-    protected void updateResidualsAndCost() {
+    protected void updateResidualsAndCost() throws MathUserException {
         objective = computeObjectiveValue(point);
         if (objective.length != rows) {
             throw new DimensionMismatchException(objective.length, rows);
@@ -174,8 +176,9 @@ public abstract class AbstractLeastSquar
      * @return the covariance matrix.
      * @throws org.apache.commons.math.exception.SingularMatrixException
      * if the covariance matrix cannot be computed (singular problem).
+     * @throws MathUserException if jacobian function throws one
      */
-    public double[][] getCovariances() {
+    public double[][] getCovariances() throws MathUserException {
         // set up the jacobian
         updateJacobian();
 
@@ -208,8 +211,9 @@ public abstract class AbstractLeastSquar
      * @throws NumberIsTooSmallException if the number of degrees of freedom is not
      * positive, i.e. the number of measurements is less or equal to the number of
      * parameters.
+     * @throws MathUserException if jacobian function throws one
      */
-    public double[] guessParametersErrors() {
+    public double[] guessParametersErrors() throws MathUserException {
         if (rows <= cols) {
             throw new NumberIsTooSmallException(LocalizedFormats.NO_DEGREES_OF_FREEDOM,
                                                 rows, cols, false);
@@ -227,7 +231,7 @@ public abstract class AbstractLeastSquar
     @Override
     public VectorialPointValuePair optimize(final DifferentiableMultivariateVectorialFunction f,
                                             final double[] target, final double[] weights,
-                                            final double[] startPoint) {
+                                            final double[] startPoint) throws MathUserException {
         // Reset counter.
         jacobianEvaluations = 0;
 

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=1037328&r1=1037327&r2=1037328&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 Sat Nov 20 21:01:50 2010
@@ -19,6 +19,7 @@ package org.apache.commons.math.optimiza
 
 import org.apache.commons.math.analysis.DifferentiableMultivariateRealFunction;
 import org.apache.commons.math.analysis.MultivariateVectorialFunction;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.optimization.DifferentiableMultivariateRealOptimizer;
 import org.apache.commons.math.optimization.GoalType;
 import org.apache.commons.math.optimization.ConvergenceChecker;
@@ -64,8 +65,10 @@ public abstract class AbstractScalarDiff
      * @return the gradient at the specified point.
      * @throws org.apache.commons.math.exception.TooManyEvaluationsException
      * if the allowed number of evaluations is exceeded.
+     * @throws MathUserException if objective function gradient throws one
      */
-    protected double[] computeObjectiveGradient(final double[] evaluationPoint) {
+    protected double[] computeObjectiveGradient(final double[] evaluationPoint)
+        throws MathUserException {
         return gradient.value(evaluationPoint);
     }
 
@@ -73,7 +76,7 @@ public abstract class AbstractScalarDiff
     @Override
     public RealPointValuePair optimize(final DifferentiableMultivariateRealFunction f,
                                        final GoalType goalType,
-                                       final double[] startPoint) {
+                                       final double[] startPoint) throws MathUserException {
         // Store optimization problem characteristics.
         gradient = f.gradient();
 

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/GaussNewtonOptimizer.java Sat Nov 20 21:01:50 2010
@@ -17,6 +17,7 @@
 
 package org.apache.commons.math.optimization.general;
 
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.SingularMatrixException;
 import org.apache.commons.math.exception.ConvergenceException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
@@ -61,7 +62,7 @@ public class GaussNewtonOptimizer extend
 
     /** {@inheritDoc} */
     @Override
-    public VectorialPointValuePair doOptimize() {
+    public VectorialPointValuePair doOptimize() throws MathUserException {
 
         final ConvergenceChecker<VectorialPointValuePair> checker
             = getConvergenceChecker();

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=1037328&r1=1037327&r2=1037328&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 Sat Nov 20 21:01:50 2010
@@ -19,6 +19,7 @@ package org.apache.commons.math.optimiza
 import java.util.Arrays;
 
 import org.apache.commons.math.exception.ConvergenceException;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.util.LocalizedFormats;
 import org.apache.commons.math.optimization.VectorialPointValuePair;
 import org.apache.commons.math.optimization.ConvergenceChecker;
@@ -214,7 +215,7 @@ public class LevenbergMarquardtOptimizer
 
     /** {@inheritDoc} */
     @Override
-    protected VectorialPointValuePair doOptimize() {
+    protected VectorialPointValuePair doOptimize() throws MathUserException {
         // arrays shared with the other private methods
         solvedCols  = FastMath.min(rows, cols);
         diagR       = new double[cols];

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/general/NonLinearConjugateGradientOptimizer.java Sat Nov 20 21:01:50 2010
@@ -19,6 +19,7 @@ package org.apache.commons.math.optimiza
 
 import org.apache.commons.math.exception.MathIllegalStateException;
 import org.apache.commons.math.exception.ConvergenceException;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.analysis.solvers.BrentSolver;
 import org.apache.commons.math.analysis.solvers.UnivariateRealSolver;
@@ -108,7 +109,7 @@ public class NonLinearConjugateGradientO
 
     /** {@inheritDoc} */
     @Override
-    protected RealPointValuePair doOptimize() {
+    protected RealPointValuePair doOptimize() throws MathUserException {
         // Initialization.
         if (preconditioner == null) {
             preconditioner = new IdentityPreconditioner();
@@ -217,9 +218,11 @@ public class NonLinearConjugateGradientO
      * @param h initial step to try.
      * @return b such that f(a) and f(b) have opposite signs.
      * @exception MathIllegalStateException if no bracket can be found.
+     * @exception MathUserException if function throws one.
      */
     private double findUpperBound(final UnivariateRealFunction f,
-                                  final double a, final double h) {
+                                  final double a, final double h)
+        throws MathUserException {
         final double yA = f.value(a);
         double yB = yA;
         for (double step = h; step < Double.MAX_VALUE; step *= FastMath.max(2, yA / yB)) {
@@ -263,7 +266,7 @@ public class NonLinearConjugateGradientO
         }
 
         /** {@inheritDoc} */
-        public double value(double x) {
+        public double value(double x) throws MathUserException {
 
             // current point in the search direction
             final double[] shiftedPoint = point.clone();

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=1037328&r1=1037327&r2=1037328&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 Sat Nov 20 21:01:50 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.optimization.univariate;
 
 import org.apache.commons.math.util.Incrementor;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.MaxCountExceededException;
 import org.apache.commons.math.exception.TooManyEvaluationsException;
 import org.apache.commons.math.exception.NullArgumentException;
@@ -96,8 +97,9 @@ public abstract class AbstractUnivariate
      * @return the objective function value at specified point.
      * @throws TooManyEvaluationsException if the maximal number of evaluations
      * is exceeded.
+     * @throws MathUserException if objective function throws one
      */
-    protected double computeObjectiveValue(double point) {
+    protected double computeObjectiveValue(double point) throws MathUserException {
         try {
             evaluations.incrementCount();
         } catch (MaxCountExceededException e) {
@@ -110,7 +112,7 @@ public abstract class AbstractUnivariate
     public UnivariateRealPointValuePair optimize(UnivariateRealFunction f,
                                                  GoalType goalType,
                                                  double min, double max,
-                                                 double startValue) {
+                                                 double startValue) throws MathUserException {
         // Checks.
         if (f == null) {
             throw new NullArgumentException();
@@ -134,7 +136,7 @@ public abstract class AbstractUnivariate
     /** {@inheritDoc} */
     public UnivariateRealPointValuePair optimize(UnivariateRealFunction f,
                                                  GoalType goalType,
-                                                 double min, double max) {
+                                                 double min, double max) throws MathUserException {
         return optimize(f, goalType, min, max, min + 0.5 * (max - min));
     }
 
@@ -159,6 +161,7 @@ public abstract class AbstractUnivariate
      * @return the optimum and its corresponding function value.
      * @throws TooManyEvaluationsException if the maximal number of evaluations
      * is exceeded.
+     * @throws MathUserException if the function to optimize throws one during search.
      */
-    protected abstract UnivariateRealPointValuePair doOptimize();
+    protected abstract UnivariateRealPointValuePair doOptimize() throws MathUserException;
 }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BaseUnivariateRealOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BaseUnivariateRealOptimizer.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BaseUnivariateRealOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/BaseUnivariateRealOptimizer.java Sat Nov 20 21:01:50 2010
@@ -18,6 +18,7 @@
 package org.apache.commons.math.optimization.univariate;
 
 import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.optimization.BaseOptimizer;
 import org.apache.commons.math.optimization.GoalType;
 
@@ -53,9 +54,10 @@ public interface BaseUnivariateRealOptim
      * if the optimizer detects a convergence problem.
      * @throws IllegalArgumentException if {@code min > max} or the endpoints
      * do not satisfy the requirements specified by the optimizer.
+     * @throws MathUserException if the function to optimize throws one during search.
      */
     UnivariateRealPointValuePair optimize(FUNC f, GoalType goalType,
-                                          double min, double max);
+                                          double min, double max) throws MathUserException;
 
     /**
      * Find an optimum in the given interval, start at startValue.
@@ -76,8 +78,9 @@ public interface BaseUnivariateRealOptim
      * do not satisfy the requirements specified by the optimizer.
      * @throws org.apache.commons.math.exception.NullArgumentException if any
      * argument is {@code null}.
+     * @throws MathUserException if the function to optimize throws one during search.
      */
     UnivariateRealPointValuePair optimize(FUNC f, GoalType goalType,
                                           double min, double max,
-                                          double startValue);
+                                          double startValue) throws MathUserException;
 }

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=1037328&r1=1037327&r2=1037328&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 Sat Nov 20 21:01:50 2010
@@ -17,6 +17,7 @@
 package org.apache.commons.math.optimization.univariate;
 
 import org.apache.commons.math.util.Incrementor;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
 import org.apache.commons.math.exception.TooManyEvaluationsException;
 import org.apache.commons.math.exception.MaxCountExceededException;
@@ -102,17 +103,16 @@ public class BracketFinder {
     /**
      * Search new points that bracket a local optimum of the function.
      *
-     * @param func Function whose optimum should be bracketted.
+     * @param func Function whose optimum should be bracketed.
      * @param goal {@link GoalType Goal type}.
      * @param xA Initial point.
      * @param xB Initial point.
      * @throws TooManyEvaluationsException if the maximum number of evaluations
      * is exceeded.
+     * @throws MathUserException if function throw one
      */
-    public void search(UnivariateRealFunction func,
-                       GoalType goal,
-                       double xA,
-                       double xB) {
+    public void search(UnivariateRealFunction func, GoalType goal, double xA, double xB)
+        throws MathUserException {
         evaluations.resetCount();
         final boolean isMinim = goal == GoalType.MINIMIZE;
 
@@ -278,9 +278,9 @@ public class BracketFinder {
      * @return {@code f(x)}
      * @throws TooManyEvaluationsException if the maximal number of evaluations is
      * exceeded.
+     * @throws MathUserException if f throws one.
      */
-    private double eval(UnivariateRealFunction f,
-                        double x) {
+    private double eval(UnivariateRealFunction f, double x) throws MathUserException {
         try {
             evaluations.incrementCount();
         } catch (MaxCountExceededException e) {

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=1037328&r1=1037327&r2=1037328&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 Sat Nov 20 21:01:50 2010
@@ -18,6 +18,7 @@ package org.apache.commons.math.optimiza
 
 import org.apache.commons.math.util.MathUtils;
 import org.apache.commons.math.util.FastMath;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.exception.NumberIsTooSmallException;
 import org.apache.commons.math.exception.NotStrictlyPositiveException;
 import org.apache.commons.math.optimization.ConvergenceChecker;
@@ -85,7 +86,7 @@ public class BrentOptimizer extends Abst
 
     /** {@inheritDoc} */
     @Override
-    protected UnivariateRealPointValuePair doOptimize() {
+    protected UnivariateRealPointValuePair doOptimize() throws MathUserException {
         final boolean isMinim = getGoalType() == GoalType.MINIMIZE;
         final double lo = getMin();
         final double mid = getStartValue();

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/MultiStartUnivariateRealOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/MultiStartUnivariateRealOptimizer.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/MultiStartUnivariateRealOptimizer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/univariate/MultiStartUnivariateRealOptimizer.java Sat Nov 20 21:01:50 2010
@@ -140,14 +140,16 @@ public class MultiStartUnivariateRealOpt
     /** {@inheritDoc} */
     public UnivariateRealPointValuePair optimize(final FUNC f,
                                                  final GoalType goal,
-                                                 final double min, final double max) {
+                                                 final double min, final double max)
+        throws MathUserException {
         return optimize(f, goal, min, max, min + 0.5 * (max - min));
     }
 
     /** {@inheritDoc} */
     public UnivariateRealPointValuePair optimize(final FUNC f, final GoalType goal,
                                                  final double min, final double max,
-                                                 final double startValue) {
+                                                 final double startValue)
+        throws MathUserException {
         MathUserException lastException = null;
         optima = new UnivariateRealPointValuePair[starts];
         totalEvaluations = 0;

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java Sat Nov 20 21:01:50 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.transform;
 
-import org.apache.commons.math.exception.FunctionEvaluationException;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.complex.Complex;
@@ -76,13 +76,13 @@ public class FastCosineTransformer imple
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real transformed array
-     * @throws FunctionEvaluationException if function cannot be evaluated
+     * @throws MathUserException if function cannot be evaluated
      * at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public double[] transform(UnivariateRealFunction f,
                               double min, double max, int n)
-        throws FunctionEvaluationException, IllegalArgumentException {
+        throws MathUserException, IllegalArgumentException {
         double data[] = FastFourierTransformer.sample(f, min, max, n);
         return fct(data);
     }
@@ -117,13 +117,13 @@ public class FastCosineTransformer imple
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real transformed array
-     * @throws FunctionEvaluationException if function cannot be evaluated
+     * @throws MathUserException if function cannot be evaluated
      * at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public double[] transform2(UnivariateRealFunction f,
                                double min, double max, int n)
-        throws FunctionEvaluationException, IllegalArgumentException {
+        throws MathUserException, IllegalArgumentException {
 
         double data[] = FastFourierTransformer.sample(f, min, max, n);
         double scaling_coefficient = FastMath.sqrt(2.0 / (n-1));
@@ -159,13 +159,12 @@ public class FastCosineTransformer imple
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real inversely transformed array
-     * @throws FunctionEvaluationException if function cannot be evaluated
-     * at some point
+     * @throws MathUserException if function cannot be evaluated at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public double[] inversetransform(UnivariateRealFunction f,
                                      double min, double max, int n)
-        throws FunctionEvaluationException, IllegalArgumentException {
+        throws MathUserException, IllegalArgumentException {
 
         double data[] = FastFourierTransformer.sample(f, min, max, n);
         double scaling_coefficient = 2.0 / (n - 1);
@@ -199,13 +198,12 @@ public class FastCosineTransformer imple
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real inversely transformed array
-     * @throws FunctionEvaluationException if function cannot be evaluated
-     * at some point
+     * @throws MathUserException if function cannot be evaluated at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public double[] inversetransform2(UnivariateRealFunction f,
                                       double min, double max, int n)
-        throws FunctionEvaluationException, IllegalArgumentException {
+        throws MathUserException, IllegalArgumentException {
 
         return transform2(f, min, max, n);
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java Sat Nov 20 21:01:50 2010
@@ -19,7 +19,7 @@ package org.apache.commons.math.transfor
 import java.io.Serializable;
 import java.lang.reflect.Array;
 
-import org.apache.commons.math.exception.FunctionEvaluationException;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.complex.Complex;
@@ -86,13 +86,13 @@ public class FastFourierTransformer impl
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the complex transformed array
-     * @throws FunctionEvaluationException if function cannot be evaluated
+     * @throws MathUserException if function cannot be evaluated
      * at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public Complex[] transform(UnivariateRealFunction f,
                                double min, double max, int n)
-        throws FunctionEvaluationException, IllegalArgumentException {
+        throws MathUserException, IllegalArgumentException {
         double data[] = sample(f, min, max, n);
         return fft(data, false);
     }
@@ -141,13 +141,13 @@ public class FastFourierTransformer impl
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the complex transformed array
-     * @throws FunctionEvaluationException if function cannot be evaluated
+     * @throws MathUserException if function cannot be evaluated
      * at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public Complex[] transform2(UnivariateRealFunction f,
                                 double min, double max, int n)
-        throws FunctionEvaluationException, IllegalArgumentException {
+        throws MathUserException, IllegalArgumentException {
 
         double data[] = sample(f, min, max, n);
         double scaling_coefficient = 1.0 / FastMath.sqrt(n);
@@ -200,13 +200,13 @@ public class FastFourierTransformer impl
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the complex inversely transformed array
-     * @throws FunctionEvaluationException if function cannot be evaluated
+     * @throws MathUserException if function cannot be evaluated
      * at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public Complex[] inversetransform(UnivariateRealFunction f,
                                       double min, double max, int n)
-        throws FunctionEvaluationException, IllegalArgumentException {
+        throws MathUserException, IllegalArgumentException {
 
         double data[] = sample(f, min, max, n);
         double scaling_coefficient = 1.0 / n;
@@ -259,13 +259,13 @@ public class FastFourierTransformer impl
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the complex inversely transformed array
-     * @throws FunctionEvaluationException if function cannot be evaluated
+     * @throws MathUserException if function cannot be evaluated
      * at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public Complex[] inversetransform2(UnivariateRealFunction f,
                                        double min, double max, int n)
-        throws FunctionEvaluationException, IllegalArgumentException {
+        throws MathUserException, IllegalArgumentException {
 
         double data[] = sample(f, min, max, n);
         double scaling_coefficient = 1.0 / FastMath.sqrt(n);
@@ -424,13 +424,11 @@ public class FastFourierTransformer impl
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the samples array
-     * @throws FunctionEvaluationException if function cannot be evaluated
-     * at some point
+     * @throws MathUserException if function cannot be evaluated at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
-    public static double[] sample(UnivariateRealFunction f,
-                                  double min, double max, int n)
-        throws FunctionEvaluationException, IllegalArgumentException {
+    public static double[] sample(UnivariateRealFunction f, double min, double max, int n)
+        throws MathUserException, IllegalArgumentException {
 
         if (n <= 0) {
             throw MathRuntimeException.createIllegalArgumentException(

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java Sat Nov 20 21:01:50 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.transform;
 
-import org.apache.commons.math.exception.FunctionEvaluationException;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.exception.util.LocalizedFormats;
@@ -43,7 +43,7 @@ public class FastHadamardTransformer imp
     /** {@inheritDoc} */
     public double[] transform(UnivariateRealFunction f,
                               double min, double max, int n)
-        throws FunctionEvaluationException, IllegalArgumentException {
+        throws MathUserException, IllegalArgumentException {
         return fht(FastFourierTransformer.sample(f, min, max, n));
     }
 
@@ -56,7 +56,7 @@ public class FastHadamardTransformer imp
     /** {@inheritDoc} */
     public double[] inversetransform(UnivariateRealFunction f,
                                      double min, double max, int n)
-        throws FunctionEvaluationException, IllegalArgumentException {
+        throws MathUserException, IllegalArgumentException {
         final double[] unscaled =
             fht(FastFourierTransformer.sample(f, min, max, n));
         return FastFourierTransformer.scaleArray(unscaled, 1.0 / n);

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java Sat Nov 20 21:01:50 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.transform;
 
-import org.apache.commons.math.exception.FunctionEvaluationException;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.MathRuntimeException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 import org.apache.commons.math.complex.Complex;
@@ -75,13 +75,13 @@ public class FastSineTransformer impleme
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real transformed array
-     * @throws FunctionEvaluationException if function cannot be evaluated
+     * @throws MathUserException if function cannot be evaluated
      * at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public double[] transform(UnivariateRealFunction f,
                               double min, double max, int n)
-        throws FunctionEvaluationException, IllegalArgumentException {
+        throws MathUserException, IllegalArgumentException {
 
         double data[] = FastFourierTransformer.sample(f, min, max, n);
         data[0] = 0.0;
@@ -115,13 +115,13 @@ public class FastSineTransformer impleme
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real transformed array
-     * @throws FunctionEvaluationException if function cannot be evaluated
+     * @throws MathUserException if function cannot be evaluated
      * at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public double[] transform2(
         UnivariateRealFunction f, double min, double max, int n)
-        throws FunctionEvaluationException, IllegalArgumentException {
+        throws MathUserException, IllegalArgumentException {
 
         double data[] = FastFourierTransformer.sample(f, min, max, n);
         data[0] = 0.0;
@@ -156,12 +156,11 @@ public class FastSineTransformer impleme
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real inversely transformed array
-     * @throws FunctionEvaluationException if function cannot be evaluated
-     * at some point
+     * @throws MathUserException if function cannot be evaluated at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public double[] inversetransform(UnivariateRealFunction f, double min, double max, int n)
-        throws FunctionEvaluationException, IllegalArgumentException {
+        throws MathUserException, IllegalArgumentException {
 
         double data[] = FastFourierTransformer.sample(f, min, max, n);
         data[0] = 0.0;
@@ -195,12 +194,11 @@ public class FastSineTransformer impleme
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real inversely transformed array
-     * @throws FunctionEvaluationException if function cannot be evaluated
-     * at some point
+     * @throws MathUserException if function cannot be evaluated at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     public double[] inversetransform2(UnivariateRealFunction f, double min, double max, int n)
-        throws FunctionEvaluationException, IllegalArgumentException {
+        throws MathUserException, IllegalArgumentException {
 
         return transform2(f, min, max, n);
     }

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/RealTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/RealTransformer.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/RealTransformer.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/transform/RealTransformer.java Sat Nov 20 21:01:50 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.transform;
 
-import org.apache.commons.math.exception.FunctionEvaluationException;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.analysis.UnivariateRealFunction;
 
 /**
@@ -49,12 +49,11 @@ public interface RealTransformer  {
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real transformed array
-     * @throws FunctionEvaluationException if function cannot be evaluated
-     * at some point
+     * @throws MathUserException if function cannot be evaluated at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     double[] transform(UnivariateRealFunction f, double min, double max, int n)
-        throws FunctionEvaluationException, IllegalArgumentException;
+        throws MathUserException, IllegalArgumentException;
 
     /**
      * Inversely transform the given real data set.
@@ -72,11 +71,10 @@ public interface RealTransformer  {
      * @param max the upper bound for the interval
      * @param n the number of sample points
      * @return the real inversely transformed array
-     * @throws FunctionEvaluationException if function cannot be evaluated
-     * at some point
+     * @throws MathUserException if function cannot be evaluated at some point
      * @throws IllegalArgumentException if any parameters are invalid
      */
     double[] inversetransform(UnivariateRealFunction f, double min, double max, int n)
-        throws FunctionEvaluationException, IllegalArgumentException;
+        throws MathUserException, IllegalArgumentException;
 
 }

Modified: commons/proper/math/trunk/src/site/xdoc/userguide/ode.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/site/xdoc/userguide/ode.xml?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/site/xdoc/userguide/ode.xml (original)
+++ commons/proper/math/trunk/src/site/xdoc/userguide/ode.xml Sat Nov 20 21:01:50 2010
@@ -132,9 +132,9 @@ StepHandler stepHandler = new StepHandle
             
     public boolean requiresDenseOutput() { return false; }
             
-    public void handleStep(StepInterpolator interpolator, boolean isLast) throws DerivativeException {
+    public void handleStep(StepInterpolator interpolator, boolean isLast) throws MathUserException {
         double   t = interpolator.getCurrentTime();
-        double[] y = interpolator.getInterpolatedY();
+        double[] y = interpolator.getInterpolatedState();
         System.out.println(t + " " + y[0] + " " + y[1]);
     }
 };

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/BinaryFunctionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/BinaryFunctionTest.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/BinaryFunctionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/BinaryFunctionTest.java Sat Nov 20 21:01:50 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.analysis;
 
-import org.apache.commons.math.exception.FunctionEvaluationException;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
@@ -24,43 +24,43 @@ import org.junit.Test;
 public class BinaryFunctionTest {
 
     @Test
-    public void testAdd() throws FunctionEvaluationException {
+    public void testAdd() throws MathUserException {
         Assert.assertEquals(5.0, BinaryFunction.ADD.value(2, 3), 1.0e-15);
         Assert.assertEquals(0.0, BinaryFunction.ADD.value(-1, 1), 1.0e-15);
     }
 
     @Test
-    public void testSubtract() throws FunctionEvaluationException {
+    public void testSubtract() throws MathUserException {
         Assert.assertEquals(-1.0, BinaryFunction.SUBTRACT.value(2, 3), 1.0e-15);
         Assert.assertEquals(-2.0, BinaryFunction.SUBTRACT.value(-1, 1), 1.0e-15);
     }
 
     @Test
-    public void testMultiply() throws FunctionEvaluationException {
+    public void testMultiply() throws MathUserException {
         Assert.assertEquals(6.0, BinaryFunction.MULTIPLY.value(2, 3), 1.0e-15);
         Assert.assertEquals(-1.0, BinaryFunction.MULTIPLY.value(-1, 1), 1.0e-15);
     }
 
     @Test
-    public void testDivide() throws FunctionEvaluationException {
+    public void testDivide() throws MathUserException {
         Assert.assertEquals(1.5, BinaryFunction.DIVIDE.value(3, 2), 1.0e-15);
         Assert.assertEquals(-1.0, BinaryFunction.DIVIDE.value(-1, 1), 1.0e-15);
     }
 
     @Test
-    public void testPow() throws FunctionEvaluationException {
+    public void testPow() throws MathUserException {
         Assert.assertEquals(9.0, BinaryFunction.POW.value(3, 2), 1.0e-15);
         Assert.assertEquals(-1.0, BinaryFunction.POW.value(-1, 1), 1.0e-15);
     }
 
     @Test
-    public void testAtan2() throws FunctionEvaluationException {
+    public void testAtan2() throws MathUserException {
         Assert.assertEquals(FastMath.PI / 4, BinaryFunction.ATAN2.value(1, 1), 1.0e-15);
         Assert.assertEquals(-FastMath.PI / 4, BinaryFunction.ATAN2.value(-1, 1), 1.0e-15);
     }
 
     @Test
-    public void testFix1st() throws FunctionEvaluationException {
+    public void testFix1st() throws MathUserException {
         ComposableFunction f = BinaryFunction.POW.fix1stArgument(2);
         for (double x = 0.0; x < 1.0; x += 0.01) {
             Assert.assertEquals(FastMath.pow(2.0, x), f.value(x), 1.0e-15);
@@ -68,7 +68,7 @@ public class BinaryFunctionTest {
     }
 
     @Test
-    public void testFix2nd() throws FunctionEvaluationException {
+    public void testFix2nd() throws MathUserException {
         ComposableFunction f = BinaryFunction.POW.fix2ndArgument(2);
         for (double y = 0.0; y < 1.0; y += 0.01) {
             Assert.assertEquals(y * y, f.value(y), 1.0e-15);

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/ComposableFunctionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/ComposableFunctionTest.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/ComposableFunctionTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/ComposableFunctionTest.java Sat Nov 20 21:01:50 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.analysis;
 
-import org.apache.commons.math.exception.FunctionEvaluationException;
+import org.apache.commons.math.exception.MathUserException;
 import org.apache.commons.math.util.FastMath;
 import org.junit.Assert;
 import org.junit.Test;
@@ -24,37 +24,37 @@ import org.junit.Test;
 public class ComposableFunctionTest {
 
     @Test
-    public void testZero() throws FunctionEvaluationException {
+    public void testZero() throws MathUserException {
         Assert.assertEquals(0.0, ComposableFunction.ZERO.value(1), 1.0e-15);
         Assert.assertEquals(0.0, ComposableFunction.ZERO.value(2), 1.0e-15);
     }
 
     @Test
-    public void testOne() throws FunctionEvaluationException {
+    public void testOne() throws MathUserException {
         Assert.assertEquals(1.0, ComposableFunction.ONE.value(1), 1.0e-15);
         Assert.assertEquals(1.0, ComposableFunction.ONE.value(2), 1.0e-15);
     }
 
     @Test
-    public void testIdentity() throws FunctionEvaluationException {
+    public void testIdentity() throws MathUserException {
         Assert.assertEquals(1.0, ComposableFunction.IDENTITY.value(1), 1.0e-15);
         Assert.assertEquals(2.0, ComposableFunction.IDENTITY.value(2), 1.0e-15);
     }
 
     @Test
-    public void testRint() throws FunctionEvaluationException {
+    public void testRint() throws MathUserException {
         Assert.assertEquals(1.0, ComposableFunction.RINT.value(0.9), 1.0e-15);
         Assert.assertEquals(2.0, ComposableFunction.RINT.value(2.2), 1.0e-15);
     }
 
     @Test
-    public void testSignum() throws FunctionEvaluationException {
+    public void testSignum() throws MathUserException {
         Assert.assertEquals(1.0, ComposableFunction.SIGNUM.value(12.3), 1.0e-15);
         Assert.assertEquals(-1.0, ComposableFunction.SIGNUM.value(-6), 1.0e-15);
     }
 
     @Test
-    public void testComposition() throws FunctionEvaluationException {
+    public void testComposition() throws MathUserException {
         ComposableFunction abs    = ComposableFunction.ABS;
         ComposableFunction acos   = ComposableFunction.ACOS;
         ComposableFunction asin   = ComposableFunction.ASIN;
@@ -104,7 +104,7 @@ public class ComposableFunctionTest {
     }
 
     @Test
-    public void testCombine() throws FunctionEvaluationException {
+    public void testCombine() throws MathUserException {
 
         ComposableFunction f =
             ComposableFunction.COS.combine(ComposableFunction.ASIN, BinaryFunction.POW);
@@ -115,7 +115,7 @@ public class ComposableFunctionTest {
     }
 
     @Test
-    public void testSimpleCombination() throws FunctionEvaluationException {
+    public void testSimpleCombination() throws MathUserException {
 
         ComposableFunction f1 = ComposableFunction.COS.add(3);
         ComposableFunction f2 = ComposableFunction.COS.add(ComposableFunction.SIN);
@@ -135,7 +135,7 @@ public class ComposableFunctionTest {
     }
 
     @Test
-    public void testCollector() throws FunctionEvaluationException {
+    public void testCollector() throws MathUserException {
 
         ComposableFunction f = BinaryFunction.POW.fix2ndArgument(2);
         Assert.assertEquals(30, f.asCollector().value(new double[] { 1, 2, 3, 4 }), 1.0e-15);

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/Expm1Function.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/Expm1Function.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/Expm1Function.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/Expm1Function.java Sat Nov 20 21:01:50 2010
@@ -16,7 +16,6 @@
  */
 package org.apache.commons.math.analysis;
 
-import org.apache.commons.math.exception.FunctionEvaluationException;
 import org.apache.commons.math.util.FastMath;
 
 /**
@@ -26,14 +25,13 @@ import org.apache.commons.math.util.Fast
  */
 public class Expm1Function implements DifferentiableUnivariateRealFunction {
 
-    public double value(double x) throws FunctionEvaluationException {
-        // FastMath.expm1() is available in jdk 1.5 but not in jdk 1.4.2.
-        return FastMath.exp(x) - 1.0;
+    public double value(double x) {
+        return FastMath.expm1(x);
     }
 
     public UnivariateRealFunction derivative() {
         return new UnivariateRealFunction() {
-            public double value(double x) throws FunctionEvaluationException {
+            public double value(double x) {
                 return FastMath.exp(x);
             }
         };

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/MonitoredFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/MonitoredFunction.java?rev=1037328&r1=1037327&r2=1037328&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/MonitoredFunction.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/MonitoredFunction.java Sat Nov 20 21:01:50 2010
@@ -16,7 +16,7 @@
  */
 package org.apache.commons.math.analysis;
 
-import org.apache.commons.math.exception.FunctionEvaluationException;
+import org.apache.commons.math.exception.MathUserException;
 
 /**
  * Wrapper class for counting functions calls.
@@ -38,7 +38,7 @@ public class MonitoredFunction implement
         return callsCount;
     }
 
-    public double value(double x) throws FunctionEvaluationException {
+    public double value(double x) throws MathUserException {
         ++callsCount;
         return f.value(x);
     }



Mime
View raw message