You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by lu...@apache.org on 2010/11/20 21:57:42 UTC
svn commit: r1037327 [5/7] - in /commons/proper/math/branches/MATH_2_X/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/analysi...
Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/AbstractUnivariateRealOptimizer.java Sat Nov 20 20:57:37 2010
@@ -18,10 +18,10 @@
package org.apache.commons.math.optimization.univariate;
import org.apache.commons.math.ConvergingAlgorithmImpl;
-import org.apache.commons.math.FunctionEvaluationException;
import org.apache.commons.math.MaxEvaluationsExceededException;
import org.apache.commons.math.MaxIterationsExceededException;
import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.exception.NoDataException;
import org.apache.commons.math.optimization.GoalType;
import org.apache.commons.math.optimization.UnivariateRealOptimizer;
@@ -58,7 +58,6 @@ public abstract class AbstractUnivariate
/**
* Construct a solver with given iteration count and accuracy.
- * FunctionEvaluationExceptionFunctionEvaluationException
* @param defaultAbsoluteAccuracy maximum absolute error
* @param defaultMaximalIterationCount maximum number of iterations
* @throws IllegalArgumentException if f is null or the
@@ -100,14 +99,10 @@ public abstract class AbstractUnivariate
}
/** {@inheritDoc} */
- public double getFunctionValue() {
+ public double getFunctionValue() throws MathUserException {
if (Double.isNaN(functionValue)) {
final double opt = getResult();
- try {
- functionValue = function.value(opt);
- } catch (FunctionEvaluationException e) {
- throw new RuntimeException(e);
- }
+ functionValue = function.value(opt);
}
return functionValue;
}
@@ -181,17 +176,16 @@ public abstract class AbstractUnivariate
* @param f objective function
* @param point point at which the objective function must be evaluated
* @return objective function value at specified point
- * @exception FunctionEvaluationException if the function cannot be evaluated
+ * @exception MathUserException if the function cannot be evaluated
* or the maximal number of iterations is exceeded
* @deprecated in 2.2. Use this {@link #computeObjectiveValue(double)
* replacement} instead.
*/
protected double computeObjectiveValue(final UnivariateRealFunction f,
final double point)
- throws FunctionEvaluationException {
+ throws MathUserException {
if (++evaluations > maxEvaluations) {
- throw new FunctionEvaluationException(new MaxEvaluationsExceededException(maxEvaluations),
- point);
+ throw new MathUserException(new MaxEvaluationsExceededException(maxEvaluations));
}
return f.value(point);
}
@@ -201,15 +195,14 @@ public abstract class AbstractUnivariate
*
* @param point Point at which the objective function must be evaluated.
* @return the objective function value at specified point.
- * @exception FunctionEvaluationException if the function cannot be evaluated
+ * @exception MathUserException if the function cannot be evaluated
* or the maximal number of iterations is exceeded.
*/
protected double computeObjectiveValue(double point)
- throws FunctionEvaluationException {
+ throws MathUserException {
if (++evaluations > maxEvaluations) {
resultComputed = false;
- throw new FunctionEvaluationException(new MaxEvaluationsExceededException(maxEvaluations),
- point);
+ throw new MathUserException(new MaxEvaluationsExceededException(maxEvaluations));
}
return function.value(point);
}
@@ -217,7 +210,7 @@ public abstract class AbstractUnivariate
/** {@inheritDoc} */
public double optimize(UnivariateRealFunction f, GoalType goal,
double min, double max, double startValue)
- throws MaxIterationsExceededException, FunctionEvaluationException {
+ throws MaxIterationsExceededException, MathUserException {
// Initialize.
this.searchMin = min;
this.searchMax = max;
@@ -249,7 +242,7 @@ public abstract class AbstractUnivariate
/** {@inheritDoc} */
public double optimize(UnivariateRealFunction f, GoalType goal,
double min, double max)
- throws MaxIterationsExceededException, FunctionEvaluationException {
+ throws MaxIterationsExceededException, MathUserException {
return optimize(f, goal, min, max, min + 0.5 * (max - min));
}
@@ -260,9 +253,9 @@ public abstract class AbstractUnivariate
* @return the optimum.
* @throws MaxIterationsExceededException if the maximum iteration count
* is exceeded.
- * @throws FunctionEvaluationException if an error occurs evaluating
+ * @throws MathUserException if an error occurs evaluating
* the function.
*/
protected abstract double doOptimize()
- throws MaxIterationsExceededException, FunctionEvaluationException;
+ throws MaxIterationsExceededException, MathUserException;
}
Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/BracketFinder.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/BracketFinder.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/BracketFinder.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/BracketFinder.java Sat Nov 20 20:57:37 2010
@@ -16,8 +16,8 @@
*/
package org.apache.commons.math.optimization.univariate;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.exception.NotStrictlyPositiveException;
-import org.apache.commons.math.FunctionEvaluationException;
import org.apache.commons.math.MaxIterationsExceededException;
import org.apache.commons.math.analysis.UnivariateRealFunction;
import org.apache.commons.math.optimization.GoalType;
@@ -114,15 +114,13 @@ public class BracketFinder {
* @param xB Initial point.
* @throws MaxIterationsExceededException if the maximum iteration count
* is exceeded.
- * @throws FunctionEvaluationException if an error occurs evaluating
- * the function.
+ * @throws MathUserException if an error occurs evaluating the function.
*/
public void search(UnivariateRealFunction func,
GoalType goal,
double xA,
double xB)
- throws MaxIterationsExceededException,
- FunctionEvaluationException {
+ throws MaxIterationsExceededException, MathUserException {
reset();
final boolean isMinim = goal == GoalType.MINIMIZE;
@@ -278,11 +276,10 @@ public class BracketFinder {
* @param f Function.
* @param x Argument.
* @return {@code f(x)}
- * @throws FunctionEvaluationException if function cannot be evaluated at x
+ * @throws MathUserException if function cannot be evaluated at x
*/
- private double eval(UnivariateRealFunction f,
- double x)
- throws FunctionEvaluationException {
+ private double eval(UnivariateRealFunction f, double x)
+ throws MathUserException {
++evaluations;
return f.value(x);
Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/BrentOptimizer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/BrentOptimizer.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/BrentOptimizer.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/optimization/univariate/BrentOptimizer.java Sat Nov 20 20:57:37 2010
@@ -16,8 +16,8 @@
*/
package org.apache.commons.math.optimization.univariate;
-import org.apache.commons.math.FunctionEvaluationException;
import org.apache.commons.math.MaxIterationsExceededException;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.exception.NotStrictlyPositiveException;
import org.apache.commons.math.optimization.GoalType;
import org.apache.commons.math.util.FastMath;
@@ -49,7 +49,7 @@ public class BrentOptimizer extends Abst
/** {@inheritDoc} */
protected double doOptimize()
- throws MaxIterationsExceededException, FunctionEvaluationException {
+ throws MaxIterationsExceededException, MathUserException {
return localMin(getGoalType() == GoalType.MINIMIZE,
getMin(), getStartValue(), getMax(),
getRelativeAccuracy(), getAbsoluteAccuracy());
@@ -76,13 +76,12 @@ public class BrentOptimizer extends Abst
* @return the optimum point.
* @throws MaxIterationsExceededException if the maximum iteration count
* is exceeded.
- * @throws FunctionEvaluationException if an error occurs evaluating
- * the function.
+ * @throws MathUserException if an error occurs evaluating the function.
*/
private double localMin(boolean isMinim,
double lo, double mid, double hi,
double eps, double t)
- throws MaxIterationsExceededException, FunctionEvaluationException {
+ throws MaxIterationsExceededException, MathUserException {
if (eps <= 0) {
throw new NotStrictlyPositiveException(eps);
}
Modified: commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastCosineTransformer.java Sat Nov 20 20:57:37 2010
@@ -16,10 +16,10 @@
*/
package org.apache.commons.math.transform;
-import org.apache.commons.math.FunctionEvaluationException;
import org.apache.commons.math.MathRuntimeException;
import org.apache.commons.math.analysis.UnivariateRealFunction;
import org.apache.commons.math.complex.Complex;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.exception.util.LocalizedFormats;
import org.apache.commons.math.util.FastMath;
@@ -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/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastFourierTransformer.java Sat Nov 20 20:57:37 2010
@@ -19,10 +19,10 @@ package org.apache.commons.math.transfor
import java.io.Serializable;
import java.lang.reflect.Array;
-import org.apache.commons.math.FunctionEvaluationException;
import org.apache.commons.math.MathRuntimeException;
import org.apache.commons.math.analysis.UnivariateRealFunction;
import org.apache.commons.math.complex.Complex;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.exception.util.LocalizedFormats;
import org.apache.commons.math.util.FastMath;
@@ -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/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastHadamardTransformer.java Sat Nov 20 20:57:37 2010
@@ -16,9 +16,9 @@
*/
package org.apache.commons.math.transform;
-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.MathUserException;
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/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/FastSineTransformer.java Sat Nov 20 20:57:37 2010
@@ -16,10 +16,10 @@
*/
package org.apache.commons.math.transform;
-import org.apache.commons.math.FunctionEvaluationException;
import org.apache.commons.math.MathRuntimeException;
import org.apache.commons.math.analysis.UnivariateRealFunction;
import org.apache.commons.math.complex.Complex;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.exception.util.LocalizedFormats;
import org.apache.commons.math.util.FastMath;
@@ -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/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/RealTransformer.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/RealTransformer.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/RealTransformer.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/main/java/org/apache/commons/math/transform/RealTransformer.java Sat Nov 20 20:57:37 2010
@@ -16,8 +16,8 @@
*/
package org.apache.commons.math.transform;
-import org.apache.commons.math.FunctionEvaluationException;
import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.exception.MathUserException;
/**
* Interface for one-dimensional data sets transformations producing real results.
@@ -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/branches/MATH_2_X/src/site/xdoc/userguide/ode.xml
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/site/xdoc/userguide/ode.xml?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/site/xdoc/userguide/ode.xml (original)
+++ commons/proper/math/branches/MATH_2_X/src/site/xdoc/userguide/ode.xml Sat Nov 20 20:57:37 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/branches/MATH_2_X/src/test/java/org/apache/commons/math/ArgumentOutsideDomainExceptionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ArgumentOutsideDomainExceptionTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ArgumentOutsideDomainExceptionTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ArgumentOutsideDomainExceptionTest.java Sat Nov 20 20:57:37 2010
@@ -33,7 +33,7 @@ public class ArgumentOutsideDomainExcept
assertNull(ex.getCause());
assertNotNull(ex.getMessage());
assertTrue(ex.getMessage().indexOf("3.14") > 0);
- assertEquals(FastMath.PI, ex.getArgument()[0], 0);
+ assertEquals(FastMath.PI, ex.getArgument().doubleValue(), 0);
assertFalse(ex.getMessage().equals(ex.getMessage(Locale.FRENCH)));
}
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/FunctionEvaluationExceptionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/FunctionEvaluationExceptionTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/FunctionEvaluationExceptionTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/FunctionEvaluationExceptionTest.java Sat Nov 20 20:57:37 2010
@@ -25,6 +25,7 @@ import junit.framework.TestCase;
/**
* @version $Revision$ $Date$
+ * @deprecated in 2.2 (to be removed in 3.0)
*/
public class FunctionEvaluationExceptionTest extends TestCase {
@@ -52,7 +53,7 @@ public class FunctionEvaluationException
Object[] arguments = { Double.valueOf(0.0) };
FunctionEvaluationException ex = new FunctionEvaluationException(0.0, pattern, arguments);
assertNull(ex.getCause());
- assertEquals(pattern, ex.getLocalizablePattern());
+ assertEquals(pattern, ex.getGeneralPattern());
assertEquals(arguments.length, ex.getArguments().length);
for (int i = 0; i < arguments.length; ++i) {
assertEquals(arguments[i], ex.getArguments()[i]);
@@ -67,7 +68,7 @@ public class FunctionEvaluationException
FunctionEvaluationException ex =
new FunctionEvaluationException(new double[] { 0, 1, 2 }, pattern, arguments);
assertNull(ex.getCause());
- assertEquals(pattern, ex.getLocalizablePattern());
+ assertEquals(pattern, ex.getGeneralPattern());
assertEquals(arguments.length, ex.getArguments().length);
for (int i = 0; i < arguments.length; ++i) {
assertEquals(arguments[i], ex.getArguments()[i]);
@@ -86,7 +87,7 @@ public class FunctionEvaluationException
Exception cause = new Exception(inMsg);
FunctionEvaluationException ex = new FunctionEvaluationException(cause, 0.0, pattern, arguments);
assertEquals(cause, ex.getCause());
- assertEquals(pattern, ex.getLocalizablePattern());
+ assertEquals(pattern, ex.getGeneralPattern());
assertEquals(arguments.length, ex.getArguments().length);
for (int i = 0; i < arguments.length; ++i) {
assertEquals(arguments[i], ex.getArguments()[i]);
@@ -103,7 +104,7 @@ public class FunctionEvaluationException
FunctionEvaluationException ex =
new FunctionEvaluationException(cause, new double[] { 0, 1, 2 }, pattern, arguments);
assertEquals(cause, ex.getCause());
- assertEquals(pattern, ex.getLocalizablePattern());
+ assertEquals(pattern, ex.getGeneralPattern());
assertEquals(arguments.length, ex.getArguments().length);
for (int i = 0; i < arguments.length; ++i) {
assertEquals(arguments[i], ex.getArguments()[i]);
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/BinaryFunctionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/BinaryFunctionTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/BinaryFunctionTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/BinaryFunctionTest.java Sat Nov 20 20:57:37 2010
@@ -16,7 +16,7 @@
*/
package org.apache.commons.math.analysis;
-import org.apache.commons.math.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/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/ComposableFunctionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/ComposableFunctionTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/ComposableFunctionTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/ComposableFunctionTest.java Sat Nov 20 20:57:37 2010
@@ -16,7 +16,7 @@
*/
package org.apache.commons.math.analysis;
-import org.apache.commons.math.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/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/Expm1Function.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/Expm1Function.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/Expm1Function.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/Expm1Function.java Sat Nov 20 20:57:37 2010
@@ -16,24 +16,22 @@
*/
package org.apache.commons.math.analysis;
-import org.apache.commons.math.FunctionEvaluationException;
import org.apache.commons.math.util.FastMath;
/**
- * Auxillary class for testing purposes.
+ * Auxiliary class for testing purposes.
*
* @version $Revision$ $Date$
*/
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/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/MonitoredFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/MonitoredFunction.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/MonitoredFunction.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/MonitoredFunction.java Sat Nov 20 20:57:37 2010
@@ -16,7 +16,7 @@
*/
package org.apache.commons.math.analysis;
-import org.apache.commons.math.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);
}
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/QuinticFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/QuinticFunction.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/QuinticFunction.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/QuinticFunction.java Sat Nov 20 20:57:37 2010
@@ -16,8 +16,6 @@
*/
package org.apache.commons.math.analysis;
-import org.apache.commons.math.FunctionEvaluationException;
-
/**
* Auxiliary class for testing solvers.
*
@@ -28,13 +26,13 @@ public class QuinticFunction implements
/* Evaluate quintic.
* @see org.apache.commons.math.UnivariateRealFunction#value(double)
*/
- public double value(double x) throws FunctionEvaluationException {
+ public double value(double x) {
return (x-1)*(x-0.5)*x*(x+0.5)*(x+1);
}
public UnivariateRealFunction derivative() {
return new UnivariateRealFunction() {
- public double value(double x) throws FunctionEvaluationException {
+ public double value(double x) {
return (5*x*x-3.75)*x*x+0.25;
}
};
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/SinFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/SinFunction.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/SinFunction.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/SinFunction.java Sat Nov 20 20:57:37 2010
@@ -16,7 +16,6 @@
*/
package org.apache.commons.math.analysis;
-import org.apache.commons.math.FunctionEvaluationException;
import org.apache.commons.math.util.FastMath;
/**
@@ -34,7 +33,7 @@ public class SinFunction implements Diff
/* Evaluate sinus fuction.
* @see org.apache.commons.math.UnivariateRealFunction#value(double)
*/
- public double value(double x) throws FunctionEvaluationException {
+ public double value(double x) {
return FastMath.sin(x);
}
@@ -42,7 +41,7 @@ public class SinFunction implements Diff
*/
public UnivariateRealFunction derivative() {
return new UnivariateRealFunction() {
- public double value(double x) throws FunctionEvaluationException {
+ public double value(double x) {
return FastMath.cos(x);
}
};
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/SumSincFunction.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/SumSincFunction.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/SumSincFunction.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/SumSincFunction.java Sat Nov 20 20:57:37 2010
@@ -16,7 +16,7 @@
*/
package org.apache.commons.math.analysis;
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.exception.MathUserException;
/**
* Auxiliary class for testing optimizers.
@@ -43,7 +43,7 @@ public class SumSincFunction implements
* @param point Argument.
* @return the value of this function at point {@code x}.
*/
- public double value(double[] point) throws FunctionEvaluationException {
+ public double value(double[] point) throws MathUserException {
double sum = 0;
for (int i = 0, max = point.length; i < max; i++) {
final double x = point[i];
@@ -58,7 +58,7 @@ public class SumSincFunction implements
*/
public MultivariateRealFunction partialDerivative(final int k) {
return new MultivariateRealFunction() {
- public double value(double[] point) throws FunctionEvaluationException {
+ public double value(double[] point) throws MathUserException {
return sincDeriv.value(point[k]);
}
};
@@ -70,7 +70,7 @@ public class SumSincFunction implements
public MultivariateVectorialFunction gradient() {
return new MultivariateVectorialFunction() {
public double[] value(double[] point)
- throws FunctionEvaluationException {
+ throws MathUserException {
final int n = point.length;
final double[] r = new double[n];
for (int i = 0; i < n; i++) {
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegratorTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegratorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/integration/LegendreGaussIntegratorTest.java Sat Nov 20 20:57:37 2010
@@ -19,12 +19,12 @@ package org.apache.commons.math.analysis
import java.util.Random;
import org.apache.commons.math.ConvergenceException;
-import org.apache.commons.math.FunctionEvaluationException;
import org.apache.commons.math.MathException;
import org.apache.commons.math.analysis.QuinticFunction;
import org.apache.commons.math.analysis.SinFunction;
import org.apache.commons.math.analysis.UnivariateRealFunction;
import org.apache.commons.math.analysis.polynomials.PolynomialFunction;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.util.FastMath;
import junit.framework.*;
@@ -77,7 +77,7 @@ extends TestCase {
}
public void testExactIntegration()
- throws ConvergenceException, FunctionEvaluationException {
+ throws ConvergenceException, MathUserException {
Random random = new Random(86343623467878363l);
for (int n = 2; n < 6; ++n) {
LegendreGaussIntegrator integrator =
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/interpolation/NevilleInterpolatorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/interpolation/NevilleInterpolatorTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/interpolation/NevilleInterpolatorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/interpolation/NevilleInterpolatorTest.java Sat Nov 20 20:57:37 2010
@@ -20,6 +20,7 @@ import org.apache.commons.math.MathExcep
import org.apache.commons.math.analysis.Expm1Function;
import org.apache.commons.math.analysis.SinFunction;
import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.util.FastMath;
import junit.framework.TestCase;
@@ -118,8 +119,8 @@ public final class NevilleInterpolatorTe
double y[] = { 0.0, 4.0, 4.0, 2.5 };
UnivariateRealFunction p = interpolator.interpolate(x, y);
p.value(0.0);
- fail("Expecting MathException - bad abscissas array");
- } catch (MathException ex) {
+ fail("Expecting MathUserException - bad abscissas array");
+ } catch (MathUserException ex) {
// expected
}
}
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunctionTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunctionTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunctionTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/analysis/polynomials/PolynomialSplineFunctionTest.java Sat Nov 20 20:57:37 2010
@@ -19,8 +19,9 @@ package org.apache.commons.math.analysis
import java.util.Arrays;
import junit.framework.TestCase;
-import org.apache.commons.math.FunctionEvaluationException;
+import org.apache.commons.math.ArgumentOutsideDomainException;
import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.exception.MathUserException;
/**
* Tests the PolynomialSplineFunction implementation.
@@ -116,15 +117,15 @@ public class PolynomialSplineFunctionTes
try { //outside of domain -- under min
x = spline.value(-1.5);
- fail("Expecting IllegalArgumentException");
- } catch (FunctionEvaluationException ex) {
+ fail("Expecting ArgumentOutsideDomainException");
+ } catch (ArgumentOutsideDomainException ex) {
// expected
}
try { //outside of domain -- over max
x = spline.value(2.5);
- fail("Expecting IllegalArgumentException");
- } catch (FunctionEvaluationException ex) {
+ fail("Expecting ArgumentOutsideDomainException");
+ } catch (ArgumentOutsideDomainException ex) {
// expected
}
}
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/Array2DRowRealMatrixTest.java Sat Nov 20 20:57:37 2010
@@ -19,6 +19,7 @@ package org.apache.commons.math.linear;
import junit.framework.TestCase;
import org.apache.commons.math.TestUtils;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.util.FastMath;
/**
@@ -839,7 +840,7 @@ public final class Array2DRowRealMatrixT
}
- public void testWalk() {
+ public void testWalk() throws MathUserException {
int rows = 150;
int columns = 75;
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/ArrayRealVectorTest.java Sat Nov 20 20:57:37 2010
@@ -21,9 +21,9 @@ import java.util.Iterator;
import junit.framework.TestCase;
-import org.apache.commons.math.FunctionEvaluationException;
import org.apache.commons.math.TestUtils;
import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.util.FastMath;
/**
@@ -62,15 +62,15 @@ public class ArrayRealVectorTest extends
data = d.clone();
}
- private UnsupportedOperationException unsupported() {
- return new UnsupportedOperationException("Not supported, unneeded for test purposes");
+ private MathUserException unsupported() {
+ return new MathUserException(new UnsupportedOperationException("Not supported, unneeded for test purposes"));
}
- public RealVector map(UnivariateRealFunction function) throws FunctionEvaluationException {
+ public RealVector map(UnivariateRealFunction function) throws MathUserException {
throw unsupported();
}
- public RealVector mapToSelf(UnivariateRealFunction function) throws FunctionEvaluationException {
+ public RealVector mapToSelf(UnivariateRealFunction function) throws MathUserException {
throw unsupported();
}
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/BlockFieldMatrixTest.java Sat Nov 20 20:57:37 2010
@@ -22,6 +22,7 @@ import java.util.Random;
import junit.framework.TestCase;
import org.apache.commons.math.TestUtils;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.fraction.Fraction;
import org.apache.commons.math.fraction.FractionField;
@@ -1150,7 +1151,7 @@ public final class BlockFieldMatrixTest
}
- public void testWalk() {
+ public void testWalk() throws MathUserException {
int rows = 150;
int columns = 75;
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/BlockRealMatrixTest.java Sat Nov 20 20:57:37 2010
@@ -22,6 +22,7 @@ import java.util.Random;
import junit.framework.TestCase;
import org.apache.commons.math.TestUtils;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.util.FastMath;
/**
@@ -1062,7 +1063,7 @@ public final class BlockRealMatrixTest e
}
- public void testWalk() {
+ public void testWalk() throws MathUserException {
int rows = 150;
int columns = 75;
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/FieldMatrixImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/FieldMatrixImplTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/FieldMatrixImplTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/FieldMatrixImplTest.java Sat Nov 20 20:57:37 2010
@@ -19,6 +19,7 @@ package org.apache.commons.math.linear;
import junit.framework.TestCase;
import org.apache.commons.math.TestUtils;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.fraction.Fraction;
import org.apache.commons.math.fraction.FractionField;
@@ -835,7 +836,7 @@ public final class FieldMatrixImplTest e
}
- public void testWalk() {
+ public void testWalk() throws MathUserException {
int rows = 150;
int columns = 75;
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/QRDecompositionImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/QRDecompositionImplTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/QRDecompositionImplTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/QRDecompositionImplTest.java Sat Nov 20 20:57:37 2010
@@ -19,6 +19,8 @@ package org.apache.commons.math.linear;
import java.util.Random;
+import org.apache.commons.math.exception.MathUserException;
+
import junit.framework.TestCase;
public class QRDecompositionImplTest extends TestCase {
@@ -51,8 +53,9 @@ public class QRDecompositionImplTest ext
super(name);
}
- /** test dimensions */
- public void testDimensions() {
+ /** test dimensions
+ * @throws MathUserException */
+ public void testDimensions() throws MathUserException {
checkDimension(MatrixUtils.createRealMatrix(testData3x3NonSingular));
checkDimension(MatrixUtils.createRealMatrix(testData4x3));
@@ -77,8 +80,9 @@ public class QRDecompositionImplTest ext
assertEquals(columns, qr.getR().getColumnDimension());
}
- /** test A = QR */
- public void testAEqualQR() {
+ /** test A = QR
+ * @throws MathUserException */
+ public void testAEqualQR() throws MathUserException {
checkAEqualQR(MatrixUtils.createRealMatrix(testData3x3NonSingular));
checkAEqualQR(MatrixUtils.createRealMatrix(testData3x3Singular));
@@ -102,8 +106,9 @@ public class QRDecompositionImplTest ext
assertEquals(0, norm, normTolerance);
}
- /** test the orthogonality of Q */
- public void testQOrthogonal() {
+ /** test the orthogonality of Q
+ * @throws MathUserException */
+ public void testQOrthogonal() throws MathUserException {
checkQOrthogonal(MatrixUtils.createRealMatrix(testData3x3NonSingular));
checkQOrthogonal(MatrixUtils.createRealMatrix(testData3x3Singular));
@@ -129,7 +134,7 @@ public class QRDecompositionImplTest ext
}
/** test that R is upper triangular */
- public void testRUpperTriangular() {
+ public void testRUpperTriangular() throws MathUserException {
RealMatrix matrix = MatrixUtils.createRealMatrix(testData3x3NonSingular);
checkUpperTriangular(new QRDecompositionImpl(matrix).getR());
@@ -153,7 +158,7 @@ public class QRDecompositionImplTest ext
}
- private void checkUpperTriangular(RealMatrix m) {
+ private void checkUpperTriangular(RealMatrix m) throws MathUserException {
m.walkInOptimizedOrder(new DefaultRealMatrixPreservingVisitor() {
@Override
public void visit(int row, int column, double value) {
@@ -164,8 +169,9 @@ public class QRDecompositionImplTest ext
});
}
- /** test that H is trapezoidal */
- public void testHTrapezoidal() {
+ /** test that H is trapezoidal
+ * @throws MathUserException */
+ public void testHTrapezoidal() throws MathUserException {
RealMatrix matrix = MatrixUtils.createRealMatrix(testData3x3NonSingular);
checkTrapezoidal(new QRDecompositionImpl(matrix).getH());
@@ -189,7 +195,7 @@ public class QRDecompositionImplTest ext
}
- private void checkTrapezoidal(RealMatrix m) {
+ private void checkTrapezoidal(RealMatrix m) throws MathUserException {
m.walkInOptimizedOrder(new DefaultRealMatrixPreservingVisitor() {
@Override
public void visit(int row, int column, double value) {
@@ -236,12 +242,11 @@ public class QRDecompositionImplTest ext
}
- private RealMatrix createTestMatrix(final Random r, final int rows, final int columns) {
+ private RealMatrix createTestMatrix(final Random r, final int rows, final int columns) throws MathUserException {
RealMatrix m = MatrixUtils.createRealMatrix(rows, columns);
m.walkInOptimizedOrder(new DefaultRealMatrixChangingVisitor(){
@Override
- public double visit(int row, int column, double value)
- throws MatrixVisitorException {
+ public double visit(int row, int column, double value) {
return 2.0 * r.nextDouble() - 1.0;
}
});
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/QRSolverTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/QRSolverTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/QRSolverTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/QRSolverTest.java Sat Nov 20 20:57:37 2010
@@ -19,6 +19,8 @@ package org.apache.commons.math.linear;
import java.util.Random;
+import org.apache.commons.math.exception.MathUserException;
+
import junit.framework.TestCase;
public class QRSolverTest extends TestCase {
@@ -158,7 +160,7 @@ public class QRSolverTest extends TestCa
}
- public void testOverdetermined() {
+ public void testOverdetermined() throws MathUserException {
final Random r = new Random(5559252868205245l);
int p = (7 * BlockRealMatrix.BLOCK_SIZE) / 4;
int q = (5 * BlockRealMatrix.BLOCK_SIZE) / 4;
@@ -181,7 +183,7 @@ public class QRSolverTest extends TestCa
}
- public void testUnderdetermined() {
+ public void testUnderdetermined() throws MathUserException {
final Random r = new Random(42185006424567123l);
int p = (5 * BlockRealMatrix.BLOCK_SIZE) / 4;
int q = (7 * BlockRealMatrix.BLOCK_SIZE) / 4;
@@ -198,12 +200,11 @@ public class QRSolverTest extends TestCa
}
- private RealMatrix createTestMatrix(final Random r, final int rows, final int columns) {
+ private RealMatrix createTestMatrix(final Random r, final int rows, final int columns) throws MathUserException {
RealMatrix m = MatrixUtils.createRealMatrix(rows, columns);
m.walkInOptimizedOrder(new DefaultRealMatrixChangingVisitor(){
@Override
- public double visit(int row, int column, double value)
- throws MatrixVisitorException {
+ public double visit(int row, int column, double value) {
return 2.0 * r.nextDouble() - 1.0;
}
});
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/RealMatrixImplTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/RealMatrixImplTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/RealMatrixImplTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/RealMatrixImplTest.java Sat Nov 20 20:57:37 2010
@@ -19,6 +19,7 @@ package org.apache.commons.math.linear;
import junit.framework.TestCase;
import org.apache.commons.math.TestUtils;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.util.FastMath;
/**
@@ -839,7 +840,7 @@ public final class RealMatrixImplTest ex
}
- public void testWalk() {
+ public void testWalk() throws MatrixIndexException, MathUserException {
int rows = 150;
int columns = 75;
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/SparseRealVectorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/SparseRealVectorTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/SparseRealVectorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/linear/SparseRealVectorTest.java Sat Nov 20 20:57:37 2010
@@ -21,9 +21,9 @@ import java.util.Iterator;
import junit.framework.TestCase;
-import org.apache.commons.math.FunctionEvaluationException;
import org.apache.commons.math.TestUtils;
import org.apache.commons.math.analysis.UnivariateRealFunction;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.util.FastMath;
/**
@@ -60,17 +60,17 @@ public class SparseRealVectorTest extend
data = d.clone();
}
- private UnsupportedOperationException unsupported() {
- return new UnsupportedOperationException("Not supported, unneeded for test purposes");
+ private MathUserException unsupported() {
+ return new MathUserException(new UnsupportedOperationException("Not supported, unneeded for test purposes"));
}
@Override
- public RealVector map(UnivariateRealFunction function) throws FunctionEvaluationException {
+ public RealVector map(UnivariateRealFunction function) throws MathUserException {
throw unsupported();
}
@Override
- public RealVector mapToSelf(UnivariateRealFunction function) throws FunctionEvaluationException {
+ public RealVector mapToSelf(UnivariateRealFunction function) throws MathUserException {
throw unsupported();
}
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/ContinuousOutputModelTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/ContinuousOutputModelTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/ContinuousOutputModelTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/ContinuousOutputModelTest.java Sat Nov 20 20:57:37 2010
@@ -20,8 +20,8 @@ package org.apache.commons.math.ode;
import junit.framework.*;
import java.util.Random;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.ode.ContinuousOutputModel;
-import org.apache.commons.math.ode.DerivativeException;
import org.apache.commons.math.ode.FirstOrderIntegrator;
import org.apache.commons.math.ode.IntegratorException;
import org.apache.commons.math.ode.nonstiff.DormandPrince54Integrator;
@@ -40,7 +40,7 @@ public class ContinuousOutputModelTest
}
public void testBoundaries()
- throws DerivativeException, IntegratorException {
+ throws MathUserException, IntegratorException {
integ.addStepHandler(new ContinuousOutputModel());
integ.integrate(pb,
pb.getInitialTime(), pb.getInitialState(),
@@ -52,7 +52,7 @@ public class ContinuousOutputModelTest
}
public void testRandomAccess()
- throws DerivativeException, IntegratorException {
+ throws MathUserException, IntegratorException {
ContinuousOutputModel cm = new ContinuousOutputModel();
integ.addStepHandler(cm);
@@ -81,14 +81,14 @@ public class ContinuousOutputModelTest
}
public void testModelsMerging()
- throws DerivativeException, IntegratorException {
+ throws MathUserException, IntegratorException {
// theoretical solution: y[0] = cos(t), y[1] = sin(t)
FirstOrderDifferentialEquations problem =
new FirstOrderDifferentialEquations() {
private static final long serialVersionUID = 2472449657345878299L;
public void computeDerivatives(double t, double[] y, double[] dot)
- throws DerivativeException {
+ throws MathUserException {
dot[0] = -y[1];
dot[1] = y[0];
}
@@ -133,7 +133,7 @@ public class ContinuousOutputModelTest
}
public void testErrorConditions()
- throws DerivativeException {
+ throws MathUserException {
ContinuousOutputModel cm = new ContinuousOutputModel();
cm.handleStep(buildInterpolator(0, new double[] { 0.0, 1.0, -2.0 }, 1), true);
@@ -154,7 +154,7 @@ public class ContinuousOutputModelTest
private boolean checkAppendError(ContinuousOutputModel cm,
double t0, double[] y0, double t1)
- throws DerivativeException {
+ throws MathUserException {
try {
ContinuousOutputModel otherCm = new ContinuousOutputModel();
otherCm.handleStep(buildInterpolator(t0, y0, t1), true);
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/FirstOrderConverterTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/FirstOrderConverterTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/FirstOrderConverterTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/FirstOrderConverterTest.java Sat Nov 20 20:57:37 2010
@@ -17,7 +17,7 @@
package org.apache.commons.math.ode;
-import org.apache.commons.math.ode.DerivativeException;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.ode.FirstOrderConverter;
import org.apache.commons.math.ode.IntegratorException;
import org.apache.commons.math.ode.SecondOrderDifferentialEquations;
@@ -42,7 +42,7 @@ public class FirstOrderConverterTest
}
public void testDecreasingSteps()
- throws DerivativeException, IntegratorException {
+ throws MathUserException, IntegratorException {
double previousError = Double.NaN;
for (int i = 0; i < 10; ++i) {
@@ -59,14 +59,14 @@ public class FirstOrderConverterTest
}
public void testSmallStep()
- throws DerivativeException, IntegratorException {
+ throws MathUserException, IntegratorException {
double error = integrateWithSpecifiedStep(4.0, 0.0, 1.0, 1.0e-4)
- FastMath.sin(4.0);
assertTrue(FastMath.abs(error) < 1.0e-10);
}
public void testBigStep()
- throws DerivativeException, IntegratorException {
+ throws MathUserException, IntegratorException {
double error = integrateWithSpecifiedStep(4.0, 0.0, 1.0, 0.5)
- FastMath.sin(4.0);
assertTrue(FastMath.abs(error) > 0.1);
@@ -100,7 +100,7 @@ public class FirstOrderConverterTest
private double integrateWithSpecifiedStep(double omega,
double t0, double t,
double step)
- throws DerivativeException, IntegratorException {
+ throws MathUserException, IntegratorException {
double[] y0 = new double[2];
y0[0] = FastMath.sin(omega * t0);
y0[1] = omega * FastMath.cos(omega * t0);
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/TestProblemHandler.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/TestProblemHandler.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/TestProblemHandler.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/TestProblemHandler.java Sat Nov 20 20:57:37 2010
@@ -17,7 +17,7 @@
package org.apache.commons.math.ode;
-import org.apache.commons.math.ode.DerivativeException;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.ode.ODEIntegrator;
import org.apache.commons.math.ode.sampling.StepHandler;
import org.apache.commons.math.ode.sampling.StepInterpolator;
@@ -73,7 +73,7 @@ public class TestProblemHandler
public void handleStep(StepInterpolator interpolator,
boolean isLast)
- throws DerivativeException {
+ throws MathUserException {
double start = integrator.getCurrentStepStart();
if (FastMath.abs((start - problem.getInitialTime()) / integrator.getCurrentSignedStepsize()) > 0.001) {
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/events/EventStateTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/events/EventStateTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/events/EventStateTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/events/EventStateTest.java Sat Nov 20 20:57:37 2010
@@ -20,7 +20,7 @@ package org.apache.commons.math.ode.even
import junit.framework.Assert;
import org.apache.commons.math.ConvergenceException;
-import org.apache.commons.math.ode.DerivativeException;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.ode.sampling.AbstractStepInterpolator;
import org.apache.commons.math.ode.sampling.DummyStepInterpolator;
import org.junit.Test;
@@ -30,7 +30,7 @@ public class EventStateTest {
// JIRA: MATH-322
@Test
public void closeEvents()
- throws EventException, ConvergenceException, DerivativeException {
+ throws EventException, ConvergenceException, MathUserException {
final double r1 = 90.0;
final double r2 = 135.0;
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/jacobians/FirstOrderIntegratorWithJacobiansTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/jacobians/FirstOrderIntegratorWithJacobiansTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/jacobians/FirstOrderIntegratorWithJacobiansTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/jacobians/FirstOrderIntegratorWithJacobiansTest.java Sat Nov 20 20:57:37 2010
@@ -17,7 +17,7 @@
package org.apache.commons.math.ode.jacobians;
-import org.apache.commons.math.ode.DerivativeException;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.ode.FirstOrderIntegrator;
import org.apache.commons.math.ode.IntegratorException;
import org.apache.commons.math.ode.nonstiff.DormandPrince54Integrator;
@@ -30,7 +30,7 @@ public class FirstOrderIntegratorWithJac
@Test
public void testLowAccuracyExternalDifferentiation()
- throws IntegratorException, DerivativeException {
+ throws IntegratorException, MathUserException {
// this test does not really test FirstOrderIntegratorWithJacobians,
// it only shows that WITHOUT this class, attempting to recover
// the jacobians from external differentiation on simple integration
@@ -63,7 +63,7 @@ public class FirstOrderIntegratorWithJac
@Test
public void testHighAccuracyExternalDifferentiation()
- throws IntegratorException, DerivativeException {
+ throws IntegratorException, MathUserException {
FirstOrderIntegrator integ =
new DormandPrince54Integrator(1.0e-8, 100.0, new double[] { 1.0e-10, 1.0e-10 }, new double[] { 1.0e-10, 1.0e-10 });
double hP = 1.0e-12;
@@ -91,7 +91,7 @@ public class FirstOrderIntegratorWithJac
@Test
public void testInternalDifferentiation()
- throws IntegratorException, DerivativeException {
+ throws IntegratorException, MathUserException {
FirstOrderIntegrator integ =
new DormandPrince54Integrator(1.0e-8, 100.0, new double[] { 1.0e-4, 1.0e-4 }, new double[] { 1.0e-4, 1.0e-4 });
double hP = 1.0e-12;
@@ -124,7 +124,7 @@ public class FirstOrderIntegratorWithJac
@Test
public void testAnalyticalDifferentiation()
- throws IntegratorException, DerivativeException {
+ throws IntegratorException, MathUserException {
FirstOrderIntegrator integ =
new DormandPrince54Integrator(1.0e-8, 100.0, new double[] { 1.0e-4, 1.0e-4 }, new double[] { 1.0e-4, 1.0e-4 });
SummaryStatistics residualsP0 = new SummaryStatistics();
@@ -153,7 +153,7 @@ public class FirstOrderIntegratorWithJac
}
@Test
- public void testFinalResult() throws IntegratorException, DerivativeException {
+ public void testFinalResult() throws IntegratorException, MathUserException {
FirstOrderIntegrator integ =
new DormandPrince54Integrator(1.0e-8, 100.0, new double[] { 1.0e-10, 1.0e-10 }, new double[] { 1.0e-10, 1.0e-10 });
double[] y = new double[] { 0.0, 1.0 };
@@ -180,7 +180,7 @@ public class FirstOrderIntegratorWithJac
}
@Test
- public void testStepHandlerResult() throws IntegratorException, DerivativeException {
+ public void testStepHandlerResult() throws IntegratorException, MathUserException {
FirstOrderIntegrator integ =
new DormandPrince54Integrator(1.0e-8, 100.0, new double[] { 1.0e-10, 1.0e-10 }, new double[] { 1.0e-10, 1.0e-10 });
double[] y = new double[] { 0.0, 1.0 };
@@ -200,7 +200,7 @@ public class FirstOrderIntegratorWithJac
}
public void handleStep(StepInterpolatorWithJacobians interpolator, boolean isLast)
- throws DerivativeException {
+ throws MathUserException {
double t = interpolator.getCurrentTime();
double[] y = interpolator.getInterpolatedY();
double[][] dydy0 = interpolator.getInterpolatedDyDy0();
@@ -244,7 +244,7 @@ public class FirstOrderIntegratorWithJac
}
@Test
- public void testEventHandler() throws IntegratorException, DerivativeException {
+ public void testEventHandler() throws IntegratorException, MathUserException {
FirstOrderIntegrator integ =
new DormandPrince54Integrator(1.0e-8, 100.0, new double[] { 1.0e-10, 1.0e-10 }, new double[] { 1.0e-10, 1.0e-10 });
double[] y = new double[] { 0.0, 1.0 };
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegratorTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegratorTest.java?rev=1037327&r1=1037326&r2=1037327&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegratorTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/ode/nonstiff/AdamsBashforthIntegratorTest.java Sat Nov 20 20:57:37 2010
@@ -20,7 +20,7 @@ package org.apache.commons.math.ode.nons
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import org.apache.commons.math.ode.DerivativeException;
+import org.apache.commons.math.exception.MathUserException;
import org.apache.commons.math.ode.FirstOrderIntegrator;
import org.apache.commons.math.ode.IntegratorException;
import org.apache.commons.math.ode.TestProblem1;
@@ -33,7 +33,7 @@ import org.junit.Test;
public class AdamsBashforthIntegratorTest {
@Test(expected=IntegratorException.class)
- public void dimensionCheck() throws DerivativeException, IntegratorException {
+ public void dimensionCheck() throws MathUserException, IntegratorException {
TestProblem1 pb = new TestProblem1();
FirstOrderIntegrator integ =
new AdamsBashforthIntegrator(2, 0.0, 1.0, 1.0e-10, 1.0e-10);
@@ -43,7 +43,7 @@ public class AdamsBashforthIntegratorTes
}
@Test(expected=IntegratorException.class)
- public void testMinStep() throws DerivativeException, IntegratorException {
+ public void testMinStep() throws MathUserException, IntegratorException {
TestProblem1 pb = new TestProblem1();
double minStep = 0.1 * (pb.getFinalTime() - pb.getInitialTime());
@@ -64,7 +64,7 @@ public class AdamsBashforthIntegratorTes
@Test
public void testIncreasingTolerance()
- throws DerivativeException, IntegratorException {
+ throws MathUserException, IntegratorException {
int previousCalls = Integer.MAX_VALUE;
for (int i = -12; i < -5; ++i) {
@@ -99,8 +99,8 @@ public class AdamsBashforthIntegratorTes
}
- @Test(expected = DerivativeException.class)
- public void exceedMaxEvaluations() throws DerivativeException, IntegratorException {
+ @Test(expected = MathUserException.class)
+ public void exceedMaxEvaluations() throws MathUserException, IntegratorException {
TestProblem1 pb = new TestProblem1();
double range = pb.getFinalTime() - pb.getInitialTime();
@@ -116,7 +116,7 @@ public class AdamsBashforthIntegratorTes
}
@Test
- public void backward() throws DerivativeException, IntegratorException {
+ public void backward() throws MathUserException, IntegratorException {
TestProblem5 pb = new TestProblem5();
double range = FastMath.abs(pb.getFinalTime() - pb.getInitialTime());
@@ -134,7 +134,7 @@ public class AdamsBashforthIntegratorTes
}
@Test
- public void polynomial() throws DerivativeException, IntegratorException {
+ public void polynomial() throws MathUserException, IntegratorException {
TestProblem6 pb = new TestProblem6();
double range = FastMath.abs(pb.getFinalTime() - pb.getInitialTime());