commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject [02/31] commons-numbers git commit: Cleanup (massive delete).
Date Fri, 20 Jan 2017 14:45:49 GMT
http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/a752ab8d/src/test/java/org/apache/commons/complex/ComplexUtilsTest.java.orig
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/complex/ComplexUtilsTest.java.orig b/src/test/java/org/apache/commons/complex/ComplexUtilsTest.java.orig
deleted file mode 100755
index 7ba7fa1..0000000
--- a/src/test/java/org/apache/commons/complex/ComplexUtilsTest.java.orig
+++ /dev/null
@@ -1,608 +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.complex.complex;
-
-import org.apache.commons.complex.TestUtils;
-import org.apache.commons.complex.complex.Complex;
-import org.apache.commons.complex.complex.ComplexUtils;
-import org.apache.commons.complex.exception.MathIllegalArgumentException;
-import org.apache.commons.complex.util.FastMath;
-import org.apache.commons.complex.util.IntegerSequence;
-import org.apache.commons.complex.util.IntegerSequence.Range;
-import org.junit.Assert;
-import org.junit.Test;
-import org.junit.Assert;
-
-/**
- */
-public class ComplexUtilsTest {
-
-    private final double inf = Double.POSITIVE_INFINITY;
-    private final double negInf = Double.NEGATIVE_INFINITY;
-    private final double nan = Double.NaN;
-    private final double pi = FastMath.PI;
-
-    private final Complex negInfInf = new Complex(negInf, inf);
-    private final Complex infNegInf = new Complex(inf, negInf);
-    private final Complex infInf = new Complex(inf, inf);
-    private final Complex negInfNegInf = new Complex(negInf, negInf);
-    private final Complex infNaN = new Complex(inf, nan);
-
-    private static Complex c[]; // complex array with real values even and imag
-                                // values odd
-    private static Complex cr[]; // complex array with real values consecutive
-    private static Complex ci[]; // complex array with imag values consecutive
-    private static double d[]; // real array with consecutive vals
-    private static double di[]; // real array with consecutive vals,
-                                // 'interleaved' length
-    private static float f[]; // real array with consecutive vals
-    private static float fi[]; // real array with consec vals, interleaved
-                               // length
-    private static double sr[]; // real component of split array, evens
-    private static double si[]; // imag component of split array, odds
-    private static float sfr[]; // real component of split array, float, evens
-    private static float sfi[]; // imag component of split array, float, odds
-    static Complex ans1, ans2; // answers to single value extraction methods
-    static Range range1, range2; // ranges used to test with
-                                             // IntegerRange
-    static Complex[] ansArrayc1r, ansArrayc1i, ansArrayc2r, ansArrayc2i, ansArrayc3, ansArrayc4; // answers
-                                                                                                 // to
-                                                                                                 // range
-                                                                                                 // extraction
-                                                                                                 // methods
-    static double[] ansArrayd1r, ansArrayd2r, ansArrayd1i, ansArrayd2i, ansArraydi1, ansArraydi2;
-    static float[] ansArrayf1r, ansArrayf2r, ansArrayf1i, ansArrayf2i, ansArrayfi1, ansArrayfi2;
-    static String msg; // error message for AssertEquals
-    static Complex[][] c2d, cr2d, ci2d; // for 2d methods
-    static Complex[][][] c3d, cr3d, ci3d; // for 3d methods
-    static double[][] d2d, di2d, sr2d, si2d;
-    static double[][][] d3d, di3d, sr3d, si3d;
-    static float[][] f2d, fi2d, sfr2d, sfi2d;
-    static float[][][] f3d, fi3d, sfr3d, sfi3d;
-
-    private static void setArrays() { // initial setup method
-        c = new Complex[10];
-        cr = new Complex[10];
-        ci = new Complex[10];
-        d = new double[10];
-        f = new float[10];
-        di = new double[20];
-        fi = new float[20];
-        sr = new double[10];
-        si = new double[10];
-        sfr = new float[10];
-        sfi = new float[10];
-        c2d = new Complex[10][10];
-        cr2d = new Complex[10][10];
-        ci2d = new Complex[10][10];
-        c3d = new Complex[10][10][10];
-        cr3d = new Complex[10][10][10];
-        ci3d = new Complex[10][10][10];
-        d2d = new double[10][10];
-        d3d = new double[10][10][10];
-        f2d = new float[10][10];
-        f3d = new float[10][10][10];
-        sr2d = new double[10][10];
-        sr3d = new double[10][10][10];
-        si2d = new double[10][10];
-        si3d = new double[10][10][10];
-        sfr2d = new float[10][10];
-        sfr3d = new float[10][10][10];
-        sfi2d = new float[10][10];
-        sfi3d = new float[10][10][10];
-        di2d = new double[10][20];
-        di3d = new double[10][10][20];
-        fi2d = new float[10][20];
-        fi3d = new float[10][10][20];
-        range1 = IntegerSequence.range(3, 7);
-        range2 = IntegerSequence.range(3, 7, 2);
-        for (int i = 0; i < 20; i += 2) {
-            d[i / 2] = i / 2;
-            f[i / 2] = i / 2;
-            di[i] = i;
-            di[i + 1] = i + 1;
-            fi[i] = i;
-            fi[i + 1] = i + 1;
-            c[i / 2] = new Complex(i, i + 1);
-            cr[i / 2] = new Complex(i / 2);
-            ci[i / 2] = new Complex(0, i / 2);
-            sr[i / 2] = i;
-            si[i / 2] = i + 1;
-            sfr[i / 2] = i;
-            sfi[i / 2] = i + 1;
-        }
-        for (int i = 0; i < 10; i++) {
-            for (int j = 0; j < 20; j += 2) {
-                d2d[i][j / 2] = 10 * i + j / 2;
-                f2d[i][j / 2] = 10 * i + j / 2;
-                sr2d[i][j / 2] = 10 * i + j;
-                si2d[i][j / 2] = 10 * i + j + 1;
-                sfr2d[i][j / 2] = 10 * i + j;
-                sfi2d[i][j / 2] = 10 * i + j + 1;
-                di2d[i][j] = 10 * i + j;
-                di2d[i][j + 1] = 10 * i + j + 1;
-                fi2d[i][j] = 10 * i + j;
-                fi2d[i][j + 1] = 10 * i + j + 1;
-                c2d[i][j / 2] = new Complex(10 * i + j, 10 * i + j + 1);
-                cr2d[i][j / 2] = new Complex(10 * i + j / 2);
-                ci2d[i][j / 2] = new Complex(0, 10 * i + j / 2);
-            }
-        }
-        for (int i = 0; i < 10; i++) {
-            for (int j = 0; j < 10; j++) {
-                for (int k = 0; k < 20; k += 2) {
-                    d3d[i][j][k / 2] = 100 * i + 10 * j + k / 2;
-                    f3d[i][j][k / 2] = 100 * i + 10 * j + k / 2;
-                    sr3d[i][j][k / 2] = 100 * i + 10 * j + k;
-                    si3d[i][j][k / 2] = 100 * i + 10 * j + k + 1;
-                    sfr3d[i][j][k / 2] = 100 * i + 10 * j + k;
-                    sfi3d[i][j][k / 2] = 100 * i + 10 * j + k + 1;
-                    di3d[i][j][k] = 100 * i + 10 * j + k;
-                    di3d[i][j][k + 1] = 100 * i + 10 * j + k + 1;
-                    fi3d[i][j][k] = 100 * i + 10 * j + k;
-                    fi3d[i][j][k + 1] = 100 * i + 10 * j + k + 1;
-                    c3d[i][j][k / 2] = new Complex(100 * i + 10 * j + k, 100 * i + 10 * j + k + 1);
-                    cr3d[i][j][k / 2] = new Complex(100 * i + 10 * j + k / 2);
-                    ci3d[i][j][k / 2] = new Complex(0, 100 * i + 10 * j + k / 2);
-                }
-            }
-        }
-        ansArrayc1r = new Complex[] { new Complex(3), new Complex(4), new Complex(5), new Complex(6), new Complex(7) };
-        ansArrayc2r = new Complex[] { new Complex(3), new Complex(5), new Complex(7) };
-        ansArrayc1i = new Complex[] { new Complex(0, 3), new Complex(0, 4), new Complex(0, 5), new Complex(0, 6),
-                new Complex(0, 7) };
-        ansArrayc2i = new Complex[] { new Complex(0, 3), new Complex(0, 5), new Complex(0, 7) };
-        ansArrayc3 = new Complex[] { new Complex(6, 7), new Complex(8, 9), new Complex(10, 11), new Complex(12, 13),
-                new Complex(14, 15) };
-        ansArrayc4 = new Complex[] { new Complex(6, 7), new Complex(10, 11), new Complex(14, 15) };
-        ansArrayd1r = new double[] { 6, 8, 10, 12, 14 };
-        ansArrayd1i = new double[] { 7, 9, 11, 13, 15 };
-        ansArrayd2r = new double[] { 6, 10, 14 };
-        ansArrayd2i = new double[] { 7, 11, 15 };
-        ansArrayf1r = new float[] { 6, 8, 10, 12, 14 };
-        ansArrayf1i = new float[] { 7, 9, 11, 13, 15 };
-        ansArrayf2r = new float[] { 6, 10, 14 };
-        ansArrayf2i = new float[] { 7, 11, 15 };
-        ansArraydi1 = new double[] { 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
-        ansArrayfi1 = new float[] { 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
-        ansArraydi2 = new double[] { 6, 7, 10, 11, 14, 15 };
-        ansArrayfi2 = new float[] { 6, 7, 10, 11, 14, 15 };
-        msg = "";
-    }
-
-    @Test
-    public void testPolar2Complex() {
-        TestUtils.assertEquals(Complex.ONE, ComplexUtils.polar2Complex(1, 0), 10e-12);
-        TestUtils.assertEquals(Complex.ZERO, ComplexUtils.polar2Complex(0, 1), 10e-12);
-        TestUtils.assertEquals(Complex.ZERO, ComplexUtils.polar2Complex(0, -1), 10e-12);
-        TestUtils.assertEquals(Complex.I, ComplexUtils.polar2Complex(1, pi / 2), 10e-12);
-        TestUtils.assertEquals(Complex.I.negate(), ComplexUtils.polar2Complex(1, -pi / 2), 10e-12);
-        double r = 0;
-        for (int i = 0; i < 5; i++) {
-            r += i;
-            double theta = 0;
-            for (int j = 0; j < 20; j++) {
-                theta += pi / 6;
-                TestUtils.assertEquals(altPolar(r, theta), ComplexUtils.polar2Complex(r, theta), 10e-12);
-            }
-            theta = -2 * pi;
-            for (int j = 0; j < 20; j++) {
-                theta -= pi / 6;
-                TestUtils.assertEquals(altPolar(r, theta), ComplexUtils.polar2Complex(r, theta), 10e-12);
-            }
-        }
-    }
-
-    protected Complex altPolar(double r, double theta) {
-        return Complex.I.multiply(new Complex(theta, 0)).exp().multiply(new Complex(r, 0));
-    }
-
-    @Test(expected = MathIllegalArgumentException.class)
-    public void testPolar2ComplexIllegalModulus() {
-        ComplexUtils.polar2Complex(-1, 0);
-    }
-
-    @Test
-    public void testPolar2ComplexNaN() {
-        TestUtils.assertSame(Complex.NaN, ComplexUtils.polar2Complex(nan, 1));
-        TestUtils.assertSame(Complex.NaN, ComplexUtils.polar2Complex(1, nan));
-        TestUtils.assertSame(Complex.NaN, ComplexUtils.polar2Complex(nan, nan));
-    }
-
-    @Test
-    public void testPolar2ComplexInf() {
-        TestUtils.assertSame(Complex.NaN, ComplexUtils.polar2Complex(1, inf));
-        TestUtils.assertSame(Complex.NaN, ComplexUtils.polar2Complex(1, negInf));
-        TestUtils.assertSame(Complex.NaN, ComplexUtils.polar2Complex(inf, inf));
-        TestUtils.assertSame(Complex.NaN, ComplexUtils.polar2Complex(inf, negInf));
-        TestUtils.assertSame(infInf, ComplexUtils.polar2Complex(inf, pi / 4));
-        TestUtils.assertSame(infNaN, ComplexUtils.polar2Complex(inf, 0));
-        TestUtils.assertSame(infNegInf, ComplexUtils.polar2Complex(inf, -pi / 4));
-        TestUtils.assertSame(negInfInf, ComplexUtils.polar2Complex(inf, 3 * pi / 4));
-        TestUtils.assertSame(negInfNegInf, ComplexUtils.polar2Complex(inf, 5 * pi / 4));
-    }
-
-    @Test
-    public void testCExtract() {
-        final double[] real = new double[] { negInf, -123.45, 0, 1, 234.56, pi, inf };
-        final Complex[] complex = ComplexUtils.real2Complex(real);
-
-        for (int i = 0; i < real.length; i++) {
-            Assert.assertEquals(real[i], complex[i].getReal(), 0d);
-        }
-    }
-
-    // EXTRACTION METHODS
-
-    @Test
-    public void testExtractionMethods() {
-        setArrays();
-        // Extract complex from real double array, index 3
-        TestUtils.assertSame(new Complex(3), ComplexUtils.extractComplexFromRealArray(d, 3));
-        // Extract complex from real float array, index 3
-        TestUtils.assertSame(new Complex(3), ComplexUtils.extractComplexFromRealArray(f, 3));
-        // Extract real double from complex array, index 3
-        TestUtils.assertSame(6, ComplexUtils.extractRealFromComplexArray(c, 3));
-        // Extract real float from complex array, index 3
-        TestUtils.assertSame(6, ComplexUtils.extractRealFloatFromComplexArray(c, 3));
-        // Extract complex from interleaved double array, index 3
-        TestUtils.assertSame(new Complex(6, 7), ComplexUtils.extractComplexFromInterleavedArray(d, 3));
-        // Extract complex from interleaved float array, index 3
-        TestUtils.assertSame(new Complex(6, 7), ComplexUtils.extractComplexFromInterleavedArray(f, 3));
-        // Extract interleaved double from complex array, index 3
-        TestUtils.assertEquals(msg, new double[] { 6, 7 }, ComplexUtils.extractInterleavedFromComplexArray(c, 3),
-<<<<<<< HEAD
-                Math.ulp(1));
-        // Extract interleaved float from complex array, index 3
-        TestUtils.assertEquals(msg, new double[] { 6, 7 }, ComplexUtils.extractInterleavedFromComplexArray(c, 3),
-                Math.ulp(1));
-=======
-               Math.ulp(1.0));
-        // Extract interleaved float from complex array, index 3
-        TestUtils.assertEquals(msg, new double[] { 6, 7 }, ComplexUtils.extractInterleavedFromComplexArray(c, 3),
-               Math.ulp(1.0));
->>>>>>> 35ca5e10659d265613b4c3ed8a89f96ad6ce7ae7
-        if (!msg.equals("")) {
-            throw new RuntimeException(msg);
-        }
-    }
-    // REAL <-> COMPLEX
-
-    @Test
-    public void testRealToComplex() {
-        setArrays();
-        // Real double to complex, range 3-7, increment 1, entered as ints
-        TestUtils.assertEquals(msg, ansArrayc1r, ComplexUtils.real2Complex(d, 3, 7),Math.ulp(1.0));
-        // Real float to complex, range 3-7, increment 1, entered as ints
-        TestUtils.assertEquals(msg, ansArrayc1r, ComplexUtils.real2Complex(f, 3, 7),Math.ulp(1.0));
-        // Real double to complex, range 3-7, increment 2, entered as ints
-        TestUtils.assertEquals(msg, ansArrayc2r, ComplexUtils.real2Complex(d, 3, 7, 2),Math.ulp(1.0));
-        // Real float to complex, range 3-7, increment 2, entered as ints
-        TestUtils.assertEquals(msg, ansArrayc2r, ComplexUtils.real2Complex(f, 3, 7, 2),Math.ulp(1.0));
-        // Real double to complex, range 3-7, increment 1, using IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayc1r, ComplexUtils.real2Complex(d, range1),Math.ulp(1.0));
-        // Real float to complex, range 3-7, increment 1, using IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayc1r, ComplexUtils.real2Complex(f, range1),Math.ulp(1.0));
-        // Real double to complex, range 3-7, increment 2, using IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayc2r, ComplexUtils.real2Complex(d, 3, 7, 2),Math.ulp(1.0));
-        // Real float to complex, range 3-7, increment 2, using IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayc2r, ComplexUtils.real2Complex(f, 3, 7, 2),Math.ulp(1.0));
-        // Real double to complex, whole array
-        TestUtils.assertEquals(msg, cr, ComplexUtils.real2Complex(d),Math.ulp(1.0));
-        // Real float to complex, whole array
-        TestUtils.assertEquals(msg, cr, ComplexUtils.real2Complex(f),Math.ulp(1.0));
-        // 2d
-        for (int i = 0; i < 10; i++) {
-            // Real double to complex, 2d
-            TestUtils.assertEquals(msg, cr2d[i], ComplexUtils.real2Complex(d2d[i]),Math.ulp(1.0));
-            // Real float to complex, 2d
-            TestUtils.assertEquals(msg, cr2d[i], ComplexUtils.real2Complex(f2d[i]),Math.ulp(1.0));
-        }
-        // 3d
-        for (int i = 0; i < 10; i++) {
-            for (int j = 0; j < 10; j++) {
-                // Real double to complex, 3d
-                TestUtils.assertEquals(msg, cr3d[i][j], ComplexUtils.real2Complex(d3d[i][j]),Math.ulp(1.0));
-                // Real float to complex, 3d
-                TestUtils.assertEquals(msg, cr3d[i][j], ComplexUtils.real2Complex(f3d[i][j]),Math.ulp(1.0));
-            }
-        }
-        if (!msg.equals("")) {
-            throw new RuntimeException(msg);
-        }
-    }
-
-    @Test
-    public void testComplexToReal() {
-        setArrays();
-        // Real complex to double, range 3-7, increment 1, entered as ints
-        TestUtils.assertEquals(msg, ansArrayd1r, ComplexUtils.complex2Real(c, 3, 7),Math.ulp(1.0));
-        // Real complex to float, range 3-7, increment 1, entered as ints
-        TestUtils.assertEquals(msg, ansArrayf1r, ComplexUtils.complex2RealFloat(c, 3, 7),Math.ulp(1.0f));
-        // Real complex to double, range 3-7, increment 2, entered as ints
-        TestUtils.assertEquals(msg, ansArrayd2r, ComplexUtils.complex2Real(c, 3, 7, 2),Math.ulp(1.0));
-        // Real complex to float, range 3-7, increment 2, entered as ints
-        TestUtils.assertEquals(msg, ansArrayf2r, ComplexUtils.complex2RealFloat(c, 3, 7, 2),Math.ulp(1.0f));
-        // Real complex to double, range 3-7, increment 1, using IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayd1r, ComplexUtils.complex2Real(c, range1),Math.ulp(1.0));
-        // Real complex to float, range 3-7, increment 1, using IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayf1r, ComplexUtils.complex2RealFloat(c, range1),Math.ulp(1.0f));
-        // Real complex to double, range 3-7, increment 2, using IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayd2r, ComplexUtils.complex2Real(c, 3, 7, 2),Math.ulp(1.0));
-        // Real complex to float, range 3-7, increment 2, using IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayf2r, ComplexUtils.complex2RealFloat(c, 3, 7, 2),Math.ulp(1.0f));
-        // Real complex to double, whole array
-        TestUtils.assertEquals(msg, sr, ComplexUtils.complex2Real(c),Math.ulp(1.0));
-        // Real complex to float, whole array
-        TestUtils.assertEquals(msg, sfr, ComplexUtils.complex2RealFloat(c),Math.ulp(1.0f));
-        // 2d
-        for (int i = 0; i < 10; i++) {
-            // Real complex to double, 2d
-            TestUtils.assertEquals(msg, sr2d[i], ComplexUtils.complex2Real(c2d[i]),Math.ulp(1.0));
-            // Real complex to float, 2d
-            TestUtils.assertEquals(msg, sfr2d[i], ComplexUtils.complex2RealFloat(c2d[i]),Math.ulp(1.0f));
-        }
-        // 3d
-        for (int i = 0; i < 10; i++) {
-            for (int j = 0; j < 10; j++) {
-                // Real complex to double, 3d
-                TestUtils.assertEquals(msg, sr3d[i][j], ComplexUtils.complex2Real(c3d[i][j]),Math.ulp(1.0));
-                // Real complex to float, 3d
-                TestUtils.assertEquals(msg, sfr3d[i][j], ComplexUtils.complex2RealFloat(c3d[i][j]),Math.ulp(1.0f));
-            }
-        }
-        if (!msg.equals("")) {
-            throw new RuntimeException(msg);
-        }
-    }
-
-    // IMAGINARY <-> COMPLEX
-
-    @Test
-    public void testImaginaryToComplex() {
-        setArrays();
-        // Imaginary double to complex, range 3-7, increment 1, entered as ints
-        TestUtils.assertEquals(msg, ansArrayc1i, ComplexUtils.imaginary2Complex(d, 3, 7),Math.ulp(1.0));
-        // Imaginary float to complex, range 3-7, increment 1, entered as ints
-        TestUtils.assertEquals(msg, ansArrayc1i, ComplexUtils.imaginary2Complex(f, 3, 7),Math.ulp(1.0));
-        // Imaginary double to complex, range 3-7, increment 2, entered as ints
-        TestUtils.assertEquals(msg, ansArrayc2i, ComplexUtils.imaginary2Complex(d, 3, 7, 2),Math.ulp(1.0));
-        // Imaginary float to complex, range 3-7, increment 2, entered as ints
-        TestUtils.assertEquals(msg, ansArrayc2i, ComplexUtils.imaginary2Complex(f, 3, 7, 2),Math.ulp(1.0));
-        // Imaginary double to complex, range 3-7, increment 1, using
-        // IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayc1i, ComplexUtils.imaginary2Complex(d, range1),Math.ulp(1.0));
-        // Imaginary float to complex, range 3-7, increment 1, using
-        // IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayc1i, ComplexUtils.imaginary2Complex(f, range1),Math.ulp(1.0));
-        // Imaginary double to complex, range 3-7, increment 2, using
-        // IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayc2i, ComplexUtils.imaginary2Complex(d, 3, 7, 2),Math.ulp(1.0));
-        // Imaginary float to complex, range 3-7, increment 2, using
-        // IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayc2i, ComplexUtils.imaginary2Complex(f, 3, 7, 2),Math.ulp(1.0));
-        // Imaginary double to complex, whole array
-        TestUtils.assertEquals(msg, ci, ComplexUtils.imaginary2Complex(d),Math.ulp(1.0));
-        // Imaginary float to complex, whole array
-        TestUtils.assertEquals(msg, ci, ComplexUtils.imaginary2Complex(f),Math.ulp(1.0));
-        // 2d
-        for (int i = 0; i < 10; i++) {
-            // Imaginary double to complex, 2d
-            TestUtils.assertEquals(msg, ci2d[i], ComplexUtils.imaginary2Complex(d2d[i]),Math.ulp(1.0));
-            // Imaginary float to complex, 2d
-            TestUtils.assertEquals(msg, ci2d[i], ComplexUtils.imaginary2Complex(f2d[i]),Math.ulp(1.0));
-        }
-        // 3d
-        for (int i = 0; i < 10; i++) {
-            for (int j = 0; j < 10; j++) {
-                // Imaginary double to complex, 3d
-                TestUtils.assertEquals(msg, ci3d[i][j], ComplexUtils.imaginary2Complex(d3d[i][j]),Math.ulp(1.0));
-                // Imaginary float to complex, 3d
-                TestUtils.assertEquals(msg, ci3d[i][j], ComplexUtils.imaginary2Complex(f3d[i][j]),Math.ulp(1.0));
-            }
-        }
-        if (!msg.equals("")) {
-            throw new RuntimeException(msg);
-        }
-    }
-
-    @Test
-    public void testComplexToImaginary() {
-        setArrays();
-        // Imaginary complex to double, range 3-7, increment 1, entered as ints
-        TestUtils.assertEquals(msg, ansArrayd1i, ComplexUtils.complex2Imaginary(c, 3, 7),Math.ulp(1.0f));
-        // Imaginary complex to float, range 3-7, increment 1, entered as ints
-        TestUtils.assertEquals(msg, ansArrayf1i, ComplexUtils.complex2ImaginaryFloat(c, 3, 7),Math.ulp(1.0f));
-        // Imaginary complex to double, range 3-7, increment 2, entered as ints
-        TestUtils.assertEquals(msg, ansArrayd2i, ComplexUtils.complex2Imaginary(c, 3, 7, 2),Math.ulp(1.0));
-        // Imaginary complex to float, range 3-7, increment 2, entered as ints
-        TestUtils.assertEquals(msg, ansArrayf2i, ComplexUtils.complex2ImaginaryFloat(c, 3, 7, 2),Math.ulp(1.0f));
-        // Imaginary complex to double, range 3-7, increment 1, using
-        // IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayd1i, ComplexUtils.complex2Imaginary(c, range1),Math.ulp(1.0));
-        // Imaginary complex to float, range 3-7, increment 1, using
-        // IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayf1i, ComplexUtils.complex2ImaginaryFloat(c, range1),Math.ulp(1.0f));
-        // Imaginary complex to double, range 3-7, increment 2, using
-        // IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayd2i, ComplexUtils.complex2Imaginary(c, 3, 7, 2),Math.ulp(1.0));
-        // Imaginary complex to float, range 3-7, increment 2, using
-        // IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayf2i, ComplexUtils.complex2ImaginaryFloat(c, 3, 7, 2),Math.ulp(1.0f));
-        // Imaginary complex to double, whole array
-        TestUtils.assertEquals(msg, si, ComplexUtils.complex2Imaginary(c),Math.ulp(1.0));
-        // Imaginary complex to float, whole array
-        TestUtils.assertEquals(msg, sfi, ComplexUtils.complex2ImaginaryFloat(c),Math.ulp(1.0f));
-        // 2d
-        for (int i = 0; i < 10; i++) {
-            // Imaginary complex to double, 2d
-            TestUtils.assertEquals(msg, si2d[i], ComplexUtils.complex2Imaginary(c2d[i]),Math.ulp(1.0));
-            // Imaginary complex to float, 2d
-            TestUtils.assertEquals(msg, sfi2d[i], ComplexUtils.complex2ImaginaryFloat(c2d[i]),Math.ulp(1.0f));
-        }
-        // 3d
-        for (int i = 0; i < 10; i++) {
-            for (int j = 0; j < 10; j++) {
-                // Imaginary complex to double, 3d
-                TestUtils.assertEquals(msg, si3d[i][j], ComplexUtils.complex2Imaginary(c3d[i][j]),Math.ulp(1.0));
-                // Imaginary complex to float, 3d
-                TestUtils.assertEquals(msg, sfi3d[i][j], ComplexUtils.complex2ImaginaryFloat(c3d[i][j]),Math.ulp(1.0f));
-            }
-        }
-        if (!msg.equals("")) {
-            throw new RuntimeException(msg);
-        }
-    }
-
-    // INTERLEAVED <-> COMPLEX
-
-    @Test
-    public void testInterleavedToComplex() {
-        setArrays();
-        // Interleaved double to complex, range 3-7, increment 1, entered as
-        // ints
-        TestUtils.assertEquals(msg, ansArrayc3, ComplexUtils.interleaved2Complex(di, 3, 7),Math.ulp(1.0));
-        // Interleaved float to complex, range 3-7, increment 1, entered as ints
-        TestUtils.assertEquals(msg, ansArrayc3, ComplexUtils.interleaved2Complex(fi, 3, 7),Math.ulp(1.0));
-        // Interleaved double to complex, range 3-7, increment 2, entered as
-        // ints
-        TestUtils.assertEquals(msg, ansArrayc4, ComplexUtils.interleaved2Complex(di, 3, 7, 2),Math.ulp(1.0));
-        // Interleaved float to complex, range 3-7, increment 2, entered as ints
-        TestUtils.assertEquals(msg, ansArrayc4, ComplexUtils.interleaved2Complex(fi, 3, 7, 2),Math.ulp(1.0));
-        // Interleaved double to complex, range 3-7, increment 1, using
-        // IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayc3, ComplexUtils.interleaved2Complex(di, range1),Math.ulp(1.0));
-        // Interleaved float to complex, range 3-7, increment 1, using
-        // IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayc3, ComplexUtils.interleaved2Complex(fi, range1),Math.ulp(1.0));
-        // Interleaved double to complex, range 3-7, increment 2, using
-        // IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayc4, ComplexUtils.interleaved2Complex(di, 3, 7, 2),Math.ulp(1.0));
-        // Interleaved float to complex, range 3-7, increment 2, using
-        // IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayc4, ComplexUtils.interleaved2Complex(fi, 3, 7, 2),Math.ulp(1.0));
-        // Interleaved double to complex, whole array
-        TestUtils.assertEquals(msg, c, ComplexUtils.interleaved2Complex(di),Math.ulp(1.0));
-        // Interleaved float to complex, whole array
-        TestUtils.assertEquals(msg, c, ComplexUtils.interleaved2Complex(fi),Math.ulp(1.0));
-        // 2d
-        for (int i = 0; i < 10; i++) {
-            // Interleaved double to complex, 2d
-            TestUtils.assertEquals(msg, c2d[i], ComplexUtils.interleaved2Complex(di2d[i]),Math.ulp(1.0));
-            // Interleaved float to complex, 2d
-            TestUtils.assertEquals(msg, c2d[i], ComplexUtils.interleaved2Complex(fi2d[i]),Math.ulp(1.0));
-        }
-        // 3d
-        for (int i = 0; i < 10; i++) {
-            for (int j = 0; j < 10; j++) {
-                // Interleaved double to complex, 3d
-                TestUtils.assertEquals(msg, c3d[i][j], ComplexUtils.interleaved2Complex(di3d[i][j]),Math.ulp(1.0));
-                // Interleaved float to complex, 3d
-                TestUtils.assertEquals(msg, c3d[i][j], ComplexUtils.interleaved2Complex(fi3d[i][j]),Math.ulp(1.0));
-            }
-        }
-        if (!msg.equals("")) {
-            throw new RuntimeException(msg);
-        }
-    }
-
-    @Test
-    public void testComplexToInterleaved() {
-        setArrays();
-        // Interleaved complex to double, range 3-7, increment 1, entered as
-        // ints
-        TestUtils.assertEquals(msg, ansArraydi1, ComplexUtils.complex2Interleaved(c, 3, 7),Math.ulp(1.0));
-        // Interleaved complex to float, range 3-7, increment 1, entered as ints
-        TestUtils.assertEquals(msg, ansArrayfi1, ComplexUtils.complex2InterleavedFloat(c, 3, 7),Math.ulp(1.0f));
-        // Interleaved complex to double, range 3-7, increment 2, entered as
-        // ints
-        TestUtils.assertEquals(msg, ansArraydi2, ComplexUtils.complex2Interleaved(c, 3, 7, 2),Math.ulp(1.0));
-        // Interleaved complex to float, range 3-7, increment 2, entered as ints
-        TestUtils.assertEquals(msg, ansArrayfi2, ComplexUtils.complex2InterleavedFloat(c, 3, 7, 2),Math.ulp(1.0f));
-        // Interleaved complex to double, range 3-7, increment 1, using
-        // IntegerSequence
-        TestUtils.assertEquals(msg, ansArraydi1, ComplexUtils.complex2Interleaved(c, range1),Math.ulp(1.0));
-        // Interleaved complex to float, range 3-7, increment 1, using
-        // IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayfi1, ComplexUtils.complex2InterleavedFloat(c, range1),Math.ulp(1.0f));
-        // Interleaved complex to double, range 3-7, increment 2, using
-        // IntegerSequence
-        TestUtils.assertEquals(msg, ansArraydi2, ComplexUtils.complex2Interleaved(c, 3, 7, 2),Math.ulp(1.0));
-        // Interleaved complex to float, range 3-7, increment 2, using
-        // IntegerSequence
-        TestUtils.assertEquals(msg, ansArrayfi2, ComplexUtils.complex2InterleavedFloat(c, 3, 7, 2),Math.ulp(1.0f));
-        // Interleaved complex to double, whole array
-        TestUtils.assertEquals(msg, di, ComplexUtils.complex2Interleaved(c),Math.ulp(1.0));
-        // Interleaved complex to float, whole array
-        TestUtils.assertEquals(msg, fi, ComplexUtils.complex2InterleavedFloat(c),Math.ulp(1.0f));
-        // 2d
-        for (int i = 0; i < 10; i++) {
-            // Interleaved complex to double, 2d
-            TestUtils.assertEquals(msg, di2d[i], ComplexUtils.complex2Interleaved(c2d[i]),Math.ulp(1.0));
-            // Interleaved complex to float, 2d
-            TestUtils.assertEquals(msg, fi2d[i], ComplexUtils.complex2InterleavedFloat(c2d[i]),Math.ulp(1.0f));
-        }
-        // 3d
-        for (int i = 0; i < 10; i++) {
-            for (int j = 0; j < 10; j++) {
-                // Interleaved complex to double, 3d
-                TestUtils.assertEquals(msg, di3d[i][j], ComplexUtils.complex2Interleaved(c3d[i][j]),Math.ulp(1.0));
-                // Interleaved complex to float, 3d
-                TestUtils.assertEquals(msg, fi3d[i][j], ComplexUtils.complex2InterleavedFloat(c3d[i][j]),Math.ulp(1.0f));
-            }
-        }
-        if (!msg.equals("")) {
-            throw new RuntimeException(msg);
-        }
-    }
-
-    // SPLIT TO COMPLEX
-    @Test
-    public void testSplit2Complex() {
-        setArrays();
-        // Split double to complex, whole array
-        TestUtils.assertEquals(msg, c, ComplexUtils.split2Complex(sr, si),Math.ulp(1.0));
-
-        // 2d
-        for (int i = 0; i < 10; i++) {
-            // Split double to complex, 2d
-            TestUtils.assertEquals(msg, c2d[i], ComplexUtils.split2Complex(sr2d[i], si2d[i]),Math.ulp(1.0));
-        }
-        // 3d
-        for (int i = 0; i < 10; i++) {
-            for (int j = 0; j < 10; j++) {
-                // Split double to complex, 3d
-                TestUtils.assertEquals(msg, c3d[i][j], ComplexUtils.split2Complex(sr3d[i][j], si3d[i][j]),Math.ulp(1.0));
-            }
-        }
-        if (!msg.equals("")) {
-            throw new RuntimeException(msg);
-        }
-    }
-
-    // INITIALIZATION METHODS
-
-    @Test
-    public void testInitialize() {
-        Complex[] c = new Complex[10];
-        ComplexUtils.initialize(c);
-        for (Complex cc : c) {
-            TestUtils.assertEquals(new Complex(0, 0), cc, Math.ulp(0));
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/a752ab8d/src/test/java/org/apache/commons/complex/FrenchComplexFormatTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/complex/FrenchComplexFormatTest.java b/src/test/java/org/apache/commons/complex/FrenchComplexFormatTest.java
deleted file mode 100644
index 5be32b8..0000000
--- a/src/test/java/org/apache/commons/complex/FrenchComplexFormatTest.java
+++ /dev/null
@@ -1,34 +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.complex;
-
-import java.util.Locale;
-
-
-public class FrenchComplexFormatTest extends ComplexFormatAbstractTest {
-
-    @Override
-    protected char getDecimalCharacter() {
-        return ',';
-    }
-
-    @Override
-    protected Locale getLocale() {
-        return Locale.FRENCH;
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/a752ab8d/src/test/java/org/apache/commons/complex/QuaternionTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/complex/QuaternionTest.java b/src/test/java/org/apache/commons/complex/QuaternionTest.java
deleted file mode 100644
index 07941f2..0000000
--- a/src/test/java/org/apache/commons/complex/QuaternionTest.java
+++ /dev/null
@@ -1,459 +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.complex;
-
-import java.util.Random;
-
-import org.apache.commons.complex.Quaternion;
-import org.junit.Test;
-import org.junit.Assert;
-
-public class QuaternionTest {
-    /** Epsilon for double comparison. */
-    private static final double EPS = Math.ulp(1d);
-    /** Epsilon for double comparison. */
-    private static final double COMPARISON_EPS = 1e-14;
-
-    @Test
-    public final void testAccessors1() {
-        final double q0 = 2;
-        final double q1 = 5.4;
-        final double q2 = 17;
-        final double q3 = 0.0005;
-        final Quaternion q = new Quaternion(q0, q1, q2, q3);
-
-        Assert.assertEquals(q0, q.getQ0(), 0);
-        Assert.assertEquals(q1, q.getQ1(), 0);
-        Assert.assertEquals(q2, q.getQ2(), 0);
-        Assert.assertEquals(q3, q.getQ3(), 0);
-    }
-
-    @Test
-    public final void testAccessors2() {
-        final double q0 = 2;
-        final double q1 = 5.4;
-        final double q2 = 17;
-        final double q3 = 0.0005;
-        final Quaternion q = new Quaternion(q0, q1, q2, q3);
-
-        final double sP = q.getScalarPart();
-        final double[] vP = q.getVectorPart();
-
-        Assert.assertEquals(q0, sP, 0);
-        Assert.assertEquals(q1, vP[0], 0);
-        Assert.assertEquals(q2, vP[1], 0);
-        Assert.assertEquals(q3, vP[2], 0);
-    }
-
-    @Test
-    public final void testAccessors3() {
-        final double q0 = 2;
-        final double q1 = 5.4;
-        final double q2 = 17;
-        final double q3 = 0.0005;
-        final Quaternion q = new Quaternion(q0, new double[] { q1, q2, q3 });
-
-        final double sP = q.getScalarPart();
-        final double[] vP = q.getVectorPart();
-
-        Assert.assertEquals(q0, sP, 0);
-        Assert.assertEquals(q1, vP[0], 0);
-        Assert.assertEquals(q2, vP[1], 0);
-        Assert.assertEquals(q3, vP[2], 0);
-    }
-
-    @Test(expected=IllegalArgumentException.class)
-    public void testWrongDimension() {
-        new Quaternion(new double[] { 1, 2 });
-    }
-
-    @Test
-    public final void testConjugate() {
-        final double q0 = 2;
-        final double q1 = 5.4;
-        final double q2 = 17;
-        final double q3 = 0.0005;
-        final Quaternion q = new Quaternion(q0, q1, q2, q3);
-
-        final Quaternion qConjugate = q.getConjugate();
-
-        Assert.assertEquals(q0, qConjugate.getQ0(), 0);
-        Assert.assertEquals(-q1, qConjugate.getQ1(), 0);
-        Assert.assertEquals(-q2, qConjugate.getQ2(), 0);
-        Assert.assertEquals(-q3, qConjugate.getQ3(), 0);
-    }
-
-    /* suppressed for initial compatibility in commons-complex
-
-
-
-    @Test
-    public final void testProductQuaternionQuaternion() {
-
-        // Case : analytic test case
-
-        final Quaternion qA = new Quaternion(1, 0.5, -3, 4);
-        final Quaternion qB = new Quaternion(6, 2, 1, -9);
-        final Quaternion qResult = Quaternion.multiply(qA, qB);
-
-        Assert.assertEquals(44, qResult.getQ0(), EPS);
-        Assert.assertEquals(28, qResult.getQ1(), EPS);
-        Assert.assertEquals(-4.5, qResult.getQ2(), EPS);
-        Assert.assertEquals(21.5, qResult.getQ3(), EPS);
-
-        // comparison with the result given by the formula :
-        // qResult = (scalarA * scalarB - vectorA . vectorB) + (scalarA * vectorB + scalarB * vectorA + vectorA ^
-        // vectorB)
-
-        final Vector3D vectorA = new Vector3D(qA.getVectorPart());
-        final Vector3D vectorB = new Vector3D(qB.getVectorPart());
-        final Vector3D vectorResult = new Vector3D(qResult.getVectorPart());
-
-        final double scalarPartRef = qA.getScalarPart() * qB.getScalarPart() - Vector3D.dotProduct(vectorA, vectorB);
-
-        Assert.assertEquals(scalarPartRef, qResult.getScalarPart(), EPS);
-
-        final Vector3D vectorPartRef = ((vectorA.scalarMultiply(qB.getScalarPart())).add(vectorB.scalarMultiply(qA
-                .getScalarPart()))).add(Vector3D.crossProduct(vectorA, vectorB));
-        final double norm = (vectorResult.subtract(vectorPartRef)).getNorm();
-
-        Assert.assertEquals(0, norm, EPS);
-
-        // Conjugate of the product of two quaternions and product of their conjugates :
-        // Conj(qA * qB) = Conj(qB) * Conj(qA)
-
-        final Quaternion conjugateOfProduct = qB.getConjugate().multiply(qA.getConjugate());
-        final Quaternion productOfConjugate = (qA.multiply(qB)).getConjugate();
-
-        Assert.assertEquals(conjugateOfProduct.getQ0(), productOfConjugate.getQ0(), EPS);
-        Assert.assertEquals(conjugateOfProduct.getQ1(), productOfConjugate.getQ1(), EPS);
-        Assert.assertEquals(conjugateOfProduct.getQ2(), productOfConjugate.getQ2(), EPS);
-        Assert.assertEquals(conjugateOfProduct.getQ3(), productOfConjugate.getQ3(), EPS);
-    }
-*/
-    /*
-    @Test
-    public final void testProductQuaternionVector() {
-
-        // Case : Product between a vector and a quaternion : QxV
-
-        final Quaternion quaternion = new Quaternion(4, 7, -1, 2);
-        final double[] vector = {2.0, 1.0, 3.0};
-        final Quaternion qResultQxV = Quaternion.multiply(quaternion, new Quaternion(vector));
-
-        Assert.assertEquals(-19, qResultQxV.getQ0(), EPS);
-        Assert.assertEquals(3, qResultQxV.getQ1(), EPS);
-        Assert.assertEquals(-13, qResultQxV.getQ2(), EPS);
-        Assert.assertEquals(21, qResultQxV.getQ3(), EPS);
-
-        // comparison with the result given by the formula :
-        // qResult = (- vectorQ . vector) + (scalarQ * vector + vectorQ ^ vector)
-
-        final double[] vectorQ = quaternion.getVectorPart();
-        final double[] vectorResultQxV = qResultQxV.getVectorPart();
-
-        final double scalarPartRefQxV = -Vector3D.dotProduct(new Vector3D(vectorQ), new Vector3D(vector));
-        Assert.assertEquals(scalarPartRefQxV, qResultQxV.getScalarPart(), EPS);
-
-        final Vector3D vectorPartRefQxV = (new Vector3D(vector).scalarMultiply(quaternion.getScalarPart())).add(Vector3D
-                .crossProduct(new Vector3D(vectorQ), new Vector3D(vector)));
-        final double normQxV = (new Vector3D(vectorResultQxV).subtract(vectorPartRefQxV)).getNorm();
-        Assert.assertEquals(0, normQxV, EPS);
-
-        // Case : Product between a vector and a quaternion : VxQ
-
-        final Quaternion qResultVxQ = Quaternion.multiply(new Quaternion(vector), quaternion);
-
-        Assert.assertEquals(-19, qResultVxQ.getQ0(), EPS);
-        Assert.assertEquals(13, qResultVxQ.getQ1(), EPS);
-        Assert.assertEquals(21, qResultVxQ.getQ2(), EPS);
-        Assert.assertEquals(3, qResultVxQ.getQ3(), EPS);
-
-        final double[] vectorResultVxQ = qResultVxQ.getVectorPart();
-
-        // comparison with the result given by the formula :
-        // qResult = (- vector . vectorQ) + (scalarQ * vector + vector ^ vectorQ)
-
-        final double scalarPartRefVxQ = -Vector3D.dotProduct(new Vector3D(vectorQ), new Vector3D(vector));
-        Assert.assertEquals(scalarPartRefVxQ, qResultVxQ.getScalarPart(), EPS);
-
-        final Vector3D vectorPartRefVxQ = (new Vector3D(vector).scalarMultiply(quaternion.getScalarPart())).add(Vector3D
-                .crossProduct(new Vector3D(vector), new Vector3D(vectorQ)));
-        final double normVxQ = (new Vector3D(vectorResultVxQ).subtract(vectorPartRefVxQ)).getNorm();
-        Assert.assertEquals(0, normVxQ, EPS);
-    }
-*/
-    @Test
-    public final void testDotProductQuaternionQuaternion() {
-        // expected output
-        final double expected = -6.;
-        // inputs
-        final Quaternion q1 = new Quaternion(1, 2, 2, 1);
-        final Quaternion q2 = new Quaternion(3, -2, -1, -3);
-
-        final double actual1 = Quaternion.dotProduct(q1, q2);
-        final double actual2 = q1.dotProduct(q2);
-
-        Assert.assertEquals(expected, actual1, EPS);
-        Assert.assertEquals(expected, actual2, EPS);
-    }
-
-    @Test
-    public final void testScalarMultiplyDouble() {
-        // expected outputs
-        final double w = 1.6;
-        final double x = -4.8;
-        final double y = 11.20;
-        final double z = 2.56;
-        // inputs
-        final Quaternion q1 = new Quaternion(0.5, -1.5, 3.5, 0.8);
-        final double a = 3.2;
-
-        final Quaternion q = q1.multiply(a);
-
-        Assert.assertEquals(w, q.getQ0(), COMPARISON_EPS);
-        Assert.assertEquals(x, q.getQ1(), COMPARISON_EPS);
-        Assert.assertEquals(y, q.getQ2(), COMPARISON_EPS);
-        Assert.assertEquals(z, q.getQ3(), COMPARISON_EPS);
-    }
-
-    @Test
-    public final void testAddQuaternionQuaternion() {
-        // expected outputs
-        final double w = 4;
-        final double x = -1;
-        final double y = 2;
-        final double z = -4;
-        // inputs
-        final Quaternion q1 = new Quaternion(1., 2., -2., -1.);
-        final Quaternion q2 = new Quaternion(3., -3., 4., -3.);
-
-        final Quaternion qa = Quaternion.add(q1, q2);
-        final Quaternion qb = q1.add(q2);
-
-        Assert.assertEquals(w, qa.getQ0(), EPS);
-        Assert.assertEquals(x, qa.getQ1(), EPS);
-        Assert.assertEquals(y, qa.getQ2(), EPS);
-        Assert.assertEquals(z, qa.getQ3(), EPS);
-
-        Assert.assertEquals(w, qb.getQ0(), EPS);
-        Assert.assertEquals(x, qb.getQ1(), EPS);
-        Assert.assertEquals(y, qb.getQ2(), EPS);
-        Assert.assertEquals(z, qb.getQ3(), EPS);
-    }
-
-    @Test
-    public final void testSubtractQuaternionQuaternion() {
-        // expected outputs
-        final double w = -2.;
-        final double x = 5.;
-        final double y = -6.;
-        final double z = 2.;
-        // inputs
-        final Quaternion q1 = new Quaternion(1., 2., -2., -1.);
-        final Quaternion q2 = new Quaternion(3., -3., 4., -3.);
-
-        final Quaternion qa = Quaternion.subtract(q1, q2);
-        final Quaternion qb = q1.subtract(q2);
-
-        Assert.assertEquals(w, qa.getQ0(), EPS);
-        Assert.assertEquals(x, qa.getQ1(), EPS);
-        Assert.assertEquals(y, qa.getQ2(), EPS);
-        Assert.assertEquals(z, qa.getQ3(), EPS);
-
-        Assert.assertEquals(w, qb.getQ0(), EPS);
-        Assert.assertEquals(x, qb.getQ1(), EPS);
-        Assert.assertEquals(y, qb.getQ2(), EPS);
-        Assert.assertEquals(z, qb.getQ3(), EPS);
-}
-
-    @Test
-    public final void testNorm() {
-
-        final double q0 = 2;
-        final double q1 = 1;
-        final double q2 = -4;
-        final double q3 = 3;
-        final Quaternion q = new Quaternion(q0, q1, q2, q3);
-
-        final double norm = q.getNorm();
-
-        Assert.assertEquals(Math.sqrt(30), norm, 0);
-
-        final double normSquareRef = Quaternion.multiply(q, q.getConjugate()).getScalarPart();
-        Assert.assertEquals(Math.sqrt(normSquareRef), norm, 0);
-    }
-
-    @Test
-    public final void testNormalize() {
-
-        final Quaternion q = new Quaternion(2, 1, -4, -2);
-
-        final Quaternion versor = q.normalize();
-
-        Assert.assertEquals(2.0 / 5.0, versor.getQ0(), 0);
-        Assert.assertEquals(1.0 / 5.0, versor.getQ1(), 0);
-        Assert.assertEquals(-4.0 / 5.0, versor.getQ2(), 0);
-        Assert.assertEquals(-2.0 / 5.0, versor.getQ3(), 0);
-
-        Assert.assertEquals(1, versor.getNorm(), 0);
-    }
-
-    @Test(expected=IllegalStateException.class)
-    public final void testNormalizeFail() {
-        final Quaternion zeroQ = new Quaternion(0, 0, 0, 0);
-        zeroQ.normalize();
-    }
-
-    @Test
-    public final void testObjectEquals() {
-        final double one = 1;
-        final Quaternion q1 = new Quaternion(one, one, one, one);
-        Assert.assertTrue(q1.equals(q1));
-
-        final Quaternion q2 = new Quaternion(one, one, one, one);
-        Assert.assertTrue(q2.equals(q1));
-
-        final Quaternion q3 = new Quaternion(one, Math.nextUp(one), one, one);
-        Assert.assertFalse(q3.equals(q1));
-    }
-
-    @Test
-    public final void testQuaternionEquals() {
-        final double inc = 1e-5;
-        final Quaternion q1 = new Quaternion(2, 1, -4, -2);
-        final Quaternion q2 = new Quaternion(q1.getQ0() + inc, q1.getQ1(), q1.getQ2(), q1.getQ3());
-        final Quaternion q3 = new Quaternion(q1.getQ0(), q1.getQ1() + inc, q1.getQ2(), q1.getQ3());
-        final Quaternion q4 = new Quaternion(q1.getQ0(), q1.getQ1(), q1.getQ2() + inc, q1.getQ3());
-        final Quaternion q5 = new Quaternion(q1.getQ0(), q1.getQ1(), q1.getQ2(), q1.getQ3() + inc);
-
-        Assert.assertFalse(q1.equals(q2, 0.9 * inc));
-        Assert.assertFalse(q1.equals(q3, 0.9 * inc));
-        Assert.assertFalse(q1.equals(q4, 0.9 * inc));
-        Assert.assertFalse(q1.equals(q5, 0.9 * inc));
-
-        Assert.assertTrue(q1.equals(q2, 1.1 * inc));
-        Assert.assertTrue(q1.equals(q3, 1.1 * inc));
-        Assert.assertTrue(q1.equals(q4, 1.1 * inc));
-        Assert.assertTrue(q1.equals(q5, 1.1 * inc));
-    }
-
-    @Test
-    public final void testQuaternionEquals2() {
-        final Quaternion q1 = new Quaternion(1, 4, 2, 3);
-        final double gap = 1e-5;
-        final Quaternion q2 = new Quaternion(1 + gap, 4 + gap, 2 + gap, 3 + gap);
-
-        Assert.assertTrue(q1.equals(q2, 10 * gap));
-        Assert.assertFalse(q1.equals(q2, gap));
-        Assert.assertFalse(q1.equals(q2, gap / 10));
-    }
-
-    @Test
-    public final void testIsUnitQuaternion() {
-        final Random r = new Random(48);
-        final int numberOfTrials = 1000;
-        for (int i = 0; i < numberOfTrials; i++) {
-            final Quaternion q1 = new Quaternion(r.nextDouble(), r.nextDouble(), r.nextDouble(), r.nextDouble());
-            final Quaternion q2 = q1.normalize();
-            Assert.assertTrue(q2.isUnitQuaternion(COMPARISON_EPS));
-        }
-
-        final Quaternion q = new Quaternion(1, 1, 1, 1);
-        Assert.assertFalse(q.isUnitQuaternion(COMPARISON_EPS));
-    }
-
-    @Test
-    public final void testIsPureQuaternion() {
-        final Quaternion q1 = new Quaternion(0, 5, 4, 8);
-        Assert.assertTrue(q1.isPureQuaternion(EPS));
-
-        final Quaternion q2 = new Quaternion(0 - EPS, 5, 4, 8);
-        Assert.assertTrue(q2.isPureQuaternion(EPS));
-
-        final Quaternion q3 = new Quaternion(0 - 1.1 * EPS, 5, 4, 8);
-        Assert.assertFalse(q3.isPureQuaternion(EPS));
-
-        final Random r = new Random(48);
-        final double[] v = {r.nextDouble(), r.nextDouble(), r.nextDouble()};
-        final Quaternion q4 = new Quaternion(v);
-        Assert.assertTrue(q4.isPureQuaternion(0));
-
-        final Quaternion q5 = new Quaternion(0, v);
-        Assert.assertTrue(q5.isPureQuaternion(0));
-    }
-
-    /*
-    @Test
-    public final void testPolarForm() {
-        final Random r = new Random(48);
-        final int numberOfTrials = 1000;
-        for (int i = 0; i < numberOfTrials; i++) {
-            final Quaternion q = new Quaternion(2 * (r.nextDouble() - 0.5), 2 * (r.nextDouble() - 0.5),
-                                                2 * (r.nextDouble() - 0.5), 2 * (r.nextDouble() - 0.5));
-            final Quaternion qP = q.getPositivePolarForm();
-
-            Assert.assertTrue(qP.isUnitQuaternion(COMPARISON_EPS));
-            Assert.assertTrue(qP.getQ0() >= 0);
-
-            final Rotation rot = new Rotation(q.getQ0(), q.getQ1(), q.getQ2(), q.getQ3(), true);
-            final Rotation rotP = new Rotation(qP.getQ0(), qP.getQ1(), qP.getQ2(), qP.getQ3(), true);
-
-            Assert.assertEquals(rot.getAngle(), rotP.getAngle(), COMPARISON_EPS);
-            Assert.assertEquals(rot.getAxis(RotationConvention.VECTOR_OPERATOR).getX(),
-                                rot.getAxis(RotationConvention.VECTOR_OPERATOR).getX(),
-                                COMPARISON_EPS);
-            Assert.assertEquals(rot.getAxis(RotationConvention.VECTOR_OPERATOR).getY(),
-                                rot.getAxis(RotationConvention.VECTOR_OPERATOR).getY(),
-                                COMPARISON_EPS);
-            Assert.assertEquals(rot.getAxis(RotationConvention.VECTOR_OPERATOR).getZ(),
-                                rot.getAxis(RotationConvention.VECTOR_OPERATOR).getZ(),
-                                COMPARISON_EPS);
-        }
-    }
-*/
-    @Test
-    public final void testGetInverse() {
-        final Quaternion q = new Quaternion(1.5, 4, 2, -2.5);
-
-        final Quaternion inverseQ = q.getInverse();
-        Assert.assertEquals(1.5 / 28.5, inverseQ.getQ0(), 0);
-        Assert.assertEquals(-4.0 / 28.5, inverseQ.getQ1(), 0);
-        Assert.assertEquals(-2.0 / 28.5, inverseQ.getQ2(), 0);
-        Assert.assertEquals(2.5 / 28.5, inverseQ.getQ3(), 0);
-
-        final Quaternion product = Quaternion.multiply(inverseQ, q);
-        Assert.assertEquals(1, product.getQ0(), EPS);
-        Assert.assertEquals(0, product.getQ1(), EPS);
-        Assert.assertEquals(0, product.getQ2(), EPS);
-        Assert.assertEquals(0, product.getQ3(), EPS);
-
-        final Quaternion qNul = new Quaternion(0, 0, 0, 0);
-        try {
-            final Quaternion inverseQNul = qNul.getInverse();
-            Assert.fail("expecting ZeroException but got : " + inverseQNul);
-        } catch (IllegalStateException ex) {
-            // expected
-        }
-    }
-
-    @Test
-    public final void testToString() {
-        final Quaternion q = new Quaternion(1, 2, 3, 4);
-        Assert.assertTrue(q.toString().equals("[1.0 2.0 3.0 4.0]"));
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/a752ab8d/src/test/java/org/apache/commons/complex/Retry.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/complex/Retry.java b/src/test/java/org/apache/commons/complex/Retry.java
deleted file mode 100644
index fd96a24..0000000
--- a/src/test/java/org/apache/commons/complex/Retry.java
+++ /dev/null
@@ -1,29 +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.complex;
-
-import java.lang.annotation.*;
-
-/**
- * Annotation that enables test retries.
- */
-@Retention(RetentionPolicy.RUNTIME)
-@Target({ElementType.METHOD})
-public @interface Retry {
-    int value() default 2;
-}

http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/a752ab8d/src/test/java/org/apache/commons/complex/RetryRunner.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/complex/RetryRunner.java b/src/test/java/org/apache/commons/complex/RetryRunner.java
deleted file mode 100644
index 54a523b..0000000
--- a/src/test/java/org/apache/commons/complex/RetryRunner.java
+++ /dev/null
@@ -1,81 +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.complex;
-
-import org.junit.runners.BlockJUnit4ClassRunner;
-import org.junit.runners.model.FrameworkMethod;
-import org.junit.runners.model.InitializationError;
-import org.junit.runners.model.Statement;
-
-
-/**
- * A test runner that retries tests when assertions fail.
- */
-public class RetryRunner extends BlockJUnit4ClassRunner {
-    /**
-     * Simple constructor.
-     *
-     * @param testClass Class to test.
-     * @throws InitializationError if default runner cannot be built.
-     */
-    public RetryRunner(final Class<?> testClass)
-        throws InitializationError {
-        super(testClass);
-    }
-
-    @Override
-    public Statement methodInvoker(final FrameworkMethod method,
-                                   Object test) {
-        final Statement singleTryStatement = super.methodInvoker(method, test);
-        return new Statement() {
-            /**
-             * Evaluate the statement.
-             * We attempt several runs for the test, at most MAX_ATTEMPTS.
-             * if one attempt succeeds, we succeed, if all attempts fail, we
-             * fail with the reason corresponding to the last attempt
-             */
-            @Override
-            public void evaluate() throws Throwable {
-                Throwable failureReason = null;
-
-                final Retry retry = method.getAnnotation(Retry.class);
-                if (retry == null) {
-                    // Do a single test run attempt.
-                    singleTryStatement.evaluate();
-                } else {
-                    final int numRetries = retry.value();
-
-                    for (int i = 0; i < numRetries; ++i) {
-                        try {
-                            // Do a single test run attempt.
-                            singleTryStatement.evaluate();
-                            // Attempt succeeded, stop evaluation here.
-                            return;
-                        } catch (Throwable t) {
-                            // Attempt failed, store the reason.
-                            failureReason = t;
-                        }
-                    }
-
-                    // All attempts failed.
-                    throw failureReason;
-                }
-            }
-        };
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/a752ab8d/src/test/java/org/apache/commons/complex/RetryRunnerTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/complex/RetryRunnerTest.java b/src/test/java/org/apache/commons/complex/RetryRunnerTest.java
deleted file mode 100644
index 87d76ad..0000000
--- a/src/test/java/org/apache/commons/complex/RetryRunnerTest.java
+++ /dev/null
@@ -1,53 +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.complex;
-
-import java.util.Random;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-/**
- * Test for the "Retry" functionality (retrying Junit test methods).
- */
-@RunWith(RetryRunner.class)
-public class RetryRunnerTest {
-    final Random rng = new Random();
-
-    /**
-     * Shows that an always failing test will fail even if it is retried.
-     */
-    @Test(expected=IllegalStateException.class)
-    @Retry
-    public void testRetryFailAlways() {
-        throw new IllegalStateException();
-    }
-
-    /**
-     * Shows that a test that sometimes fail might succeed if it is retried.
-     * In this case the high number of retries makes it quite unlikely that
-     * the exception will be thrown by all of the calls.
-     */
-    @Test
-    @Retry(100)
-    public void testRetryFailSometimes() {
-        if (rng.nextBoolean()) {
-            throw new IllegalStateException();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/a752ab8d/src/test/java/org/apache/commons/complex/RootsOfUnityTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/complex/RootsOfUnityTest.java b/src/test/java/org/apache/commons/complex/RootsOfUnityTest.java
deleted file mode 100644
index 642c87a..0000000
--- a/src/test/java/org/apache/commons/complex/RootsOfUnityTest.java
+++ /dev/null
@@ -1,84 +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.complex;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-
-/**
- * Unit tests for the {@link RootsOfUnity} class.
- *
- */
-public class RootsOfUnityTest {
-    @Test(expected = IllegalArgumentException.class)
-    public void testPrecondition() {
-        new RootsOfUnity(0);
-    }
-    @Test(expected = IndexOutOfBoundsException.class)
-    public void testGetRootPrecondition1() {
-        final int n = 3;
-        final RootsOfUnity roots = new RootsOfUnity(n);
-        roots.getRoot(-1);
-    }
-    @Test(expected = IndexOutOfBoundsException.class)
-    public void testGetRootPrecondition2() {
-        final int n = -2;
-        final RootsOfUnity roots = new RootsOfUnity(n);
-        roots.getRoot(2);
-    }
-
-    @Test
-    public void testGetNumberOfRoots1() {
-        final int n = 5;
-        final RootsOfUnity roots = new RootsOfUnity(n);
-        Assert.assertEquals(n, roots.getNumberOfRoots());
-        Assert.assertTrue(roots.isCounterClockwise());
-    }
-    @Test
-    public void testGetNumberOfRoots2() {
-        final int n = -4;
-        final RootsOfUnity roots = new RootsOfUnity(n);
-        Assert.assertEquals(Math.abs(n), roots.getNumberOfRoots());
-        Assert.assertFalse(roots.isCounterClockwise());
-    }
-
-    @Test
-    public void testComputeRoots() {
-        final double tol = Math.ulp(1d);
-        final org.apache.commons.math3.complex.RootsOfUnity cmRoots =
-            new org.apache.commons.math3.complex.RootsOfUnity();
-        for (int n = -10; n < 11; n++) {
-            final int absN = Math.abs(n);
-            if (n != 0) {
-                cmRoots.computeRoots(n);
-                final RootsOfUnity roots = new RootsOfUnity(n);
-                for (int k = 0; k < absN; k++) {
-                    final Complex z = roots.getRoot(k);
-                    Assert.assertEquals("n=" + n + " k=" + k,
-                                        cmRoots.getReal(k),
-                                        z.getReal(),
-                                        tol);
-                    Assert.assertEquals("n=" + n + " k=" + k,
-                                        cmRoots.getImaginary(k),
-                                        z.getImaginary(),
-                                        tol);
-                }
-            }
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/a752ab8d/src/test/java/org/apache/commons/complex/TestUtils.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/commons/complex/TestUtils.java b/src/test/java/org/apache/commons/complex/TestUtils.java
deleted file mode 100755
index 63a2e65..0000000
--- a/src/test/java/org/apache/commons/complex/TestUtils.java
+++ /dev/null
@@ -1,408 +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.complex;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
-import org.apache.commons.complex.Complex;
-import org.apache.commons.complex.ComplexFormat;
-
-import org.junit.Assert;
-
-/**
- */
-public class TestUtils {
-    /**
-     * Collection of static methods used in math unit tests.
-     */
-    private TestUtils() {
-        super();
-    }
-
-    /**
-     * Verifies that expected and actual are within delta, or are both NaN or
-     * infinities of the same sign.
-     */
-    public static void assertEquals(double expected, double actual, double delta) {
-        Assert.assertEquals(null, expected, actual, delta);
-    }
-
-    /**
-     * Verifies that expected and actual are within delta, or are both NaN or
-     * infinities of the same sign.
-     */
-    public static void assertEquals(String msg, double expected, double actual, double delta) {
-        // check for NaN
-        if(Double.isNaN(expected)){
-            Assert.assertTrue("" + actual + " is not NaN.",
-                Double.isNaN(actual));
-        } else {
-            Assert.assertEquals(msg, expected, actual, delta);
-        }
-    }
-
-    /**
-     * Verifies that the two arguments are exactly the same, either
-     * both NaN or infinities of same sign, or identical floating point values.
-     */
-    public static void assertSame(double expected, double actual) {
-     Assert.assertEquals(expected, actual, 0);
-    }
-
-    /**
-     * Verifies that real and imaginary parts of the two complex arguments
-     * are exactly the same.  Also ensures that NaN / infinite components match.
-     */
-    public static void assertSame(Complex expected, Complex actual) {
-        assertSame(expected.getReal(), actual.getReal());
-        assertSame(expected.getImaginary(), actual.getImaginary());
-    }
-
-    /**
-     * Verifies that real and imaginary parts of the two complex arguments
-     * differ by at most delta.  Also ensures that NaN / infinite components match.
-     */
-    public static void assertEquals(Complex expected, Complex actual, double delta) {
-        Assert.assertEquals(expected.getReal(), actual.getReal(), delta);
-        Assert.assertEquals(expected.getImaginary(), actual.getImaginary(), delta);
-    }
-
-    /**
-     * Verifies that two double arrays have equal entries, up to tolerance
-     */
-    public static void assertEquals(double expected[], double observed[], double tolerance) {
-        assertEquals("Array comparison failure", expected, observed, tolerance);
-    }
-
-    /**
-     * Serializes an object to a bytes array and then recovers the object from the bytes array.
-     * Returns the deserialized object.
-     *
-     * @param o  object to serialize and recover
-     * @return  the recovered, deserialized object
-     */
-    public static Object serializeAndRecover(Object o) {
-        try {
-            // serialize the Object
-            ByteArrayOutputStream bos = new ByteArrayOutputStream();
-            ObjectOutputStream so = new ObjectOutputStream(bos);
-            so.writeObject(o);
-
-            // deserialize the Object
-            ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
-            ObjectInputStream si = new ObjectInputStream(bis);
-            return si.readObject();
-        } catch (IOException ioe) {
-            return null;
-        } catch (ClassNotFoundException cnfe) {
-            return null;
-        }
-    }
-
-    /**
-     * Verifies that serialization preserves equals and hashCode.
-     * Serializes the object, then recovers it and checks equals and hash code.
-     *
-     * @param object  the object to serialize and recover
-     */
-    public static void checkSerializedEquality(Object object) {
-        Object object2 = serializeAndRecover(object);
-        Assert.assertEquals("Equals check", object, object2);
-        Assert.assertEquals("HashCode check", object.hashCode(), object2.hashCode());
-    }
-
-    /**
-     * Verifies that the relative error in actual vs. expected is less than or
-     * equal to relativeError.  If expected is infinite or NaN, actual must be
-     * the same (NaN or infinity of the same sign).
-     *
-     * @param expected expected value
-     * @param actual  observed value
-     * @param relativeError  maximum allowable relative error
-     */
-    public static void assertRelativelyEquals(double expected, double actual,
-            double relativeError) {
-        assertRelativelyEquals(null, expected, actual, relativeError);
-    }
-
-    /**
-     * Verifies that the relative error in actual vs. expected is less than or
-     * equal to relativeError.  If expected is infinite or NaN, actual must be
-     * the same (NaN or infinity of the same sign).
-     *
-     * @param msg  message to return with failure
-     * @param expected expected value
-     * @param actual  observed value
-     * @param relativeError  maximum allowable relative error
-     */
-    public static void assertRelativelyEquals(String msg, double expected,
-            double actual, double relativeError) {
-        if (Double.isNaN(expected)) {
-            Assert.assertTrue(msg, Double.isNaN(actual));
-        } else if (Double.isNaN(actual)) {
-            Assert.assertTrue(msg, Double.isNaN(expected));
-        } else if (Double.isInfinite(actual) || Double.isInfinite(expected)) {
-            Assert.assertEquals(expected, actual, relativeError);
-        } else if (expected == 0.0) {
-            Assert.assertEquals(msg, actual, expected, relativeError);
-        } else {
-            double absError = Math.abs(expected) * relativeError;
-            Assert.assertEquals(msg, expected, actual, absError);
-        }
-    }
-
-    /**
-     * Fails iff values does not contain a number within epsilon of z.
-     *
-     * @param msg  message to return with failure
-     * @param values complex array to search
-     * @param z  value sought
-     * @param epsilon  tolerance
-     */
-    public static void assertContains(String msg, Complex[] values,
-                                      Complex z, double epsilon) {
-        for (Complex value : values) {
-            if (Precision.equals(value.getReal(), z.getReal(), epsilon) &&
-                Precision.equals(value.getImaginary(), z.getImaginary(), epsilon)) {
-                return;
-            }
-        }
-        Assert.fail(msg + " Unable to find " + (new ComplexFormat()).format(z));
-    }
-
-    /**
-     * Fails iff values does not contain a number within epsilon of z.
-     *
-     * @param values complex array to search
-     * @param z  value sought
-     * @param epsilon  tolerance
-     */
-    public static void assertContains(Complex[] values,
-            Complex z, double epsilon) {
-        assertContains(null, values, z, epsilon);
-    }
-
-    /**
-     * Fails iff values does not contain a number within epsilon of x.
-     *
-     * @param msg  message to return with failure
-     * @param values double array to search
-     * @param x value sought
-     * @param epsilon  tolerance
-     */
-    public static void assertContains(String msg, double[] values,
-            double x, double epsilon) {
-        for (double value : values) {
-            if (Precision.equals(value, x, epsilon)) {
-                return;
-            }
-        }
-        Assert.fail(msg + " Unable to find " + x);
-    }
-
-    /**
-     * Fails iff values does not contain a number within epsilon of x.
-     *
-     * @param values double array to search
-     * @param x value sought
-     * @param epsilon  tolerance
-     */
-    public static void assertContains(double[] values, double x,
-            double epsilon) {
-       assertContains(null, values, x, epsilon);
-    }
-
-    /** verifies that two arrays are close (sup norm) */
-    public static void assertEquals(String msg, double[] expected, double[] observed, double tolerance) {
-        StringBuilder out = new StringBuilder(msg);
-        if (expected.length != observed.length) {
-            out.append("\n Arrays not same length. \n");
-            out.append("expected has length ");
-            out.append(expected.length);
-            out.append(" observed length = ");
-            out.append(observed.length);
-            Assert.fail(out.toString());
-        }
-        boolean failure = false;
-        for (int i=0; i < expected.length; i++) {
-            if (!equalsIncludingNaN(expected[i], observed[i], tolerance)) {
-                failure = true;
-                out.append("\n Elements at index ");
-                out.append(i);
-                out.append(" differ. ");
-                out.append(" expected = ");
-                out.append(expected[i]);
-                out.append(" observed = ");
-                out.append(observed[i]);
-            }
-        }
-        if (failure) {
-            Assert.fail(out.toString());
-        }
-    }
-
-    /** verifies that two arrays are close (sup norm) */
-    public static void assertEquals(String msg, float[] expected, float[] observed, float tolerance) {
-        StringBuilder out = new StringBuilder(msg);
-        if (expected.length != observed.length) {
-            out.append("\n Arrays not same length. \n");
-            out.append("expected has length ");
-            out.append(expected.length);
-            out.append(" observed length = ");
-            out.append(observed.length);
-            Assert.fail(out.toString());
-        }
-        boolean failure = false;
-        for (int i=0; i < expected.length; i++) {
-            if (!equalsIncludingNaN(expected[i], observed[i], tolerance)) {
-                failure = true;
-                out.append("\n Elements at index ");
-                out.append(i);
-                out.append(" differ. ");
-                out.append(" expected = ");
-                out.append(expected[i]);
-                out.append(" observed = ");
-                out.append(observed[i]);
-            }
-        }
-        if (failure) {
-            Assert.fail(out.toString());
-        }
-    }
-
-    /** verifies that two arrays are close (sup norm) */
-    public static void assertEquals(String msg, Complex[] expected, Complex[] observed, double tolerance) {
-        StringBuilder out = new StringBuilder(msg);
-        if (expected.length != observed.length) {
-            out.append("\n Arrays not same length. \n");
-            out.append("expected has length ");
-            out.append(expected.length);
-            out.append(" observed length = ");
-            out.append(observed.length);
-            Assert.fail(out.toString());
-        }
-        boolean failure = false;
-        for (int i=0; i < expected.length; i++) {
-            if (!equalsIncludingNaN(expected[i].getReal(), observed[i].getReal(), tolerance)) {
-                failure = true;
-                out.append("\n Real elements at index ");
-                out.append(i);
-                out.append(" differ. ");
-                out.append(" expected = ");
-                out.append(expected[i].getReal());
-                out.append(" observed = ");
-                out.append(observed[i].getReal());
-            }
-            if (!equalsIncludingNaN(expected[i].getImaginary(), observed[i].getImaginary(), tolerance)) {
-                failure = true;
-                out.append("\n Imaginary elements at index ");
-                out.append(i);
-                out.append(" differ. ");
-                out.append(" expected = ");
-                out.append(expected[i].getImaginary());
-                out.append(" observed = ");
-                out.append(observed[i].getImaginary());
-            }
-        }
-        if (failure) {
-            Assert.fail(out.toString());
-        }
-    }
-
-    /**
-     * Updates observed counts of values in quartiles.
-     * counts[0] <-> 1st quartile ... counts[3] <-> top quartile
-     */
-    public static void updateCounts(double value, long[] counts, double[] quartiles) {
-        if (value < quartiles[0]) {
-            counts[0]++;
-        } else if (value > quartiles[2]) {
-            counts[3]++;
-        } else if (value > quartiles[1]) {
-            counts[2]++;
-        } else {
-            counts[1]++;
-        }
-    }
-
-    /**
-     * Eliminates points with zero mass from densityPoints and densityValues parallel
-     * arrays.  Returns the number of positive mass points and collapses the arrays so
-     * that the first <returned value> elements of the input arrays represent the positive
-     * mass points.
-     */
-    public static int eliminateZeroMassPoints(int[] densityPoints, double[] densityValues) {
-        int positiveMassCount = 0;
-        for (int i = 0; i < densityValues.length; i++) {
-            if (densityValues[i] > 0) {
-                positiveMassCount++;
-            }
-        }
-        if (positiveMassCount < densityValues.length) {
-            int[] newPoints = new int[positiveMassCount];
-            double[] newValues = new double[positiveMassCount];
-            int j = 0;
-            for (int i = 0; i < densityValues.length; i++) {
-                if (densityValues[i] > 0) {
-                    newPoints[j] = densityPoints[i];
-                    newValues[j] = densityValues[i];
-                    j++;
-                }
-            }
-            System.arraycopy(newPoints,0,densityPoints,0,positiveMassCount);
-            System.arraycopy(newValues,0,densityValues,0,positiveMassCount);
-        }
-        return positiveMassCount;
-    }
-
-    /**
-     * Returns true if the arguments are both NaN, are equal or are within the range
-     * of allowed error (inclusive).
-     *
-     * @param x first value
-     * @param y second value
-     * @param eps the amount of absolute error to allow.
-     * @return {@code true} if the values are equal or within range of each other,
-     * or both are NaN.
-     * @since 2.2
-     */
-    private static boolean equalsIncludingNaN(double x, double y, double eps) {
-        return equalsIncludingNaN(x, y) || (Math.abs(y - x) <= eps);
-    }
-
-    /**
-     * Returns true if the arguments are both NaN or they are
-     * equal as defined by {@link #equals(double,double) equals(x, y, 1)}.
-     *
-     * @param x first value
-     * @param y second value
-     * @return {@code true} if the values are equal or both are NaN.
-     * @since 2.2
-     */
-    private static boolean equalsIncludingNaN(double x, double y) {
-        return (x != x || y != y) ? !(x != x ^ y != y) : Precision.equals(x, y, 1);
-    }
-
-
-}
-
-


Mime
View raw message