You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tn...@apache.org on 2015/02/25 23:02:44 UTC

[2/4] [math] Remove deprecated interpolation and fitter classes.

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0a5cd113/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java
deleted file mode 100644
index 945e9d5..0000000
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatingFunctionTest.java
+++ /dev/null
@@ -1,545 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.analysis.interpolation;
-
-import org.apache.commons.math4.analysis.TrivariateFunction;
-import org.apache.commons.math4.analysis.interpolation.TricubicSplineInterpolatingFunction;
-import org.apache.commons.math4.exception.DimensionMismatchException;
-import org.apache.commons.math4.exception.MathIllegalArgumentException;
-import org.apache.commons.math4.util.FastMath;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Test case for the bicubic function.
- * 
- */
-public final class TricubicSplineInterpolatingFunctionTest {
-    /**
-     * Test preconditions.
-     */
-    @Test
-    public void testPreconditions() {
-        double[] xval = new double[] {3, 4, 5, 6.5};
-        double[] yval = new double[] {-4, -3, -1, 2.5};
-        double[] zval = new double[] {-12, -8, -5.5, -3, 0, 2.5};
-        double[][][] fval = new double[xval.length][yval.length][zval.length];
-
-        @SuppressWarnings("unused")
-        TrivariateFunction tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                                             fval, fval, fval, fval,
-                                                                             fval, fval, fval, fval);
-        
-        double[] wxval = new double[] {3, 2, 5, 6.5};
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(wxval, yval, zval,
-                                                          fval, fval, fval, fval,
-                                                          fval, fval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (MathIllegalArgumentException e) {
-            // Expected
-        }
-        double[] wyval = new double[] {-4, -1, -1, 2.5};
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, wyval, zval,
-                                                          fval, fval, fval, fval,
-                                                          fval, fval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (MathIllegalArgumentException e) {
-            // Expected
-        }
-        double[] wzval = new double[] {-12, -8, -9, -3, 0, 2.5};
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, wzval,
-                                                          fval, fval, fval, fval,
-                                                          fval, fval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (MathIllegalArgumentException e) {
-            // Expected
-        }
-        double[][][] wfval = new double[xval.length - 1][yval.length - 1][zval.length];
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          wfval, fval, fval, fval,
-                                                          fval, fval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, wfval, fval, fval,
-                                                          fval, fval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, fval, wfval, fval,
-                                                          fval, fval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, fval, fval, wfval,
-                                                          fval, fval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, fval, fval, fval,
-                                                          wfval, fval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, fval, fval, fval,
-                                                          fval, wfval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, fval, fval, fval,
-                                                          fval, fval, wfval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, fval, fval, fval,
-                                                          fval, fval, fval, wfval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        wfval = new double[xval.length][yval.length - 1][zval.length];
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          wfval, fval, fval, fval,
-                                                          fval, fval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, wfval, fval, fval,
-                                                          fval, fval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, fval, wfval, fval,
-                                                          fval, fval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, fval, fval, wfval,
-                                                          fval, fval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, fval, fval, fval,
-                                                          wfval, fval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, fval, fval, fval,
-                                                          fval, wfval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, fval, fval, fval,
-                                                          fval, fval, wfval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, fval, fval, fval,
-                                                          fval, fval, fval, wfval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        wfval = new double[xval.length][yval.length][zval.length - 1];
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          wfval, fval, fval, fval,
-                                                          fval, fval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, wfval, fval, fval,
-                                                          fval, fval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, fval, wfval, fval,
-                                                          fval, fval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, fval, fval, wfval,
-                                                          fval, fval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, fval, fval, fval,
-                                                          wfval, fval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, fval, fval, fval,
-                                                          fval, wfval, fval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, fval, fval, fval,
-                                                          fval, fval, wfval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        try {
-            tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                          fval, fval, fval, fval,
-                                                          fval, fval, fval, wfval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-    }
-
-    /**
-     * Test for a plane.
-     * <p>
-     *  f(x, y, z) = 2 x - 3 y - 4 z + 5
-     * </p>
-     */
-    @Test
-    public void testPlane() {
-        double[] xval = new double[] {3, 4, 5, 6.5};
-        double[] yval = new double[] {-4, -3, -1, 2, 2.5};
-        double[] zval = new double[] {-12, -8, -5.5, -3, 0, 2.5};
-
-        // Function values
-        TrivariateFunction f = new TrivariateFunction() {
-                public double value(double x, double y, double z) {
-                    return 2 * x - 3 * y - 4 * z + 5;
-                }
-            };
-
-        double[][][] fval = new double[xval.length][yval.length][zval.length];
-
-        for (int i = 0; i < xval.length; i++) {
-            for (int j = 0; j < yval.length; j++) {
-                for (int k = 0; k < zval.length; k++) {
-                    fval[i][j][k] = f.value(xval[i], yval[j], zval[k]);
-                }
-            }
-        }
-        // Partial derivatives with respect to x
-        double[][][] dFdX = new double[xval.length][yval.length][zval.length];
-        for (int i = 0; i < xval.length; i++) {
-            for (int j = 0; j < yval.length; j++) {
-                for (int k = 0; k < zval.length; k++) {
-                    dFdX[i][j][k] = 2;
-                }
-            }
-        }
-        // Partial derivatives with respect to y
-        double[][][] dFdY = new double[xval.length][yval.length][zval.length];
-        for (int i = 0; i < xval.length; i++) {
-            for (int j = 0; j < yval.length; j++) {
-                for (int k = 0; k < zval.length; k++) {
-                    dFdY[i][j][k] = -3;
-                }
-            }
-        }
-
-        // Partial derivatives with respect to z
-        double[][][] dFdZ = new double[xval.length][yval.length][zval.length];
-        for (int i = 0; i < xval.length; i++) {
-            for (int j = 0; j < yval.length; j++) {
-                for (int k = 0; k < zval.length; k++) {
-                    dFdZ[i][j][k] = -4;
-                }
-            }
-        }
-        // Partial cross-derivatives
-        double[][][] d2FdXdY = new double[xval.length][yval.length][zval.length];
-        double[][][] d2FdXdZ = new double[xval.length][yval.length][zval.length];
-        double[][][] d2FdYdZ = new double[xval.length][yval.length][zval.length];
-        double[][][] d3FdXdYdZ = new double[xval.length][yval.length][zval.length];
-        for (int i = 0; i < xval.length; i++) {
-            for (int j = 0; j < yval.length; j++) {
-                for (int k = 0; k < zval.length; k++) {
-                    d2FdXdY[i][j][k] = 0;
-                    d2FdXdZ[i][j][k] = 0;
-                    d2FdYdZ[i][j][k] = 0;
-                    d3FdXdYdZ[i][j][k] = 0;
-                }
-            }
-        }
-
-        TrivariateFunction tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                                             fval, dFdX, dFdY, dFdZ,
-                                                                             d2FdXdY, d2FdXdZ, d2FdYdZ,
-                                                                             d3FdXdYdZ);
-        double x, y, z;
-        double expected, result;
-
-        x = 4;
-        y = -3;
-        z = 0;
-        expected = f.value(x, y, z);
-        result = tcf.value(x, y, z);
-        Assert.assertEquals("On sample point",
-                            expected, result, 1e-15);
-
-        x = 4.5;
-        y = -1.5;
-        z = -4.25;
-        expected = f.value(x, y, z);
-        result = tcf.value(x, y, z);
-        Assert.assertEquals("Half-way between sample points (middle of the patch)",
-                            expected, result, 0.3);
-
-        x = 3.5;
-        y = -3.5;
-        z = -10;
-        expected = f.value(x, y, z);
-        result = tcf.value(x, y, z);
-        Assert.assertEquals("Half-way between sample points (border of the patch)",
-                            expected, result, 0.3);
-    }
-
-    /**
-     * Sine wave.
-     * <p>
-     *  f(x, y, z) = a cos [&omega; z - k<sub>y</sub> x - k<sub>y</sub> y]
-     * </p>
-     * with A = 0.2, &omega; = 0.5, k<sub>x</sub> = 2, k<sub>y</sub> = 1.
-     */
-    @Test
-    public void testWave() {
-        double[] xval = new double[] {3, 4, 5, 6.5};
-        double[] yval = new double[] {-4, -3, -1, 2, 2.5};
-        double[] zval = new double[] {-12, -8, -5.5, -3, 0, 4};
-        
-        final double a = 0.2;
-        final double omega = 0.5;
-        final double kx = 2;
-        final double ky = 1;
-        
-        // Function values
-        TrivariateFunction f = new TrivariateFunction() {
-                public double value(double x, double y, double z) {
-                    return a * FastMath.cos(omega * z - kx * x - ky * y);
-                }
-            };
-        
-        double[][][] fval = new double[xval.length][yval.length][zval.length];
-        for (int i = 0; i < xval.length; i++) {
-            for (int j = 0; j < yval.length; j++) {
-                for (int k = 0; k < zval.length; k++) {
-                    fval[i][j][k] = f.value(xval[i], yval[j], zval[k]);
-                }
-            }
-        }
-        
-        // Partial derivatives with respect to x
-        double[][][] dFdX = new double[xval.length][yval.length][zval.length];
-        TrivariateFunction dFdX_f = new TrivariateFunction() {
-                public double value(double x, double y, double z) {
-                    return a * FastMath.sin(omega * z - kx * x - ky * y) * kx;
-                }
-            };
-        for (int i = 0; i < xval.length; i++) {
-            for (int j = 0; j < yval.length; j++) {
-                for (int k = 0; k < zval.length; k++) {
-                    dFdX[i][j][k] = dFdX_f.value(xval[i], yval[j], zval[k]);
-                }
-            }
-        }
-            
-        // Partial derivatives with respect to y
-        double[][][] dFdY = new double[xval.length][yval.length][zval.length];
-        TrivariateFunction dFdY_f = new TrivariateFunction() {
-                public double value(double x, double y, double z) {
-                    return a * FastMath.sin(omega * z - kx * x - ky * y) * ky;
-                }
-            };
-        for (int i = 0; i < xval.length; i++) {
-            for (int j = 0; j < yval.length; j++) {
-                for (int k = 0; k < zval.length; k++) {
-                    dFdY[i][j][k] = dFdY_f.value(xval[i], yval[j], zval[k]);
-                }
-            }
-        }
-
-        // Partial derivatives with respect to z
-        double[][][] dFdZ = new double[xval.length][yval.length][zval.length];
-        TrivariateFunction dFdZ_f = new TrivariateFunction() {
-                public double value(double x, double y, double z) {
-                    return -a * FastMath.sin(omega * z - kx * x - ky * y) * omega;
-                }
-            };
-        for (int i = 0; i < xval.length; i++) {
-            for (int j = 0; j < yval.length; j++) {
-                for (int k = 0; k < zval.length; k++) {
-                    dFdZ[i][j][k] = dFdZ_f.value(xval[i], yval[j], zval[k]);
-                }
-            }
-        }
-
-        // Partial second derivatives w.r.t. (x, y)
-        double[][][] d2FdXdY = new double[xval.length][yval.length][zval.length];
-        TrivariateFunction d2FdXdY_f = new TrivariateFunction() {
-                public double value(double x, double y, double z) {
-                    return -a * FastMath.cos(omega * z - kx * x - ky * y) * kx * ky;
-                }
-            };
-        for (int i = 0; i < xval.length; i++) {
-            for (int j = 0; j < yval.length; j++) {
-                for (int k = 0; k < zval.length; k++) {
-                    d2FdXdY[i][j][k] = d2FdXdY_f.value(xval[i], yval[j], zval[k]);
-                }
-            }
-        }
-
-        // Partial second derivatives w.r.t. (x, z)
-        double[][][] d2FdXdZ = new double[xval.length][yval.length][zval.length];
-        TrivariateFunction d2FdXdZ_f = new TrivariateFunction() {
-                public double value(double x, double y, double z) {
-                    return a * FastMath.cos(omega * z - kx * x - ky * y) * kx * omega;
-                }
-            };
-        for (int i = 0; i < xval.length; i++) {
-            for (int j = 0; j < yval.length; j++) {
-                for (int k = 0; k < zval.length; k++) {
-                    d2FdXdZ[i][j][k] = d2FdXdZ_f.value(xval[i], yval[j], zval[k]);
-                }
-            }
-        }
-
-        // Partial second derivatives w.r.t. (y, z)
-        double[][][] d2FdYdZ = new double[xval.length][yval.length][zval.length];
-        TrivariateFunction d2FdYdZ_f = new TrivariateFunction() {
-                public double value(double x, double y, double z) {
-                    return a * FastMath.cos(omega * z - kx * x - ky * y) * ky * omega;
-                }
-            };
-        for (int i = 0; i < xval.length; i++) {
-            for (int j = 0; j < yval.length; j++) {
-                for (int k = 0; k < zval.length; k++) {
-                    d2FdYdZ[i][j][k] = d2FdYdZ_f.value(xval[i], yval[j], zval[k]);
-                }
-            }
-        }
-
-        // Partial third derivatives
-        double[][][] d3FdXdYdZ = new double[xval.length][yval.length][zval.length];
-        TrivariateFunction d3FdXdYdZ_f = new TrivariateFunction() {
-                public double value(double x, double y, double z) {
-                    return a * FastMath.sin(omega * z - kx * x - ky * y) * kx * ky * omega;
-                }
-            };
-        for (int i = 0; i < xval.length; i++) {
-            for (int j = 0; j < yval.length; j++) {
-                for (int k = 0; k < zval.length; k++) {
-                    d3FdXdYdZ[i][j][k] = d3FdXdYdZ_f.value(xval[i], yval[j], zval[k]);
-                }
-            }
-        }
-
-        TrivariateFunction tcf = new TricubicSplineInterpolatingFunction(xval, yval, zval,
-                                                                             fval, dFdX, dFdY, dFdZ,
-                                                                             d2FdXdY, d2FdXdZ, d2FdYdZ,
-                                                                             d3FdXdYdZ);
-        double x, y, z;
-        double expected, result;
-        
-        x = 4;
-        y = -3;
-        z = 0;
-        expected = f.value(x, y, z);
-        result = tcf.value(x, y, z);
-        Assert.assertEquals("On sample point",
-                            expected, result, 1e-14);
-
-        x = 4.5;
-        y = -1.5;
-        z = -4.25;
-        expected = f.value(x, y, z);
-        result = tcf.value(x, y, z);
-        Assert.assertEquals("Half-way between sample points (middle of the patch)",
-                            expected, result, 0.1);
-
-        x = 3.5;
-        y = -3.5;
-        z = -10;
-        expected = f.value(x, y, z);
-        result = tcf.value(x, y, z);
-        Assert.assertEquals("Half-way between sample points (border of the patch)",
-                            expected, result, 0.1);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0a5cd113/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatorTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatorTest.java b/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatorTest.java
deleted file mode 100644
index 83023d3..0000000
--- a/src/test/java/org/apache/commons/math4/analysis/interpolation/TricubicSplineInterpolatorTest.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.analysis.interpolation;
-
-import org.apache.commons.math4.analysis.TrivariateFunction;
-import org.apache.commons.math4.analysis.interpolation.TricubicSplineInterpolator;
-import org.apache.commons.math4.analysis.interpolation.TrivariateGridInterpolator;
-import org.apache.commons.math4.exception.DimensionMismatchException;
-import org.apache.commons.math4.exception.MathIllegalArgumentException;
-import org.apache.commons.math4.util.FastMath;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.Ignore;
-
-/**
- * Test case for the tricubic interpolator.
- * 
- */
-public final class TricubicSplineInterpolatorTest {
-    /**
-     * Test preconditions.
-     */
-    @Test
-    public void testPreconditions() {
-        double[] xval = new double[] {3, 4, 5, 6.5};
-        double[] yval = new double[] {-4, -3, -1, 2.5};
-        double[] zval = new double[] {-12, -8, -5.5, -3, 0, 2.5};
-        double[][][] fval = new double[xval.length][yval.length][zval.length];
-
-        TrivariateGridInterpolator interpolator = new TricubicSplineInterpolator();
-        
-        @SuppressWarnings("unused")
-        TrivariateFunction p = interpolator.interpolate(xval, yval, zval, fval);
-        
-        double[] wxval = new double[] {3, 2, 5, 6.5};
-        try {
-            p = interpolator.interpolate(wxval, yval, zval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (MathIllegalArgumentException e) {
-            // Expected
-        }
-
-        double[] wyval = new double[] {-4, -3, -1, -1};
-        try {
-            p = interpolator.interpolate(xval, wyval, zval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (MathIllegalArgumentException e) {
-            // Expected
-        }
-
-        double[] wzval = new double[] {-12, -8, -5.5, -3, -4, 2.5};
-        try {
-            p = interpolator.interpolate(xval, yval, wzval, fval);
-            Assert.fail("an exception should have been thrown");
-        } catch (MathIllegalArgumentException e) {
-            // Expected
-        }
-
-        double[][][] wfval = new double[xval.length][yval.length + 1][zval.length];
-        try {
-            p = interpolator.interpolate(xval, yval, zval, wfval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        wfval = new double[xval.length - 1][yval.length][zval.length];
-        try {
-            p = interpolator.interpolate(xval, yval, zval, wfval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-        wfval = new double[xval.length][yval.length][zval.length - 1];
-        try {
-            p = interpolator.interpolate(xval, yval, zval, wfval);
-            Assert.fail("an exception should have been thrown");
-        } catch (DimensionMismatchException e) {
-            // Expected
-        }
-    }
-
-    /**
-     * Test of interpolator for a plane.
-     * <p>
-     * f(x, y, z) = 2 x - 3 y - z + 5
-     */
-    @Ignore@Test
-    public void testPlane() {
-        TrivariateFunction f = new TrivariateFunction() {
-                public double value(double x, double y, double z) {
-                    return 2 * x - 3 * y - z + 5;
-                }
-            };
-
-        TrivariateGridInterpolator interpolator = new TricubicSplineInterpolator();
-
-        double[] xval = new double[] {3, 4, 5, 6.5};
-        double[] yval = new double[] {-4, -3, -1, 2, 2.5};
-        double[] zval = new double[] {-12, -8, -5.5, -3, 0, 2.5};
-        double[][][] fval = new double[xval.length][yval.length][zval.length];
-        for (int i = 0; i < xval.length; i++) {
-            for (int j = 0; j < yval.length; j++) {
-                for (int k = 0; k < zval.length; k++) {
-                    fval[i][j][k] = f.value(xval[i], yval[j], zval[k]);
-                }
-            }
-        }
-
-        TrivariateFunction p = interpolator.interpolate(xval, yval, zval, fval);
-        double x, y, z;
-        double expected, result;
-        
-        x = 4;
-        y = -3;
-        z = 0;
-        expected = f.value(x, y, z);
-        result = p.value(x, y, z);
-        Assert.assertEquals("On sample point", expected, result, 1e-15);
-
-        x = 4.5;
-        y = -1.5;
-        z = -4.25;
-        expected = f.value(x, y, z);
-        result = p.value(x, y, z);
-        Assert.assertEquals("half-way between sample points (middle of the patch)", expected, result, 0.3);
-
-        x = 3.5;
-        y = -3.5;
-        z = -10;
-        expected = f.value(x, y, z);
-        result = p.value(x, y, z);
-        Assert.assertEquals("half-way between sample points (border of the patch)", expected, result, 0.3);
-    }
-
-    /**
-     * Test of interpolator for a sine wave.
-     * <p>
-     * <p>
-     *  f(x, y, z) = a cos [&omega; z - k<sub>y</sub> x - k<sub>y</sub> y]
-     * </p>
-     * with A = 0.2, &omega; = 0.5, k<sub>x</sub> = 2, k<sub>y</sub> = 1.
-     */
-    @Ignore@Test
-    public void testWave() {
-        double[] xval = new double[] {3, 4, 5, 6.5};
-        double[] yval = new double[] {-4, -3, -1, 2, 2.5};
-        double[] zval = new double[] {-12, -8, -5.5, -3, 0, 4};
-
-        final double a = 0.2;
-        final double omega = 0.5;
-        final double kx = 2;
-        final double ky = 1;
-
-        // Function values
-        TrivariateFunction f = new TrivariateFunction() {
-                public double value(double x, double y, double z) {
-                    return a * FastMath.cos(omega * z - kx * x - ky * y);
-                }
-            };
-        
-        double[][][] fval = new double[xval.length][yval.length][zval.length];
-        for (int i = 0; i < xval.length; i++) {
-            for (int j = 0; j < yval.length; j++) {
-                for (int k = 0; k < zval.length; k++) {
-                    fval[i][j][k] = f.value(xval[i], yval[j], zval[k]);
-                }
-            }
-        }
-
-        TrivariateGridInterpolator interpolator = new TricubicSplineInterpolator();
-
-        TrivariateFunction p = interpolator.interpolate(xval, yval, zval, fval);
-        double x, y, z;
-        double expected, result;
-        
-        x = 4;
-        y = -3;
-        z = 0;
-        expected = f.value(x, y, z);
-        result = p.value(x, y, z);
-        Assert.assertEquals("On sample point",
-                            expected, result, 1e-12);
-
-        x = 4.5;
-        y = -1.5;
-        z = -4.25;
-        expected = f.value(x, y, z);
-        result = p.value(x, y, z);
-        Assert.assertEquals("Half-way between sample points (middle of the patch)",
-                            expected, result, 0.1);
-
-        x = 3.5;
-        y = -3.5;
-        z = -10;
-        expected = f.value(x, y, z);
-        result = p.value(x, y, z);
-        Assert.assertEquals("Half-way between sample points (border of the patch)",
-                            expected, result, 0.1);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0a5cd113/src/test/java/org/apache/commons/math4/analysis/solvers/NewtonSolverTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/analysis/solvers/NewtonSolverTest.java b/src/test/java/org/apache/commons/math4/analysis/solvers/NewtonSolverTest.java
deleted file mode 100644
index e9b0896..0000000
--- a/src/test/java/org/apache/commons/math4/analysis/solvers/NewtonSolverTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.analysis.solvers;
-
-import org.apache.commons.math4.analysis.DifferentiableUnivariateFunction;
-import org.apache.commons.math4.analysis.QuinticFunction;
-import org.apache.commons.math4.analysis.UnivariateFunction;
-import org.apache.commons.math4.analysis.differentiation.DerivativeStructure;
-import org.apache.commons.math4.analysis.differentiation.UnivariateDifferentiableFunction;
-import org.apache.commons.math4.analysis.function.Sin;
-import org.apache.commons.math4.analysis.solvers.NewtonSolver;
-import org.apache.commons.math4.util.FastMath;
-import org.junit.Assert;
-import org.junit.Test;
-
-
-/**
- * @deprecated
- */
-@Deprecated
-public final class NewtonSolverTest {
-    /**
-     *
-     */
-    @Test
-    public void testSinZero() {
-        DifferentiableUnivariateFunction f = new Sin();
-        double result;
-
-        NewtonSolver solver = new NewtonSolver();
-        result = solver.solve(100, f, 3, 4);
-        Assert.assertEquals(result, FastMath.PI, solver.getAbsoluteAccuracy());
-
-        result = solver.solve(100, f, 1, 4);
-        Assert.assertEquals(result, FastMath.PI, solver.getAbsoluteAccuracy());
-
-        Assert.assertTrue(solver.getEvaluations() > 0);
-    }
-
-    /**
-     *
-     */
-    @Test
-    public void testQuinticZero() {
-        final UnivariateDifferentiableFunction q = new QuinticFunction();
-        DifferentiableUnivariateFunction f = new DifferentiableUnivariateFunction() {
-
-            public double value(double x) {
-                return q.value(x);
-            }
-
-            public UnivariateFunction derivative() {
-                return new UnivariateFunction() {
-                    public double value(double x) {
-                        return q.value(new DerivativeStructure(1, 1, 0, x)).getPartialDerivative(1);
-                    }
-                };
-            }
-
-        };
-        double result;
-
-        NewtonSolver solver = new NewtonSolver();
-        result = solver.solve(100, f, -0.2, 0.2);
-        Assert.assertEquals(result, 0, solver.getAbsoluteAccuracy());
-
-        result = solver.solve(100, f, -0.1, 0.3);
-        Assert.assertEquals(result, 0, solver.getAbsoluteAccuracy());
-
-        result = solver.solve(100, f, -0.3, 0.45);
-        Assert.assertEquals(result, 0, solver.getAbsoluteAccuracy());
-
-        result = solver.solve(100, f, 0.3, 0.7);
-        Assert.assertEquals(result, 0.5, solver.getAbsoluteAccuracy());
-
-        result = solver.solve(100, f, 0.2, 0.6);
-        Assert.assertEquals(result, 0.5, solver.getAbsoluteAccuracy());
-
-        result = solver.solve(100, f, 0.05, 0.95);
-        Assert.assertEquals(result, 0.5, solver.getAbsoluteAccuracy());
-
-        result = solver.solve(100, f, 0.85, 1.25);
-        Assert.assertEquals(result, 1.0, solver.getAbsoluteAccuracy());
-
-        result = solver.solve(100, f, 0.8, 1.2);
-        Assert.assertEquals(result, 1.0, solver.getAbsoluteAccuracy());
-
-        result = solver.solve(100, f, 0.85, 1.75);
-        Assert.assertEquals(result, 1.0, solver.getAbsoluteAccuracy());
-
-        result = solver.solve(100, f, 0.55, 1.45);
-        Assert.assertEquals(result, 1.0, solver.getAbsoluteAccuracy());
-
-        result = solver.solve(100, f, 0.85, 5);
-        Assert.assertEquals(result, 1.0, solver.getAbsoluteAccuracy());
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0a5cd113/src/test/java/org/apache/commons/math4/fitting/CurveFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/CurveFitterTest.java b/src/test/java/org/apache/commons/math4/fitting/CurveFitterTest.java
deleted file mode 100644
index 18915e0..0000000
--- a/src/test/java/org/apache/commons/math4/fitting/CurveFitterTest.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.fitting;
-
-import org.apache.commons.math4.analysis.ParametricUnivariateFunction;
-import org.apache.commons.math4.fitting.CurveFitter;
-import org.apache.commons.math4.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer;
-import org.apache.commons.math4.util.FastMath;
-import org.junit.Assert;
-import org.junit.Test;
-
-@Deprecated
-public class CurveFitterTest {
-    @Test
-    public void testMath303() {
-        LevenbergMarquardtOptimizer optimizer = new LevenbergMarquardtOptimizer();
-        CurveFitter<ParametricUnivariateFunction> fitter = new CurveFitter<ParametricUnivariateFunction>(optimizer);
-        fitter.addObservedPoint(2.805d, 0.6934785852953367d);
-        fitter.addObservedPoint(2.74333333333333d, 0.6306772025518496d);
-        fitter.addObservedPoint(1.655d, 0.9474675497289684);
-        fitter.addObservedPoint(1.725d, 0.9013594835804194d);
-
-        ParametricUnivariateFunction sif = new SimpleInverseFunction();
-
-        double[] initialguess1 = new double[1];
-        initialguess1[0] = 1.0d;
-        Assert.assertEquals(1, fitter.fit(sif, initialguess1).length);
-
-        double[] initialguess2 = new double[2];
-        initialguess2[0] = 1.0d;
-        initialguess2[1] = .5d;
-        Assert.assertEquals(2, fitter.fit(sif, initialguess2).length);
-    }
-
-    @Test
-    public void testMath304() {
-        LevenbergMarquardtOptimizer optimizer = new LevenbergMarquardtOptimizer();
-        CurveFitter<ParametricUnivariateFunction> fitter = new CurveFitter<ParametricUnivariateFunction>(optimizer);
-        fitter.addObservedPoint(2.805d, 0.6934785852953367d);
-        fitter.addObservedPoint(2.74333333333333d, 0.6306772025518496d);
-        fitter.addObservedPoint(1.655d, 0.9474675497289684);
-        fitter.addObservedPoint(1.725d, 0.9013594835804194d);
-
-        ParametricUnivariateFunction sif = new SimpleInverseFunction();
-
-        double[] initialguess1 = new double[1];
-        initialguess1[0] = 1.0d;
-        Assert.assertEquals(1.6357215104109237, fitter.fit(sif, initialguess1)[0], 1.0e-14);
-
-        double[] initialguess2 = new double[1];
-        initialguess2[0] = 10.0d;
-        Assert.assertEquals(1.6357215104109237, fitter.fit(sif, initialguess1)[0], 1.0e-14);
-    }
-
-    @Test
-    public void testMath372() {
-        LevenbergMarquardtOptimizer optimizer = new LevenbergMarquardtOptimizer();
-        CurveFitter<ParametricUnivariateFunction> curveFitter = new CurveFitter<ParametricUnivariateFunction>(optimizer);
-
-        curveFitter.addObservedPoint( 15,  4443);
-        curveFitter.addObservedPoint( 31,  8493);
-        curveFitter.addObservedPoint( 62, 17586);
-        curveFitter.addObservedPoint(125, 30582);
-        curveFitter.addObservedPoint(250, 45087);
-        curveFitter.addObservedPoint(500, 50683);
-
-        ParametricUnivariateFunction f = new ParametricUnivariateFunction() {
-            public double value(double x, double ... parameters) {
-                double a = parameters[0];
-                double b = parameters[1];
-                double c = parameters[2];
-                double d = parameters[3];
-
-                return d + ((a - d) / (1 + FastMath.pow(x / c, b)));
-            }
-
-            public double[] gradient(double x, double ... parameters) {
-                double a = parameters[0];
-                double b = parameters[1];
-                double c = parameters[2];
-                double d = parameters[3];
-
-                double[] gradients = new double[4];
-                double den = 1 + FastMath.pow(x / c, b);
-
-                // derivative with respect to a
-                gradients[0] = 1 / den;
-
-                // derivative with respect to b
-                // in the reported (invalid) issue, there was a sign error here
-                gradients[1] = -((a - d) * FastMath.pow(x / c, b) * FastMath.log(x / c)) / (den * den);
-
-                // derivative with respect to c
-                gradients[2] = (b * FastMath.pow(x / c, b - 1) * (x / (c * c)) * (a - d)) / (den * den);
-
-                // derivative with respect to d
-                gradients[3] = 1 - (1 / den);
-
-                return gradients;
-
-            }
-        };
-
-        double[] initialGuess = new double[] { 1500, 0.95, 65, 35000 };
-        double[] estimatedParameters = curveFitter.fit(f, initialGuess);
-
-        Assert.assertEquals( 2411.00, estimatedParameters[0], 500.00);
-        Assert.assertEquals(    1.62, estimatedParameters[1],   0.04);
-        Assert.assertEquals(  111.22, estimatedParameters[2],   0.30);
-        Assert.assertEquals(55347.47, estimatedParameters[3], 300.00);
-        Assert.assertTrue(optimizer.getRMS() < 600.0);
-    }
-
-    private static class SimpleInverseFunction implements ParametricUnivariateFunction {
-
-        public double value(double x, double ... parameters) {
-            return parameters[0] / x + (parameters.length < 2 ? 0 : parameters[1]);
-        }
-
-        public double[] gradient(double x, double ... doubles) {
-            double[] gradientVector = new double[doubles.length];
-            gradientVector[0] = 1 / x;
-            if (doubles.length >= 2) {
-                gradientVector[1] = 1;
-            }
-            return gradientVector;
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0a5cd113/src/test/java/org/apache/commons/math4/fitting/GaussianFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/GaussianFitterTest.java b/src/test/java/org/apache/commons/math4/fitting/GaussianFitterTest.java
deleted file mode 100644
index a7ca9b2..0000000
--- a/src/test/java/org/apache/commons/math4/fitting/GaussianFitterTest.java
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.fitting;
-
-import org.apache.commons.math4.exception.MathIllegalArgumentException;
-import org.apache.commons.math4.fitting.GaussianFitter;
-import org.apache.commons.math4.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer;
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * Tests {@link GaussianFitter}.
- *
- * @since 2.2
- */
-@Deprecated
-public class GaussianFitterTest {
-    /** Good data. */
-    protected static final double[][] DATASET1 = new double[][] {
-        {4.0254623,  531026.0},
-        {4.02804905, 664002.0},
-        {4.02934242, 787079.0},
-        {4.03128248, 984167.0},
-        {4.03386923, 1294546.0},
-        {4.03580929, 1560230.0},
-        {4.03839603, 1887233.0},
-        {4.0396894,  2113240.0},
-        {4.04162946, 2375211.0},
-        {4.04421621, 2687152.0},
-        {4.04550958, 2862644.0},
-        {4.04744964, 3078898.0},
-        {4.05003639, 3327238.0},
-        {4.05132976, 3461228.0},
-        {4.05326982, 3580526.0},
-        {4.05585657, 3576946.0},
-        {4.05779662, 3439750.0},
-        {4.06038337, 3220296.0},
-        {4.06167674, 3070073.0},
-        {4.0636168,  2877648.0},
-        {4.06620355, 2595848.0},
-        {4.06749692, 2390157.0},
-        {4.06943698, 2175960.0},
-        {4.07202373, 1895104.0},
-        {4.0733171,  1687576.0},
-        {4.07525716, 1447024.0},
-        {4.0778439,  1130879.0},
-        {4.07978396, 904900.0},
-        {4.08237071, 717104.0},
-        {4.08366408, 620014.0}
-    };
-    /** Poor data: right of peak not symmetric with left of peak. */
-    protected static final double[][] DATASET2 = new double[][] {
-        {-20.15,   1523.0},
-        {-19.65,   1566.0},
-        {-19.15,   1592.0},
-        {-18.65,   1927.0},
-        {-18.15,   3089.0},
-        {-17.65,   6068.0},
-        {-17.15,  14239.0},
-        {-16.65,  34124.0},
-        {-16.15,  64097.0},
-        {-15.65, 110352.0},
-        {-15.15, 164742.0},
-        {-14.65, 209499.0},
-        {-14.15, 267274.0},
-        {-13.65, 283290.0},
-        {-13.15, 275363.0},
-        {-12.65, 258014.0},
-        {-12.15, 225000.0},
-        {-11.65, 200000.0},
-        {-11.15, 190000.0},
-        {-10.65, 185000.0},
-        {-10.15, 180000.0},
-        { -9.65, 179000.0},
-        { -9.15, 178000.0},
-        { -8.65, 177000.0},
-        { -8.15, 176000.0},
-        { -7.65, 175000.0},
-        { -7.15, 174000.0},
-        { -6.65, 173000.0},
-        { -6.15, 172000.0},
-        { -5.65, 171000.0},
-        { -5.15, 170000.0}
-    };
-    /** Poor data: long tails. */
-    protected static final double[][] DATASET3 = new double[][] {
-        {-90.15,   1513.0},
-        {-80.15,   1514.0},
-        {-70.15,   1513.0},
-        {-60.15,   1514.0},
-        {-50.15,   1513.0},
-        {-40.15,   1514.0},
-        {-30.15,   1513.0},
-        {-20.15,   1523.0},
-        {-19.65,   1566.0},
-        {-19.15,   1592.0},
-        {-18.65,   1927.0},
-        {-18.15,   3089.0},
-        {-17.65,   6068.0},
-        {-17.15,  14239.0},
-        {-16.65,  34124.0},
-        {-16.15,  64097.0},
-        {-15.65, 110352.0},
-        {-15.15, 164742.0},
-        {-14.65, 209499.0},
-        {-14.15, 267274.0},
-        {-13.65, 283290.0},
-        {-13.15, 275363.0},
-        {-12.65, 258014.0},
-        {-12.15, 214073.0},
-        {-11.65, 182244.0},
-        {-11.15, 136419.0},
-        {-10.65,  97823.0},
-        {-10.15,  58930.0},
-        { -9.65,  35404.0},
-        { -9.15,  16120.0},
-        { -8.65,   9823.0},
-        { -8.15,   5064.0},
-        { -7.65,   2575.0},
-        { -7.15,   1642.0},
-        { -6.65,   1101.0},
-        { -6.15,    812.0},
-        { -5.65,    690.0},
-        { -5.15,    565.0},
-        {  5.15,    564.0},
-        { 15.15,    565.0},
-        { 25.15,    564.0},
-        { 35.15,    565.0},
-        { 45.15,    564.0},
-        { 55.15,    565.0},
-        { 65.15,    564.0},
-        { 75.15,    565.0}
-    };
-    /** Poor data: right of peak is missing. */
-    protected static final double[][] DATASET4 = new double[][] {
-        {-20.15,   1523.0},
-        {-19.65,   1566.0},
-        {-19.15,   1592.0},
-        {-18.65,   1927.0},
-        {-18.15,   3089.0},
-        {-17.65,   6068.0},
-        {-17.15,  14239.0},
-        {-16.65,  34124.0},
-        {-16.15,  64097.0},
-        {-15.65, 110352.0},
-        {-15.15, 164742.0},
-        {-14.65, 209499.0},
-        {-14.15, 267274.0},
-        {-13.65, 283290.0}
-    };
-    /** Good data, but few points. */
-    protected static final double[][] DATASET5 = new double[][] {
-        {4.0254623,  531026.0},
-        {4.03128248, 984167.0},
-        {4.03839603, 1887233.0},
-        {4.04421621, 2687152.0},
-        {4.05132976, 3461228.0},
-        {4.05326982, 3580526.0},
-        {4.05779662, 3439750.0},
-        {4.0636168,  2877648.0},
-        {4.06943698, 2175960.0},
-        {4.07525716, 1447024.0},
-        {4.08237071, 717104.0},
-        {4.08366408, 620014.0}
-    };
-
-    /**
-     * Basic.
-     */
-    @Test
-    public void testFit01() {
-        GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
-        addDatasetToGaussianFitter(DATASET1, fitter);
-        double[] parameters = fitter.fit();
-
-        Assert.assertEquals(3496978.1837704973, parameters[0], 1e-4);
-        Assert.assertEquals(4.054933085999146, parameters[1], 1e-4);
-        Assert.assertEquals(0.015039355620304326, parameters[2], 1e-4);
-    }
-
-    /**
-     * Zero points is not enough observed points.
-     */
-    @Test(expected=MathIllegalArgumentException.class)
-    public void testFit02() {
-        GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
-        fitter.fit();
-    }
-    
-    /**
-     * Two points is not enough observed points.
-     */
-    @Test(expected=MathIllegalArgumentException.class)
-    public void testFit03() {
-        GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
-        addDatasetToGaussianFitter(new double[][] {
-            {4.0254623,  531026.0},
-            {4.02804905, 664002.0}},
-            fitter);
-        fitter.fit();
-    }
-    
-    /**
-     * Poor data: right of peak not symmetric with left of peak.
-     */
-    @Test
-    public void testFit04() {
-        GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
-        addDatasetToGaussianFitter(DATASET2, fitter);
-        double[] parameters = fitter.fit();
-
-        Assert.assertEquals(233003.2967252038, parameters[0], 1e-4);
-        Assert.assertEquals(-10.654887521095983, parameters[1], 1e-4);
-        Assert.assertEquals(4.335937353196641, parameters[2], 1e-4);
-    }  
-    
-    /**
-     * Poor data: long tails.
-     */
-    @Test
-    public void testFit05() {
-        GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
-        addDatasetToGaussianFitter(DATASET3, fitter);
-        double[] parameters = fitter.fit();
-
-        Assert.assertEquals(283863.81929180305, parameters[0], 1e-4);
-        Assert.assertEquals(-13.29641995105174, parameters[1], 1e-4);
-        Assert.assertEquals(1.7297330293549908, parameters[2], 1e-4);
-    }
-    
-    /**
-     * Poor data: right of peak is missing.
-     */
-    @Test
-    public void testFit06() {
-        GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
-        addDatasetToGaussianFitter(DATASET4, fitter);
-        double[] parameters = fitter.fit();
-
-        Assert.assertEquals(285250.66754309234, parameters[0], 1e-4);
-        Assert.assertEquals(-13.528375695228455, parameters[1], 1e-4);
-        Assert.assertEquals(1.5204344894331614, parameters[2], 1e-4);
-    }    
-
-    /**
-     * Basic with smaller dataset.
-     */
-    @Test
-    public void testFit07() {
-        GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
-        addDatasetToGaussianFitter(DATASET5, fitter);
-        double[] parameters = fitter.fit();
-
-        Assert.assertEquals(3514384.729342235, parameters[0], 1e-4);
-        Assert.assertEquals(4.054970307455625, parameters[1], 1e-4);
-        Assert.assertEquals(0.015029412832160017, parameters[2], 1e-4);
-    }
-
-    @Test
-    public void testMath519() {
-        // The optimizer will try negative sigma values but "GaussianFitter"
-        // will catch the raised exceptions and return NaN values instead.
-
-        final double[] data = { 
-            1.1143831578403364E-29,
-            4.95281403484594E-28,
-            1.1171347211930288E-26,
-            1.7044813962636277E-25,
-            1.9784716574832164E-24,
-            1.8630236407866774E-23,
-            1.4820532905097742E-22,
-            1.0241963854632831E-21,
-            6.275077366673128E-21,
-            3.461808994532493E-20,
-            1.7407124684715706E-19,
-            8.056687953553974E-19,
-            3.460193945992071E-18,
-            1.3883326374011525E-17,
-            5.233894983671116E-17,
-            1.8630791465263745E-16,
-            6.288759227922111E-16,
-            2.0204433920597856E-15,
-            6.198768938576155E-15,
-            1.821419346860626E-14,
-            5.139176445538471E-14,
-            1.3956427429045787E-13,
-            3.655705706448139E-13,
-            9.253753324779779E-13,
-            2.267636001476696E-12,
-            5.3880460095836855E-12,
-            1.2431632654852931E-11
-        };
-
-        GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
-        for (int i = 0; i < data.length; i++) {
-            fitter.addObservedPoint(i, data[i]);
-        }
-        final double[] p = fitter.fit();
-
-        Assert.assertEquals(53.1572792, p[1], 1e-7);
-        Assert.assertEquals(5.75214622, p[2], 1e-8);
-    }
-
-    @Test
-    public void testMath798() {
-        final GaussianFitter fitter = new GaussianFitter(new LevenbergMarquardtOptimizer());
-
-        // When the data points are not commented out below, the fit stalls.
-        // This is expected however, since the whole dataset hardly looks like
-        // a Gaussian.
-        // When commented out, the fit proceeds fine.
-
-        fitter.addObservedPoint(0.23, 395.0);
-        //fitter.addObservedPoint(0.68, 0.0);
-        fitter.addObservedPoint(1.14, 376.0);
-        //fitter.addObservedPoint(1.59, 0.0);
-        fitter.addObservedPoint(2.05, 163.0);
-        //fitter.addObservedPoint(2.50, 0.0);
-        fitter.addObservedPoint(2.95, 49.0);
-        //fitter.addObservedPoint(3.41, 0.0);
-        fitter.addObservedPoint(3.86, 16.0);
-        //fitter.addObservedPoint(4.32, 0.0);
-        fitter.addObservedPoint(4.77, 1.0);
-
-        final double[] p = fitter.fit();
-
-        // Values are copied from a previous run of this test.
-        Assert.assertEquals(420.8397296167364, p[0], 1e-12);
-        Assert.assertEquals(0.603770729862231, p[1], 1e-15);
-        Assert.assertEquals(1.0786447936766612, p[2], 1e-14);
-    }
-    
-    /**
-     * Adds the specified points to specified <code>GaussianFitter</code>
-     * instance.
-     *
-     * @param points data points where first dimension is a point index and
-     *        second dimension is an array of length two representing the point
-     *        with the first value corresponding to X and the second value
-     *        corresponding to Y
-     * @param fitter fitter to which the points in <code>points</code> should be
-     *        added as observed points
-     */
-    protected static void addDatasetToGaussianFitter(double[][] points,
-                                                     GaussianFitter fitter) {
-        for (int i = 0; i < points.length; i++) {
-            fitter.addObservedPoint(points[i][0], points[i][1]);
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0a5cd113/src/test/java/org/apache/commons/math4/fitting/HarmonicFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/HarmonicFitterTest.java b/src/test/java/org/apache/commons/math4/fitting/HarmonicFitterTest.java
deleted file mode 100644
index 328d060..0000000
--- a/src/test/java/org/apache/commons/math4/fitting/HarmonicFitterTest.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.fitting;
-
-import java.util.Random;
-
-import org.apache.commons.math4.analysis.function.HarmonicOscillator;
-import org.apache.commons.math4.exception.MathIllegalStateException;
-import org.apache.commons.math4.exception.NumberIsTooSmallException;
-import org.apache.commons.math4.fitting.HarmonicFitter;
-import org.apache.commons.math4.fitting.WeightedObservedPoint;
-import org.apache.commons.math4.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer;
-import org.apache.commons.math4.util.FastMath;
-import org.apache.commons.math4.util.MathUtils;
-import org.junit.Test;
-import org.junit.Assert;
-
-@Deprecated
-public class HarmonicFitterTest {
-    @Test(expected=NumberIsTooSmallException.class)
-    public void testPreconditions1() {
-        HarmonicFitter fitter =
-            new HarmonicFitter(new LevenbergMarquardtOptimizer());
-
-        fitter.fit();
-    }
-
-    @Test
-    public void testNoError() {
-        final double a = 0.2;
-        final double w = 3.4;
-        final double p = 4.1;
-        HarmonicOscillator f = new HarmonicOscillator(a, w, p);
-
-        HarmonicFitter fitter =
-            new HarmonicFitter(new LevenbergMarquardtOptimizer());
-        for (double x = 0.0; x < 1.3; x += 0.01) {
-            fitter.addObservedPoint(1, x, f.value(x));
-        }
-
-        final double[] fitted = fitter.fit();
-        Assert.assertEquals(a, fitted[0], 1.0e-13);
-        Assert.assertEquals(w, fitted[1], 1.0e-13);
-        Assert.assertEquals(p, MathUtils.normalizeAngle(fitted[2], p), 1e-13);
-
-        HarmonicOscillator ff = new HarmonicOscillator(fitted[0], fitted[1], fitted[2]);
-
-        for (double x = -1.0; x < 1.0; x += 0.01) {
-            Assert.assertTrue(FastMath.abs(f.value(x) - ff.value(x)) < 1e-13);
-        }
-    }
-
-    @Test
-    public void test1PercentError() {
-        Random randomizer = new Random(64925784252l);
-        final double a = 0.2;
-        final double w = 3.4;
-        final double p = 4.1;
-        HarmonicOscillator f = new HarmonicOscillator(a, w, p);
-
-        HarmonicFitter fitter =
-            new HarmonicFitter(new LevenbergMarquardtOptimizer());
-        for (double x = 0.0; x < 10.0; x += 0.1) {
-            fitter.addObservedPoint(1, x,
-                                    f.value(x) + 0.01 * randomizer.nextGaussian());
-        }
-
-        final double[] fitted = fitter.fit();
-        Assert.assertEquals(a, fitted[0], 7.6e-4);
-        Assert.assertEquals(w, fitted[1], 2.7e-3);
-        Assert.assertEquals(p, MathUtils.normalizeAngle(fitted[2], p), 1.3e-2);
-    }
-
-    @Test
-    public void testTinyVariationsData() {
-        Random randomizer = new Random(64925784252l);
-
-        HarmonicFitter fitter =
-            new HarmonicFitter(new LevenbergMarquardtOptimizer());
-        for (double x = 0.0; x < 10.0; x += 0.1) {
-            fitter.addObservedPoint(1, x, 1e-7 * randomizer.nextGaussian());
-        }
-
-        fitter.fit();
-        // This test serves to cover the part of the code of "guessAOmega"
-        // when the algorithm using integrals fails.
-    }
-
-    @Test
-    public void testInitialGuess() {
-        Random randomizer = new Random(45314242l);
-        final double a = 0.2;
-        final double w = 3.4;
-        final double p = 4.1;
-        HarmonicOscillator f = new HarmonicOscillator(a, w, p);
-
-        HarmonicFitter fitter =
-            new HarmonicFitter(new LevenbergMarquardtOptimizer());
-        for (double x = 0.0; x < 10.0; x += 0.1) {
-            fitter.addObservedPoint(1, x,
-                                    f.value(x) + 0.01 * randomizer.nextGaussian());
-        }
-
-        final double[] fitted = fitter.fit(new double[] { 0.15, 3.6, 4.5 });
-        Assert.assertEquals(a, fitted[0], 1.2e-3);
-        Assert.assertEquals(w, fitted[1], 3.3e-3);
-        Assert.assertEquals(p, MathUtils.normalizeAngle(fitted[2], p), 1.7e-2);
-    }
-
-    @Test
-    public void testUnsorted() {
-        Random randomizer = new Random(64925784252l);
-        final double a = 0.2;
-        final double w = 3.4;
-        final double p = 4.1;
-        HarmonicOscillator f = new HarmonicOscillator(a, w, p);
-
-        HarmonicFitter fitter =
-            new HarmonicFitter(new LevenbergMarquardtOptimizer());
-
-        // build a regularly spaced array of measurements
-        int size = 100;
-        double[] xTab = new double[size];
-        double[] yTab = new double[size];
-        for (int i = 0; i < size; ++i) {
-            xTab[i] = 0.1 * i;
-            yTab[i] = f.value(xTab[i]) + 0.01 * randomizer.nextGaussian();
-        }
-
-        // shake it
-        for (int i = 0; i < size; ++i) {
-            int i1 = randomizer.nextInt(size);
-            int i2 = randomizer.nextInt(size);
-            double xTmp = xTab[i1];
-            double yTmp = yTab[i1];
-            xTab[i1] = xTab[i2];
-            yTab[i1] = yTab[i2];
-            xTab[i2] = xTmp;
-            yTab[i2] = yTmp;
-        }
-
-        // pass it to the fitter
-        for (int i = 0; i < size; ++i) {
-            fitter.addObservedPoint(1, xTab[i], yTab[i]);
-        }
-
-        final double[] fitted = fitter.fit();
-        Assert.assertEquals(a, fitted[0], 7.6e-4);
-        Assert.assertEquals(w, fitted[1], 3.5e-3);
-        Assert.assertEquals(p, MathUtils.normalizeAngle(fitted[2], p), 1.5e-2);
-    }
-
-    @Test(expected=MathIllegalStateException.class)
-    public void testMath844() {
-        final double[] y = { 0, 1, 2, 3, 2, 1,
-                             0, -1, -2, -3, -2, -1,
-                             0, 1, 2, 3, 2, 1,
-                             0, -1, -2, -3, -2, -1,
-                             0, 1, 2, 3, 2, 1, 0 };
-        final int len = y.length;
-        final WeightedObservedPoint[] points = new WeightedObservedPoint[len];
-        for (int i = 0; i < len; i++) {
-            points[i] = new WeightedObservedPoint(1, i, y[i]);
-        }
-
-        // The guesser fails because the function is far from an harmonic
-        // function: It is a triangular periodic function with amplitude 3
-        // and period 12, and all sample points are taken at integer abscissae
-        // so function values all belong to the integer subset {-3, -2, -1, 0,
-        // 1, 2, 3}.
-        new HarmonicFitter.ParameterGuesser(points);
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-math/blob/0a5cd113/src/test/java/org/apache/commons/math4/fitting/PolynomialFitterTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/math4/fitting/PolynomialFitterTest.java b/src/test/java/org/apache/commons/math4/fitting/PolynomialFitterTest.java
deleted file mode 100644
index ff543ab..0000000
--- a/src/test/java/org/apache/commons/math4/fitting/PolynomialFitterTest.java
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.commons.math4.fitting;
-
-import java.util.Random;
-
-import org.apache.commons.math4.TestUtils;
-import org.apache.commons.math4.analysis.polynomials.PolynomialFunction;
-import org.apache.commons.math4.analysis.polynomials.PolynomialFunction.Parametric;
-import org.apache.commons.math4.distribution.RealDistribution;
-import org.apache.commons.math4.distribution.UniformRealDistribution;
-import org.apache.commons.math4.exception.ConvergenceException;
-import org.apache.commons.math4.exception.TooManyEvaluationsException;
-import org.apache.commons.math4.fitting.CurveFitter;
-import org.apache.commons.math4.fitting.PolynomialFitter;
-import org.apache.commons.math4.optim.SimpleVectorValueChecker;
-import org.apache.commons.math4.optim.nonlinear.vector.MultivariateVectorOptimizer;
-import org.apache.commons.math4.optim.nonlinear.vector.jacobian.GaussNewtonOptimizer;
-import org.apache.commons.math4.optim.nonlinear.vector.jacobian.LevenbergMarquardtOptimizer;
-import org.apache.commons.math4.util.FastMath;
-import org.junit.Test;
-import org.junit.Assert;
-
-/**
- * Test for class {@link CurveFitter} where the function to fit is a
- * polynomial.
- */
-@Deprecated
-public class PolynomialFitterTest {
-    @Test
-    public void testFit() {
-        final RealDistribution rng = new UniformRealDistribution(-100, 100);
-        rng.reseedRandomGenerator(64925784252L);
-
-        final LevenbergMarquardtOptimizer optim = new LevenbergMarquardtOptimizer();
-        final PolynomialFitter fitter = new PolynomialFitter(optim);
-        final double[] coeff = { 12.9, -3.4, 2.1 }; // 12.9 - 3.4 x + 2.1 x^2
-        final PolynomialFunction f = new PolynomialFunction(coeff);
-
-        // Collect data from a known polynomial.
-        for (int i = 0; i < 100; i++) {
-            final double x = rng.sample();
-            fitter.addObservedPoint(x, f.value(x));
-        }
-
-        // Start fit from initial guesses that are far from the optimal values.
-        final double[] best = fitter.fit(new double[] { -1e-20, 3e15, -5e25 });
-
-        TestUtils.assertEquals("best != coeff", coeff, best, 1e-12);
-    }
-
-    @Test
-    public void testNoError() {
-        Random randomizer = new Random(64925784252l);
-        for (int degree = 1; degree < 10; ++degree) {
-            PolynomialFunction p = buildRandomPolynomial(degree, randomizer);
-
-            PolynomialFitter fitter = new PolynomialFitter(new LevenbergMarquardtOptimizer());
-            for (int i = 0; i <= degree; ++i) {
-                fitter.addObservedPoint(1.0, i, p.value(i));
-            }
-
-            final double[] init = new double[degree + 1];
-            PolynomialFunction fitted = new PolynomialFunction(fitter.fit(init));
-
-            for (double x = -1.0; x < 1.0; x += 0.01) {
-                double error = FastMath.abs(p.value(x) - fitted.value(x)) /
-                               (1.0 + FastMath.abs(p.value(x)));
-                Assert.assertEquals(0.0, error, 1.0e-6);
-            }
-        }
-    }
-
-    @Test
-    public void testSmallError() {
-        Random randomizer = new Random(53882150042l);
-        double maxError = 0;
-        for (int degree = 0; degree < 10; ++degree) {
-            PolynomialFunction p = buildRandomPolynomial(degree, randomizer);
-
-            PolynomialFitter fitter = new PolynomialFitter(new LevenbergMarquardtOptimizer());
-            for (double x = -1.0; x < 1.0; x += 0.01) {
-                fitter.addObservedPoint(1.0, x,
-                                        p.value(x) + 0.1 * randomizer.nextGaussian());
-            }
-
-            final double[] init = new double[degree + 1];
-            PolynomialFunction fitted = new PolynomialFunction(fitter.fit(init));
-
-            for (double x = -1.0; x < 1.0; x += 0.01) {
-                double error = FastMath.abs(p.value(x) - fitted.value(x)) /
-                              (1.0 + FastMath.abs(p.value(x)));
-                maxError = FastMath.max(maxError, error);
-                Assert.assertTrue(FastMath.abs(error) < 0.1);
-            }
-        }
-        Assert.assertTrue(maxError > 0.01);
-    }
-
-    @Test
-    public void testMath798() {
-        final double tol = 1e-14;
-        final SimpleVectorValueChecker checker = new SimpleVectorValueChecker(tol, tol);
-        final double[] init = new double[] { 0, 0 };
-        final int maxEval = 3;
-
-        final double[] lm = doMath798(new LevenbergMarquardtOptimizer(checker), maxEval, init);
-        final double[] gn = doMath798(new GaussNewtonOptimizer(checker), maxEval, init);
-
-        for (int i = 0; i <= 1; i++) {
-            Assert.assertEquals(lm[i], gn[i], tol);
-        }
-    }
-
-    /**
-     * This test shows that the user can set the maximum number of iterations
-     * to avoid running for too long.
-     * But in the test case, the real problem is that the tolerance is way too
-     * stringent.
-     */
-    @Test(expected=TooManyEvaluationsException.class)
-    public void testMath798WithToleranceTooLow() {
-        final double tol = 1e-100;
-        final SimpleVectorValueChecker checker = new SimpleVectorValueChecker(tol, tol);
-        final double[] init = new double[] { 0, 0 };
-        final int maxEval = 10000; // Trying hard to fit.
-
-        @SuppressWarnings("unused")
-        final double[] gn = doMath798(new GaussNewtonOptimizer(checker), maxEval, init);
-    }
-
-    /**
-     * This test shows that the user can set the maximum number of iterations
-     * to avoid running for too long.
-     * Even if the real problem is that the tolerance is way too stringent, it
-     * is possible to get the best solution so far, i.e. a checker will return
-     * the point when the maximum iteration count has been reached.
-     */
-    @Test
-    public void testMath798WithToleranceTooLowButNoException() {
-        final double tol = 1e-100;
-        final double[] init = new double[] { 0, 0 };
-        final int maxEval = 10000; // Trying hard to fit.
-        final SimpleVectorValueChecker checker = new SimpleVectorValueChecker(tol, tol, maxEval);
-
-        final double[] lm = doMath798(new LevenbergMarquardtOptimizer(checker), maxEval, init);
-        final double[] gn = doMath798(new GaussNewtonOptimizer(checker), maxEval, init);
-
-        for (int i = 0; i <= 1; i++) {
-            Assert.assertEquals(lm[i], gn[i], 1e-15);
-        }
-    }
-
-    /**
-     * @param optimizer Optimizer.
-     * @param maxEval Maximum number of function evaluations.
-     * @param init First guess.
-     * @return the solution found by the given optimizer.
-     */
-    private double[] doMath798(MultivariateVectorOptimizer optimizer,
-                               int maxEval,
-                               double[] init) {
-        final CurveFitter<Parametric> fitter = new CurveFitter<Parametric>(optimizer);
-
-        fitter.addObservedPoint(-0.2, -7.12442E-13);
-        fitter.addObservedPoint(-0.199, -4.33397E-13);
-        fitter.addObservedPoint(-0.198, -2.823E-13);
-        fitter.addObservedPoint(-0.197, -1.40405E-13);
-        fitter.addObservedPoint(-0.196, -7.80821E-15);
-        fitter.addObservedPoint(-0.195, 6.20484E-14);
-        fitter.addObservedPoint(-0.194, 7.24673E-14);
-        fitter.addObservedPoint(-0.193, 1.47152E-13);
-        fitter.addObservedPoint(-0.192, 1.9629E-13);
-        fitter.addObservedPoint(-0.191, 2.12038E-13);
-        fitter.addObservedPoint(-0.19, 2.46906E-13);
-        fitter.addObservedPoint(-0.189, 2.77495E-13);
-        fitter.addObservedPoint(-0.188, 2.51281E-13);
-        fitter.addObservedPoint(-0.187, 2.64001E-13);
-        fitter.addObservedPoint(-0.186, 2.8882E-13);
-        fitter.addObservedPoint(-0.185, 3.13604E-13);
-        fitter.addObservedPoint(-0.184, 3.14248E-13);
-        fitter.addObservedPoint(-0.183, 3.1172E-13);
-        fitter.addObservedPoint(-0.182, 3.12912E-13);
-        fitter.addObservedPoint(-0.181, 3.06761E-13);
-        fitter.addObservedPoint(-0.18, 2.8559E-13);
-        fitter.addObservedPoint(-0.179, 2.86806E-13);
-        fitter.addObservedPoint(-0.178, 2.985E-13);
-        fitter.addObservedPoint(-0.177, 2.67148E-13);
-        fitter.addObservedPoint(-0.176, 2.94173E-13);
-        fitter.addObservedPoint(-0.175, 3.27528E-13);
-        fitter.addObservedPoint(-0.174, 3.33858E-13);
-        fitter.addObservedPoint(-0.173, 2.97511E-13);
-        fitter.addObservedPoint(-0.172, 2.8615E-13);
-        fitter.addObservedPoint(-0.171, 2.84624E-13);
-
-        final double[] coeff = fitter.fit(maxEval,
-                                          new PolynomialFunction.Parametric(),
-                                          init);
-        return coeff;
-    }
-
-    @Test
-    public void testRedundantSolvable() {
-        // Levenberg-Marquardt should handle redundant information gracefully
-        checkUnsolvableProblem(new LevenbergMarquardtOptimizer(), true);
-    }
-
-    @Test
-    public void testRedundantUnsolvable() {
-        // Gauss-Newton should not be able to solve redundant information
-        checkUnsolvableProblem(new GaussNewtonOptimizer(true, new SimpleVectorValueChecker(1e-15, 1e-15)), false);
-    }
-
-    @Test
-    public void testLargeSample() {
-        Random randomizer = new Random(0x5551480dca5b369bl);
-        double maxError = 0;
-        for (int degree = 0; degree < 10; ++degree) {
-            PolynomialFunction p = buildRandomPolynomial(degree, randomizer);
-
-            PolynomialFitter fitter = new PolynomialFitter(new LevenbergMarquardtOptimizer());
-            for (int i = 0; i < 40000; ++i) {
-                double x = -1.0 + i / 20000.0;
-                fitter.addObservedPoint(1.0, x,
-                                        p.value(x) + 0.1 * randomizer.nextGaussian());
-            }
-
-            final double[] init = new double[degree + 1];
-            PolynomialFunction fitted = new PolynomialFunction(fitter.fit(init));
-
-            for (double x = -1.0; x < 1.0; x += 0.01) {
-                double error = FastMath.abs(p.value(x) - fitted.value(x)) /
-                              (1.0 + FastMath.abs(p.value(x)));
-                maxError = FastMath.max(maxError, error);
-                Assert.assertTrue(FastMath.abs(error) < 0.01);
-            }
-        }
-        Assert.assertTrue(maxError > 0.001);
-    }
-
-    private void checkUnsolvableProblem(MultivariateVectorOptimizer optimizer,
-                                        boolean solvable) {
-        Random randomizer = new Random(1248788532l);
-        for (int degree = 0; degree < 10; ++degree) {
-            PolynomialFunction p = buildRandomPolynomial(degree, randomizer);
-
-            PolynomialFitter fitter = new PolynomialFitter(optimizer);
-
-            // reusing the same point over and over again does not bring
-            // information, the problem cannot be solved in this case for
-            // degrees greater than 1 (but one point is sufficient for
-            // degree 0)
-            for (double x = -1.0; x < 1.0; x += 0.01) {
-                fitter.addObservedPoint(1.0, 0.0, p.value(0.0));
-            }
-
-            try {
-                final double[] init = new double[degree + 1];
-                fitter.fit(init);
-                Assert.assertTrue(solvable || (degree == 0));
-            } catch(ConvergenceException e) {
-                Assert.assertTrue((! solvable) && (degree > 0));
-            }
-        }
-    }
-
-    private PolynomialFunction buildRandomPolynomial(int degree, Random randomizer) {
-        final double[] coefficients = new double[degree + 1];
-        for (int i = 0; i <= degree; ++i) {
-            coefficients[i] = randomizer.nextGaussian();
-        }
-        return new PolynomialFunction(coefficients);
-    }
-}