You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2018/12/09 00:08:54 UTC

[1/6] commons-numbers git commit: [NUMBERS-56] Fix dimension check; improve test coverage and fix other bugs found.

Repository: commons-numbers
Updated Branches:
  refs/heads/master 44e561489 -> 8b47349ce


[NUMBERS-56] Fix dimension check; improve test coverage and fix other bugs found.


Project: http://git-wip-us.apache.org/repos/asf/commons-numbers/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-numbers/commit/cfa71fc1
Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/cfa71fc1
Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/cfa71fc1

Branch: refs/heads/master
Commit: cfa71fc12f6a48d1d37e7e389a025dc8cea971b6
Parents: 44e5614
Author: Steve Bosman <St...@gmail.com>
Authored: Fri Dec 7 11:48:28 2018 +0000
Committer: Steve Bosman <St...@gmail.com>
Committed: Fri Dec 7 11:48:28 2018 +0000

----------------------------------------------------------------------
 .../numbers/complex/streams/ComplexUtils.java   |  40 +-
 .../complex/streams/ComplexUtilsTest.java       | 672 ++++++++++++-------
 .../numbers/complex/streams/TestUtils.java      | 350 ++++------
 3 files changed, 600 insertions(+), 462 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/cfa71fc1/commons-numbers-complex-streams/src/main/java/org/apache/commons/numbers/complex/streams/ComplexUtils.java
----------------------------------------------------------------------
diff --git a/commons-numbers-complex-streams/src/main/java/org/apache/commons/numbers/complex/streams/ComplexUtils.java b/commons-numbers-complex-streams/src/main/java/org/apache/commons/numbers/complex/streams/ComplexUtils.java
index 5c0d7d1..b5b8dff 100644
--- a/commons-numbers-complex-streams/src/main/java/org/apache/commons/numbers/complex/streams/ComplexUtils.java
+++ b/commons-numbers-complex-streams/src/main/java/org/apache/commons/numbers/complex/streams/ComplexUtils.java
@@ -295,7 +295,7 @@ public class ComplexUtils {
      */
     public static Complex[] real2Complex(double[] real) {
         int index = 0;
-        final Complex c[] = new Complex[real.length];
+        final Complex[] c = new Complex[real.length];
         for (double d : real) {
             c[index] = Complex.ofReal(d);
             index++;
@@ -313,7 +313,7 @@ public class ComplexUtils {
      */
     public static Complex[] real2Complex(float[] real) {
         int index = 0;
-        final Complex c[] = new Complex[real.length];
+        final Complex[] c = new Complex[real.length];
         for (float d : real) {
             c[index] = Complex.ofReal(d);
             index++;
@@ -422,7 +422,7 @@ public class ComplexUtils {
      */
     public static double[] complex2Real(Complex[] c) {
         int index = 0;
-        final double d[] = new double[c.length];
+        final double[] d = new double[c.length];
         for (Complex cc : c) {
             d[index] = cc.getReal();
             index++;
@@ -441,7 +441,7 @@ public class ComplexUtils {
      */
     public static float[] complex2RealFloat(Complex[] c) {
         int index = 0;
-        final float f[] = new float[c.length];
+        final float[] f = new float[c.length];
         for (Complex cc : c) {
             f[index] = (float) cc.getReal();
             index++;
@@ -564,7 +564,7 @@ public class ComplexUtils {
      */
     public static Complex[] imaginary2Complex(double[] imaginary) {
         int index = 0;
-        final Complex c[] = new Complex[imaginary.length];
+        final Complex[] c = new Complex[imaginary.length];
         for (double d : imaginary) {
             c[index] = Complex.ofCartesian(0, d);
             index++;
@@ -582,7 +582,7 @@ public class ComplexUtils {
      */
     public static Complex[] imaginary2Complex(float[] imaginary) {
         int index = 0;
-        final Complex c[] = new Complex[imaginary.length];
+        final Complex[] c = new Complex[imaginary.length];
         for (float d : imaginary) {
             c[index] = Complex.ofCartesian(0, d);
             index++;
@@ -655,7 +655,7 @@ public class ComplexUtils {
      */
     public static double[] complex2Imaginary(Complex[] c) {
         int index = 0;
-        final double i[] = new double[c.length];
+        final double[] i = new double[c.length];
         for (Complex cc : c) {
             i[index] = cc.getImaginary();
             index++;
@@ -674,7 +674,7 @@ public class ComplexUtils {
      */
     public static float[] complex2ImaginaryFloat(Complex[] c) {
         int index = 0;
-        final float f[] = new float[c.length];
+        final float[] f = new float[c.length];
         for (Complex cc : c) {
             f[index] = (float) cc.getImaginary();
             index++;
@@ -799,7 +799,7 @@ public class ComplexUtils {
      */
     public static Complex[] interleaved2Complex(double[] interleaved) {
         final int length = interleaved.length / 2;
-        final Complex c[] = new Complex[length];
+        final Complex[] c = new Complex[length];
         for (int n = 0; n < length; n++) {
             c[n] = Complex.ofCartesian(interleaved[n * 2], interleaved[n * 2 + 1]);
         }
@@ -817,7 +817,7 @@ public class ComplexUtils {
      */
     public static Complex[] interleaved2Complex(float[] interleaved) {
         final int length = interleaved.length / 2;
-        final Complex c[] = new Complex[length];
+        final Complex[] c = new Complex[length];
         for (int n = 0; n < length; n++) {
             c[n] = Complex.ofCartesian(interleaved[n * 2], interleaved[n * 2 + 1]);
         }
@@ -836,7 +836,7 @@ public class ComplexUtils {
      */
     public static double[] complex2Interleaved(Complex[] c) {
         int index = 0;
-        final double i[] = new double[c.length * 2];
+        final double[] i = new double[c.length * 2];
         for (Complex cc : c) {
             int real = index * 2;
             int imag = index * 2 + 1;
@@ -859,7 +859,7 @@ public class ComplexUtils {
      */
     public static float[] complex2InterleavedFloat(Complex[] c) {
         int index = 0;
-        final float f[] = new float[c.length * 2];
+        final float[] f = new float[c.length * 2];
         for (Complex cc : c) {
             int real = index * 2;
             int imag = index * 2 + 1;
@@ -1001,7 +1001,7 @@ public class ComplexUtils {
             for (int x = 0; x < w; x++) {
                 for (int y = 0; y < h; y++) {
                     for (int z = 0; z < d; z++) {
-                        for (int t = 0; t > v; t++) {
+                        for (int t = 0; t < v; t++) {
                             i[x * 2][y][z][t] = c[x][y][z][t].getReal();
                             i[x * 2 + 1][y][z][t] = c[x][y][z][t].getImaginary();
                         }
@@ -1013,7 +1013,7 @@ public class ComplexUtils {
             for (int x = 0; x < w; x++) {
                 for (int y = 0; y < h; y++) {
                     for (int z = 0; z < d; z++) {
-                        for (int t = 0; t > v; t++) {
+                        for (int t = 0; t < v; t++) {
                             i[x][y * 2][z][t] = c[x][y][z][t].getReal();
                             i[x][y * 2 + 1][z][t] = c[x][y][z][t].getImaginary();
                         }
@@ -1025,7 +1025,7 @@ public class ComplexUtils {
             for (int x = 0; x < w; x++) {
                 for (int y = 0; y < h; y++) {
                     for (int z = 0; z < d; z++) {
-                        for (int t = 0; t > v; t++) {
+                        for (int t = 0; t < v; t++) {
                         i[x][y][z * 2][t] = c[x][y][z][t].getReal();
                         i[x][y][z * 2 + 1][t] = c[x][y][z][t].getImaginary();
                         }
@@ -1037,7 +1037,7 @@ public class ComplexUtils {
             for (int x = 0; x < w; x++) {
                 for (int y = 0; y < h; y++) {
                     for (int z = 0; z < d; z++) {
-                        for (int t = 0; t > v; t++) {
+                        for (int t = 0; t < v; t++) {
                         i[x][y][z][t * 2] = c[x][y][z][t].getReal();
                         i[x][y][z][t * 2 + 1] = c[x][y][z][t].getImaginary();
                         }
@@ -1310,7 +1310,7 @@ public class ComplexUtils {
      * @since 1.0
      */
     public static Complex[][][][] interleaved2Complex(double[][][][] i, int interleavedDim) {
-        if (interleavedDim > 2 || interleavedDim < 0) {
+        if (interleavedDim > 3 || interleavedDim < 0) {
             throw new IndexOutOfRangeException(interleavedDim);
         }
         final int w = i.length;
@@ -1720,6 +1720,9 @@ public class ComplexUtils {
      * Exception to be throw when a negative value is passed as the modulus.
      */
     private static class NegativeModulusException extends IllegalArgumentException {
+        /** Serializable version identifier. */
+        private static final long serialVersionUID = 20181205L;
+
         /**
          * @param r Wrong modulus.
          */
@@ -1732,6 +1735,9 @@ public class ComplexUtils {
      * Exception to be throw when an out-of-range index value is passed.
      */
     private static class IndexOutOfRangeException extends IllegalArgumentException {
+        /** Serializable version identifier. */
+        private static final long serialVersionUID = 20181205L;
+
         /**
          * @param i Wrong index.
          */

http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/cfa71fc1/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/ComplexUtilsTest.java
----------------------------------------------------------------------
diff --git a/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/ComplexUtilsTest.java b/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/ComplexUtilsTest.java
index d348571..d927d88 100644
--- a/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/ComplexUtilsTest.java
+++ b/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/ComplexUtilsTest.java
@@ -23,6 +23,7 @@ import org.junit.Assert;
 import org.junit.Test;
 
 /**
+ * Tests for {@link ComplexUtils}.
  */
 public class ComplexUtilsTest {
 
@@ -38,35 +39,30 @@ public class ComplexUtilsTest {
     private static final Complex infNaN = Complex.ofCartesian(inf, nan);
     private static final Complex NAN = Complex.ofCartesian(nan, 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 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 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; // interleaved real array with consecutive vals,
+    // 'interleaved' length
+    private static float[] f; // real array with consecutive vals
+    private static float[] fi; // interleaved real array with consecutive 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
+    private static String msg; // error message for AssertEquals
+    private static Complex[][] c2d, cr2d, ci2d; // for 2d methods
+    private static Complex[][][] c3d, cr3d, ci3d; // for 3d methods
+    private static Complex[][][][] c4d, cr4d, ci4d; // for 3d methods
+    private static double[][] di2d0, di2d1, sr2d, si2d;
+    private static double[][][] di3d0, di3d1, di3d2, sr3d, si3d;
+    private static double[][][][] di4d0, di4d1, di4d2, di4d3, sr4d, si4d;
+    private static float[][] fi2d0, fi2d1, sfr2d, sfi2d;
+    private static float[][][] fi3d0, fi3d1, fi3d2, sfr3d, sfi3d;
+    private static float[][][][] sfr4d, sfi4d;
 
     private static void setArrays() { // initial setup method
         c = new Complex[10];
@@ -86,93 +82,127 @@ public class ComplexUtilsTest {
         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];
+        c4d = new Complex[10][10][10][10];
+        cr4d = new Complex[10][10][10][10];
+        ci4d = new Complex[10][10][10][10];
         sr2d = new double[10][10];
         sr3d = new double[10][10][10];
+        sr4d = new double[10][10][10][10];
         si2d = new double[10][10];
         si3d = new double[10][10][10];
+        si4d = new double[10][10][10][10];
         sfr2d = new float[10][10];
         sfr3d = new float[10][10][10];
+        sfr4d = new float[10][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];
+        sfi4d = new float[10][10][10][10];
+        di2d0 = new double[20][10];
+        di2d1 = new double[10][20];
+        di3d0 = new double[20][10][10];
+        di3d1 = new double[10][20][10];
+        di3d2 = new double[10][10][20];
+        di4d0 = new double[20][10][10][10];
+        di4d1 = new double[10][20][10][10];
+        di4d2 = new double[10][10][20][10];
+        di4d3 = new double[10][10][10][20];
+        fi2d0 = new float[20][10];
+        fi2d1 = new float[10][20];
+        fi3d0 = new float[20][10][10];
+        fi3d1 = new float[10][20][10];
+        fi3d2 = new float[10][10][20];
         for (int i = 0; i < 20; i += 2) {
-            d[i / 2] = i / 2;
-            f[i / 2] = i / 2;
+            int halfI = i / 2;
+            d[halfI] = halfI;
+            f[halfI] = halfI;
             di[i] = i;
             di[i + 1] = i + 1;
             fi[i] = i;
             fi[i + 1] = i + 1;
-            c[i / 2] = Complex.ofCartesian(i, i + 1);
-            cr[i / 2] = Complex.ofReal(i / 2);
-            ci[i / 2] = Complex.ofCartesian(0, i / 2);
-            sr[i / 2] = i;
-            si[i / 2] = i + 1;
-            sfr[i / 2] = i;
-            sfi[i / 2] = i + 1;
+            c[halfI] = Complex.ofCartesian(i, i + 1);
+            cr[halfI] = Complex.ofReal(halfI);
+            ci[halfI] = Complex.ofCartesian(0, halfI);
+            sr[halfI] = i;
+            si[halfI] = i + 1;
+            sfr[halfI] = i;
+            sfi[halfI] = 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] = Complex.ofCartesian(10 * i + j, 10 * i + j + 1);
-                cr2d[i][j / 2] = Complex.ofReal(10 * i + j / 2);
-                ci2d[i][j / 2] = Complex.ofCartesian(0, 10 * i + j / 2);
+                int halfJ = j / 2;
+                sr2d[i][halfJ] = 10 * i + j;
+                si2d[i][halfJ] = 10 * i + j + 1;
+                sfr2d[i][halfJ] = 10 * i + j;
+                sfi2d[i][halfJ] = 10 * i + j + 1;
+                c2d[i][halfJ] = Complex.ofCartesian(10 * i + j, 10 * i + j + 1);
+                cr2d[i][halfJ] = Complex.ofReal(10 * i + j);
+                ci2d[i][halfJ] = Complex.ofCartesian(0, 10 * i + j + 1);
+
+                // interleaved
+                di2d0[j][i] = 10 * halfJ + 2 * i;
+                di2d0[j + 1][i] = 10 * halfJ + 2 * i + 1;
+                di2d1[i][j] = 10 * i + j;
+                di2d1[i][j + 1] = 10 * i + j + 1;
+                fi2d0[j][i] = 10 * halfJ + 2 * i;
+                fi2d0[j + 1][i] = 10 * halfJ + 2 * i + 1;
+                fi2d1[i][j] = 10 * i + j;
+                fi2d1[i][j + 1] = 10 * i + j + 1;
             }
         }
         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] = Complex.ofCartesian(100 * i + 10 * j + k, 100 * i + 10 * j + k + 1);
-                    cr3d[i][j][k / 2] = Complex.ofReal(100 * i + 10 * j + k / 2);
-                    ci3d[i][j][k / 2] = Complex.ofCartesian(0, 100 * i + 10 * j + k / 2);
+                    int halfK = k / 2;
+                    sr3d[i][j][halfK] = 100 * i + 10 * j + k;
+                    si3d[i][j][halfK] = 100 * i + 10 * j + k + 1;
+                    sfr3d[i][j][halfK] = 100 * i + 10 * j + k;
+                    sfi3d[i][j][halfK] = 100 * i + 10 * j + k + 1;
+                    c3d[i][j][halfK] = Complex.ofCartesian(100 * i + 10 * j + k, 100 * i + 10 * j + k + 1);
+                    cr3d[i][j][halfK] = Complex.ofReal(100 * i + 10 * j + k);
+                    ci3d[i][j][halfK] = Complex.ofCartesian(0, 100 * i + 10 * j + k + 1);
+
+                    // interleaved
+                    di3d0[k][i][j] = 100 * halfK + 10 * i + 2 * j;
+                    di3d0[k + 1][i][j] = 100 * halfK + 10 * i + 2 * j + 1;
+                    di3d1[j][k][i] = 100 * j + 10 * halfK + 2 * i;
+                    di3d1[j][k + 1][i] = 100 * j + 10 * halfK + 2 * i + 1;
+                    di3d2[i][j][k] = 100 * i + 10 * j + k;
+                    di3d2[i][j][k + 1] = 100 * i + 10 * j + k + 1;
+                    fi3d0[k][i][j] = 100 * halfK + 10 * i + 2 * j;
+                    fi3d0[k + 1][i][j] = 100 * halfK + 10 * i + 2 * j + 1;
+                    fi3d1[j][k][i] = 100 * j + 10 * halfK + 2 * i;
+                    fi3d1[j][k + 1][i] = 100 * j + 10 * halfK + 2 * i + 1;
+                    fi3d2[i][j][k] = 100 * i + 10 * j + k;
+                    fi3d2[i][j][k + 1] = 100 * i + 10 * j + k + 1;
+                }
+            }
+        }
+        for (int i = 0; i < 10; i++) {
+            for (int j = 0; j < 10; j++) {
+                for (int k = 0; k < 10; k++) {
+                    for (int l = 0; l < 20; l += 2) {
+                        int halfL = l / 2;
+                        sr4d[i][j][k][halfL] = 1000 * i + 100 * j + 10 * k + l;
+                        si4d[i][j][k][halfL] = 1000 * i + 100 * j + 10 * k + l + 1;
+                        sfr4d[i][j][k][halfL] = 1000 * i + 100 * j + 10 * k + l;
+                        sfi4d[i][j][k][halfL] = 1000 * i + 100 * j + 10 * k + l + 1;
+                        c4d[i][j][k][halfL] = Complex.ofCartesian(1000 * i + 100 * j + 10 * k + l, 1000 * i + 100 * j + 10 * k + l + 1);
+                        cr4d[i][j][k][halfL] = Complex.ofReal(1000 * i + 100 * j + 10 * k + l);
+                        ci4d[i][j][k][halfL] = Complex.ofCartesian(0, 1000 * i + 100 * j + 10 * k + l + 1);
+
+                        // interleaved
+                        di4d0[l][i][j][k] = 1000 * halfL + 100 * i + 10 * j + 2 * k;
+                        di4d0[l + 1][i][j][k] = 1000 * halfL + 100 * i + 10 * j + 2 * k + 1;
+                        di4d1[k][l][i][j] = 1000 * k + 100 * halfL + 10 * i + 2 * j;
+                        di4d1[k][l + 1][i][j] = 1000 * k + 100 * halfL + 10 * i + 2 * j + 1;
+                        di4d2[j][k][l][i] = 1000 * j + 100 * k + 10 * halfL + 2 * i;
+                        di4d2[j][k][l + 1][i] = 1000 * j + 100 * k + 10 * halfL + 2 * i + 1;
+                        di4d3[i][j][k][l] = 1000 * i + 100 * j + 10 * k + l;
+                        di4d3[i][j][k][l + 1] = di4d3[i][j][k][l] + 1;
+                    }
                 }
             }
         }
-        ansArrayc1r = new Complex[] { Complex.ofReal(3), Complex.ofReal(4), Complex.ofReal(5), Complex.ofReal(6), Complex.ofReal(7) };
-        ansArrayc2r = new Complex[] { Complex.ofReal(3), Complex.ofReal(5), Complex.ofReal(7) };
-        ansArrayc1i = new Complex[] { Complex.ofCartesian(0, 3), Complex.ofCartesian(0, 4), Complex.ofCartesian(0, 5), Complex.ofCartesian(0, 6),
-                Complex.ofCartesian(0, 7) };
-        ansArrayc2i = new Complex[] { Complex.ofCartesian(0, 3), Complex.ofCartesian(0, 5), Complex.ofCartesian(0, 7) };
-        ansArrayc3 = new Complex[] { Complex.ofCartesian(6, 7), Complex.ofCartesian(8, 9), Complex.ofCartesian(10, 11), Complex.ofCartesian(12, 13),
-                Complex.ofCartesian(14, 15) };
-        ansArrayc4 = new Complex[] { Complex.ofCartesian(6, 7), Complex.ofCartesian(10, 11), Complex.ofCartesian(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 = "";
     }
 
@@ -197,9 +227,57 @@ public class ComplexUtilsTest {
                 TestUtils.assertEquals(altPolar(r, theta), ComplexUtils.polar2Complex(r, theta), 10e-12);
             }
         }
+        // 1D
+        double[] r1D = new double[11];
+        double[] theta1D = new double[11];
+        for (int i = 0; i < 11; i++) {
+            r1D[i] = i;
+        }
+        theta1D[5] = 0;
+        for (int i = 1; i < 5; i++) {
+            theta1D[5+i] = theta1D[5 + i - 1] + pi/6;
+            theta1D[5-i] = theta1D[5 + i + 1] - pi/6;
+        }
+        Complex[] observed1D = ComplexUtils.polar2Complex(r1D, theta1D);
+        Assert.assertEquals(r1D.length, observed1D.length);
+        for (int i = 0; i < r1D.length; i++) {
+            Assert.assertEquals(ComplexUtils.polar2Complex(r1D[i], theta1D[i]), observed1D[i]);
+        }
+
+        // 2D
+        double[][] theta2D = new double[3][4];
+        double[][] r2D = new double[3][4];
+        for (int i = 0; i < 3; i++) {
+            for (int j = 0; j < 4; j++) {
+                r2D[i][j] = i + j;
+                theta2D[i][j] = i * j;
+            }
+        }
+        Complex[][] observed2D = ComplexUtils.polar2Complex(r2D, theta2D);
+        Assert.assertEquals(r2D.length, observed2D.length);
+        for (int i = 0; i < r2D.length; i++) {
+            TestUtils.assertSame(msg, ComplexUtils.polar2Complex(r2D[i], theta2D[i]), observed2D[i]);
+        }
+
+        // 3D
+        double[][][] theta3D = new double[3][4][3];
+        double[][][] r3D = new double[3][4][3];
+        for (int i = 0; i < 3; i++) {
+            for (int j = 0; j < 4; j++) {
+                for (int k = 0; k < 3; k++) {
+                    r3D[i][j][k] = i + j + k;
+                    theta3D[i][j][k] = i * j * k;
+                }
+            }
+        }
+        Complex[][][] observed3D = ComplexUtils.polar2Complex(r3D, theta3D);
+        Assert.assertEquals(r3D.length, observed3D.length);
+        for (int i = 0; i < r3D.length; i++) {
+            TestUtils.assertSame(msg, ComplexUtils.polar2Complex(r3D[i], theta3D[i]), observed3D[i]);
+        }
     }
 
-    protected Complex altPolar(double r, double theta) {
+    private Complex altPolar(double r, double theta) {
         return Complex.I.multiply(Complex.ofCartesian(theta, 0)).exp().multiply(Complex.ofCartesian(r, 0));
     }
 
@@ -208,6 +286,21 @@ public class ComplexUtilsTest {
         ComplexUtils.polar2Complex(-1, 0);
     }
 
+    @Test(expected = IllegalArgumentException.class)
+    public void testPolar2ComplexIllegalModulus1D() {
+        ComplexUtils.polar2Complex(new double[]{0, -1, 2}, new double[]{0, 1, 2});
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testPolar2ComplexIllegalModulus2D() {
+        ComplexUtils.polar2Complex(new double[][]{{0, 2, 2}, {0, -1, 2}}, new double[][]{{0, 1, 2}, {0, 1, 2}});
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testPolar2ComplexIllegalModulus3D() {
+        ComplexUtils.polar2Complex(new double[][][]{{{0, 2, 2}}, {{0, -1, 2}}}, new double[][][]{{{0, 1, 2}}, {{0, 1, 2}}});
+    }
+
     @Test
     public void testPolar2ComplexNaN() {
         TestUtils.assertSame(NAN, ComplexUtils.polar2Complex(nan, 1));
@@ -247,12 +340,24 @@ public class ComplexUtilsTest {
         TestUtils.assertSame(Complex.ofReal(3), ComplexUtils.extractComplexFromRealArray(d, 3));
         // Extract complex from real float array, index 3
         TestUtils.assertSame(Complex.ofReal(3), ComplexUtils.extractComplexFromRealArray(f, 3));
+        // Extract complex from real double array, index 3
+        TestUtils.assertSame(Complex.ofCartesian(0, 3), ComplexUtils.extractComplexFromImaginaryArray(d, 3));
+        // Extract complex from real float array, index 3
+        TestUtils.assertSame(Complex.ofCartesian(0, 3), ComplexUtils.extractComplexFromImaginaryArray(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 real double from complex array, index 3
+        TestUtils.assertSame(7, ComplexUtils.extractImaginaryFromComplexArray(c, 3));
+        // Extract real float from complex array, index 3
+        TestUtils.assertSame(7, ComplexUtils.extractImaginaryFloatFromComplexArray(c, 3));
         // Extract complex from interleaved double array, index 3
         TestUtils.assertSame(Complex.ofCartesian(6, 7), ComplexUtils.extractComplexFromInterleavedArray(d, 3));
+        // Extract interleaved double array from complex array, index 3
+        TestUtils.assertSame(new double[]{6d, 7d}, ComplexUtils.extractInterleavedFromComplexArray(c, 3));
+        // Extract interleaved float array from complex array, index 3
+        TestUtils.assertSame(new float[]{6f, 7f}, ComplexUtils.extractInterleavedFloatFromComplexArray(c, 3));
         // Extract complex from interleaved float array, index 3
         TestUtils.assertSame(Complex.ofCartesian(6, 7), ComplexUtils.extractComplexFromInterleavedArray(f, 3));
         // Extract interleaved double from complex array, index 3
@@ -261,67 +366,48 @@ public class ComplexUtilsTest {
         // Extract interleaved float from complex array, index 3
         TestUtils.assertEquals(msg, new double[] { 6, 7 }, ComplexUtils.extractInterleavedFromComplexArray(c, 3),
                 Math.ulp(1));
-        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
         // Real double to complex, whole array
-        TestUtils.assertEquals(msg, cr, ComplexUtils.real2Complex(d),Math.ulp(1.0));
+        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));
+        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));
-        }
+        TestUtils.assertEquals(msg, cr2d, ComplexUtils.real2Complex(sr2d), 0);
+        TestUtils.assertEquals(msg, cr2d, ComplexUtils.real2Complex(sfr2d), 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);
-        }
+        TestUtils.assertEquals(msg, cr3d, ComplexUtils.real2Complex(sr3d), 0);
+        TestUtils.assertEquals(msg, cr3d, ComplexUtils.real2Complex(sfr3d), 0);
+
+        // 4d
+        TestUtils.assertEquals(msg, cr4d, ComplexUtils.real2Complex(sr4d), 0);
     }
 
     @Test
     public void testComplexToReal() {
         setArrays();
         // Real complex to double, whole array
-        TestUtils.assertEquals(msg, sr, ComplexUtils.complex2Real(c),Math.ulp(1.0));
+        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));
+        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));
-        }
+        TestUtils.assertEquals(msg, sr2d, ComplexUtils.complex2Real(cr2d), 0);
+        TestUtils.assertEquals(msg, sfr2d, ComplexUtils.complex2RealFloat(cr2d), 0);
+
         // 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);
-        }
+        TestUtils.assertEquals(msg, sr3d, ComplexUtils.complex2Real(cr3d), 0);
+        TestUtils.assertEquals(msg, sfr3d, ComplexUtils.complex2RealFloat(cr3d), 0);
+
+        // 4d
+        TestUtils.assertEquals(msg, sr4d, ComplexUtils.complex2Real(cr4d), 0);
+        TestUtils.assertEquals(msg, sfr4d, ComplexUtils.complex2RealFloat(cr4d), 0);
     }
 
     // IMAGINARY <-> COMPLEX
@@ -330,113 +416,211 @@ public class ComplexUtilsTest {
     public void testImaginaryToComplex() {
         setArrays();
         // Imaginary double to complex, whole array
-        TestUtils.assertEquals(msg, ci, ComplexUtils.imaginary2Complex(d),Math.ulp(1.0));
+        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));
+        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));
-        }
+        TestUtils.assertEquals(msg, ci2d, ComplexUtils.imaginary2Complex(si2d), 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);
-        }
+        TestUtils.assertEquals(msg, ci3d, ComplexUtils.imaginary2Complex(si3d), 0);
+
+        // 4d
+        TestUtils.assertEquals(msg, ci4d, ComplexUtils.imaginary2Complex(si4d), 0);
     }
 
     @Test
     public void testComplexToImaginary() {
         setArrays();
         // Imaginary complex to double, whole array
-        TestUtils.assertEquals(msg, si, ComplexUtils.complex2Imaginary(c),Math.ulp(1.0));
+        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));
+        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));
-        }
+        TestUtils.assertEquals(msg, si2d, ComplexUtils.complex2Imaginary(ci2d), 0);
+        TestUtils.assertEquals(msg, sfi2d, ComplexUtils.complex2ImaginaryFloat(ci2d), 0);
+
         // 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);
-        }
+        TestUtils.assertEquals(msg, si3d, ComplexUtils.complex2Imaginary(ci3d), 0);
+        TestUtils.assertEquals(msg, sfi3d, ComplexUtils.complex2ImaginaryFloat(ci3d), 0);
+
+        // 4d
+        TestUtils.assertEquals(msg, si4d, ComplexUtils.complex2Imaginary(ci4d), 0);
+        TestUtils.assertEquals(msg, sfi4d, ComplexUtils.complex2ImaginaryFloat(ci4d), 0);
     }
 
     // INTERLEAVED <-> COMPLEX
 
+    @Test(expected = IllegalArgumentException.class)
+    public void testComplex2InterleavedIllegalIndex2Dmin() {
+        ComplexUtils.complex2Interleaved(c2d, -1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testComplex2InterleavedIllegalIndex2Dmax() {
+        ComplexUtils.complex2Interleaved(c2d, 2);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testComplex2InterleavedIllegalIndex3Dmin() {
+        ComplexUtils.complex2Interleaved(c3d, -1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testComplex2InterleavedIllegalIndex3Dmax() {
+        ComplexUtils.complex2Interleaved(c3d, 3);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testComplex2InterleavedIllegalIndex4Dmin() {
+        ComplexUtils.complex2Interleaved(c4d, -1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testComplex2InterleavedIllegalIndex4Dmax() {
+        ComplexUtils.complex2Interleaved(c4d, 4);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testComplex2InterleavedFloatIllegalIndex2Dmin() {
+        ComplexUtils.complex2InterleavedFloat(c2d, -1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testComplex2InterleavedFloatIllegalIndex2Dmax() {
+        ComplexUtils.complex2InterleavedFloat(c2d, 2);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testComplex2InterleavedFloatIllegalIndex3Dmin() {
+        ComplexUtils.complex2InterleavedFloat(c3d, -1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testComplex2InterleavedFloatIllegalIndex3Dmax() {
+        ComplexUtils.complex2InterleavedFloat(c3d, 3);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testInterleaved2ComplexIllegalIndex2Dmin() {
+        ComplexUtils.interleaved2Complex(di2d0, -1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testInterleaved2ComplexIllegalIndex2Dmax() {
+        ComplexUtils.interleaved2Complex(di2d0, 2);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testInterleaved2ComplexIllegalIndex3Dmin() {
+        ComplexUtils.interleaved2Complex(di3d0, -1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testInterleaved2ComplexIllegalIndex3Dmax() {
+        ComplexUtils.interleaved2Complex(di3d0, 3);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testInterleaved2ComplexIllegalIndex4Dmin() {
+        ComplexUtils.interleaved2Complex(di4d0, -1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testInterleaved2ComplexIllegalIndex4Dmax() {
+        ComplexUtils.interleaved2Complex(di4d0, 4);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testInterleaved2ComplexFloatIllegalIndex2Dmin() {
+        ComplexUtils.interleaved2Complex(fi2d0, -1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testInterleaved2ComplexFloatIllegalIndex2Dmax() {
+        ComplexUtils.interleaved2Complex(fi2d0, 2);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testInterleaved2ComplexFloatIllegalIndex3Dmin() {
+        ComplexUtils.interleaved2Complex(fi3d0, -1);
+    }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testInterleaved2ComplexFloatIllegalIndex3Dmax() {
+        ComplexUtils.interleaved2Complex(fi3d0, 3);
+    }
+
     @Test
     public void testInterleavedToComplex() {
         setArrays();
         // Interleaved double to complex, whole array
-        TestUtils.assertEquals(msg, c, ComplexUtils.interleaved2Complex(di),Math.ulp(1.0));
+        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));
+        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));
-        }
+        TestUtils.assertSame(msg, c2d, ComplexUtils.interleaved2Complex(di2d0, 0));
+        TestUtils.assertSame(msg, c2d, ComplexUtils.interleaved2Complex(di2d1, 1));
+        TestUtils.assertSame(msg, c2d, ComplexUtils.interleaved2Complex(di2d1));
+
+        TestUtils.assertSame(msg, c2d, ComplexUtils.interleaved2Complex(fi2d0, 0));
+        TestUtils.assertSame(msg, c2d, ComplexUtils.interleaved2Complex(fi2d1, 1));
+        TestUtils.assertSame(msg, c2d, ComplexUtils.interleaved2Complex(fi2d1));
+
         // 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);
-        }
+        TestUtils.assertSame(msg, c3d, ComplexUtils.interleaved2Complex(di3d0, 0));
+        TestUtils.assertSame(msg, c3d, ComplexUtils.interleaved2Complex(di3d1, 1));
+        TestUtils.assertSame(msg, c3d, ComplexUtils.interleaved2Complex(di3d2, 2));
+        TestUtils.assertSame(msg, c3d, ComplexUtils.interleaved2Complex(di3d2));
+
+        TestUtils.assertSame(msg, c3d, ComplexUtils.interleaved2Complex(fi3d0, 0));
+        TestUtils.assertSame(msg, c3d, ComplexUtils.interleaved2Complex(fi3d1, 1));
+        TestUtils.assertSame(msg, c3d, ComplexUtils.interleaved2Complex(fi3d2, 2));
+        TestUtils.assertSame(msg, c3d, ComplexUtils.interleaved2Complex(fi3d2));
+
+        // 4d
+        TestUtils.assertSame(msg, c4d, ComplexUtils.interleaved2Complex(di4d0, 0));
+        TestUtils.assertSame(msg, c4d, ComplexUtils.interleaved2Complex(di4d1, 1));
+        TestUtils.assertSame(msg, c4d, ComplexUtils.interleaved2Complex(di4d2, 2));
+        TestUtils.assertSame(msg, c4d, ComplexUtils.interleaved2Complex(di4d3, 3));
     }
 
     @Test
     public void testComplexToInterleaved() {
         setArrays();
-        TestUtils.assertEquals(msg, di, ComplexUtils.complex2Interleaved(c),Math.ulp(1.0));
+        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));
+        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));
-        }
+        TestUtils.assertEquals(msg, di2d0, ComplexUtils.complex2Interleaved(c2d, 0), 0);
+        TestUtils.assertEquals(msg, di2d1, ComplexUtils.complex2Interleaved(c2d, 1), 0);
+        TestUtils.assertEquals(msg, di2d1, ComplexUtils.complex2Interleaved(c2d), 0);
+
+        TestUtils.assertEquals(msg, fi2d0, ComplexUtils.complex2InterleavedFloat(c2d, 0), 0);
+        TestUtils.assertEquals(msg, fi2d1, ComplexUtils.complex2InterleavedFloat(c2d, 1), 0);
+        TestUtils.assertEquals(msg, fi2d1, ComplexUtils.complex2InterleavedFloat(c2d), 0);
+
         // 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);
-        }
+        TestUtils.assertEquals(msg, di3d0, ComplexUtils.complex2Interleaved(c3d, 0), 0);
+        TestUtils.assertEquals(msg, di3d1, ComplexUtils.complex2Interleaved(c3d, 1), 0);
+        TestUtils.assertEquals(msg, di3d2, ComplexUtils.complex2Interleaved(c3d, 2), 0);
+        TestUtils.assertEquals(msg, di3d2, ComplexUtils.complex2Interleaved(c3d), 0);
+
+        TestUtils.assertEquals(msg, fi3d0, ComplexUtils.complex2InterleavedFloat(c3d, 0), 0);
+        TestUtils.assertEquals(msg, fi3d1, ComplexUtils.complex2InterleavedFloat(c3d, 1), 0);
+        TestUtils.assertEquals(msg, fi3d2, ComplexUtils.complex2InterleavedFloat(c3d, 2), 0);
+        TestUtils.assertEquals(msg, fi3d2, ComplexUtils.complex2InterleavedFloat(c3d), 0);
+
+        // 4d
+        TestUtils.assertEquals(msg, di4d0, ComplexUtils.complex2Interleaved(c4d, 0), 0);
+        TestUtils.assertEquals(msg, di4d1, ComplexUtils.complex2Interleaved(c4d, 1), 0);
+        TestUtils.assertEquals(msg, di4d2, ComplexUtils.complex2Interleaved(c4d, 2), 0);
+        TestUtils.assertEquals(msg, di4d3, ComplexUtils.complex2Interleaved(c4d, 3), 0);
+        TestUtils.assertEquals(msg, di4d3, ComplexUtils.complex2Interleaved(c4d), 0);
     }
 
     // SPLIT TO COMPLEX
@@ -444,23 +628,13 @@ public class ComplexUtilsTest {
     public void testSplit2Complex() {
         setArrays();
         // Split double to complex, whole array
-        TestUtils.assertEquals(msg, c, ComplexUtils.split2Complex(sr, si),Math.ulp(1.0));
+        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);
-        }
+        TestUtils.assertSame(msg, c2d, ComplexUtils.split2Complex(sr2d, si2d));
+        TestUtils.assertSame(msg, c3d, ComplexUtils.split2Complex(sr3d, si3d));
+        TestUtils.assertSame(msg, c4d, ComplexUtils.split2Complex(sr4d, si4d));
+        TestUtils.assertSame(msg, c2d, ComplexUtils.split2Complex(sfr2d, sfi2d));
+        TestUtils.assertSame(msg, c3d, ComplexUtils.split2Complex(sfr3d, sfi3d));
     }
 
     // INITIALIZATION METHODS
@@ -473,4 +647,48 @@ public class ComplexUtilsTest {
             TestUtils.assertEquals(Complex.ofCartesian(0, 0), cc, Math.ulp(0));
         }
     }
+
+    @Test
+    public void testInitialize2d() {
+        Complex[][] c = new Complex[10][10];
+        ComplexUtils.initialize(c);
+        for (Complex[] c1 : c) {
+            for (Complex c0 : c1) {
+                TestUtils.assertEquals(Complex.ofCartesian(0, 0), c0, Math.ulp(0));
+            }
+        }
+    }
+
+    @Test
+    public void testInitialize3d() {
+        Complex[][][] c = new Complex[10][10][10];
+        ComplexUtils.initialize(c);
+        for (Complex[][] c2 : c) {
+            for (Complex[] c1 : c2) {
+                for (Complex c0 : c1) {
+                    TestUtils.assertEquals(Complex.ofCartesian(0, 0), c0, Math.ulp(0));
+                }
+            }
+        }
+    }
+
+    @Test
+    public void testAbs() {
+        setArrays();
+        double[] observed = ComplexUtils.abs(c);
+        Assert.assertEquals(c.length, observed.length);
+        for (int i = 0; i < c.length; i++) {
+            TestUtils.assertEquals(c[i].abs(), observed[i], 0);
+        }
+    }
+
+    @Test
+    public void testArg() {
+        setArrays();
+        double[] observed = ComplexUtils.arg(c);
+        Assert.assertEquals(c.length, observed.length);
+        for (int i = 0; i < c.length; i++) {
+            TestUtils.assertEquals(c[i].getArgument(), observed[i], 0);
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/cfa71fc1/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/TestUtils.java
----------------------------------------------------------------------
diff --git a/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/TestUtils.java b/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/TestUtils.java
index ec370ff..1ceb655 100644
--- a/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/TestUtils.java
+++ b/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/TestUtils.java
@@ -17,12 +17,6 @@
 
 package org.apache.commons.numbers.complex.streams;
 
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-
 import org.apache.commons.numbers.complex.Complex;
 import org.apache.commons.numbers.core.Precision;
 
@@ -30,8 +24,8 @@ import org.junit.Assert;
 
 /**
  * Test utilities.
- * TODO: Cleanup (remove unused and obsolete methods).
  */
+@SuppressWarnings("WeakerAccess")
 class TestUtils {
     /**
      * Collection of static methods used in math unit tests.
@@ -45,7 +39,7 @@ class TestUtils {
      * infinities of the same sign.
      */
     public static void assertEquals(double expected, double actual, double delta) {
-        Assert.assertEquals(null, expected, actual, delta);
+        assertEquals(null, expected, actual, delta);
     }
 
     /**
@@ -55,7 +49,7 @@ class TestUtils {
     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.",
+            Assert.assertTrue((msg == null ? "" : msg + "\n") + actual + " is not NaN.",
                 Double.isNaN(actual));
         } else {
             Assert.assertEquals(msg, expected, actual, delta);
@@ -66,191 +60,86 @@ class TestUtils {
      * 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());
+    public static void assertSame(double[] expected, double[] actual) {
+        assertEquals("", expected, actual, 0);
     }
 
     /**
-     * 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
+     * Verifies that the two arguments are exactly the same, either
+     * both NaN or infinities of same sign, or identical floating point values.
      */
-    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;
-        }
+    public static void assertSame(float[] expected, float[] actual) {
+        assertEquals("", expected, actual, 0);
     }
 
     /**
-     * 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
+     * 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 checkSerializedEquality(Object object) {
-        Object object2 = serializeAndRecover(object);
-        Assert.assertEquals("Equals check", object, object2);
-        Assert.assertEquals("HashCode check", object.hashCode(), object2.hashCode());
+    public static void assertSame(String msg, Complex[] expected, Complex[] actual) {
+        assertEquals(msg, expected, actual, 0);
     }
 
     /**
-     * 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
+     * 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 assertRelativelyEquals(double expected, double actual,
-            double relativeError) {
-        assertRelativelyEquals(null, expected, actual, relativeError);
+    public static void assertSame(String msg, Complex[][] expected, Complex[][] actual) {
+        assertEquals(msg, expected, actual, 0);
     }
 
     /**
-     * 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
+     * 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 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);
-        }
+    public static void assertSame(String msg, Complex[][][] expected, Complex[][][] actual) {
+        assertEquals(msg, expected, actual, 0);
     }
 
     /**
-     * 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
+     * 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 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 " + z);
+    public static void assertSame(String msg, Complex[][][][] expected, Complex[][][][] actual) {
+        assertEquals(msg, expected, actual, 0);
     }
 
     /**
-     * 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
+     * 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 assertContains(Complex[] values,
-            Complex z, double epsilon) {
-        assertContains(null, values, z, epsilon);
+    public static void assertSame(double expected, double actual) {
+        Assert.assertEquals(expected, actual, 0);
     }
 
     /**
-     * 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
+     * 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 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);
+    public static void assertSame(Complex expected, Complex actual) {
+        assertSame(expected.getReal(), actual.getReal());
+        assertSame(expected.getImaginary(), actual.getImaginary());
     }
 
     /**
-     * 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
+     * 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 assertContains(double[] values, double x,
-            double epsilon) {
-       assertContains(null, values, x, epsilon);
+    public static void assertEquals(Complex expected, Complex actual, double delta) {
+        Assert.assertEquals("Real Values Differ", expected.getReal(), actual.getReal(), delta);
+        Assert.assertEquals("Imaginary Values Differ", expected.getImaginary(), actual.getImaginary(), delta);
     }
 
     /** verifies that two arrays are close (sup norm) */
     public static void assertEquals(String msg, double[] expected, double[] observed, double tolerance) {
+        assertArrayLengthsEqual(msg, expected.length, observed.length);
         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("\n[").append(i).append("] ");
+                out.append("Elements differ. ");
                 out.append(" expected = ");
                 out.append(expected[i]);
                 out.append(" observed = ");
@@ -262,24 +151,48 @@ class TestUtils {
         }
     }
 
+    /** verifies that two 2D arrays are close (sup norm) */
+    public static void assertEquals(String msg, double[][] expected, double[][] observed, double tolerance) {
+        assertArrayLengthsEqual(msg, expected.length, observed.length);
+        for (int i=0; i < expected.length; i++) {
+            assertEquals(msg + "[" + i + "]", expected[i], observed[i], tolerance);
+        }
+    }
+
+    /** verifies that two 3D arrays are close (sup norm) */
+    public static void assertEquals(String msg, double[][][] expected, double[][][] observed, double tolerance) {
+        assertArrayLengthsEqual(msg, expected.length, observed.length);
+        for (int i=0; i < expected.length; i++) {
+            assertEquals(msg + "[" + i + "]", expected[i], observed[i], tolerance);
+        }
+    }
+
+    /** verifies that two 4D arrays are close (sup norm) */
+    public static void assertEquals(String msg, double[][][][] expected, double[][][][] observed, double tolerance) {
+        assertArrayLengthsEqual(msg, expected.length, observed.length);
+        for (int i=0; i < expected.length; i++) {
+            assertEquals(msg + "[" + i + "]", expected[i], observed[i], tolerance);
+        }
+    }
+
+    /** verifies that two 4D arrays are close (sup norm) */
+    public static void assertEquals(String msg, float[][][][] expected, float[][][][] observed, float tolerance) {
+        assertArrayLengthsEqual(msg, expected.length, observed.length);
+        for (int i=0; i < expected.length; i++) {
+            assertEquals(msg + "[" + i + "]", expected[i], observed[i], tolerance);
+        }
+    }
+
     /** verifies that two arrays are close (sup norm) */
     public static void assertEquals(String msg, float[] expected, float[] observed, float tolerance) {
+        assertArrayLengthsEqual(msg, expected.length, observed.length);
         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("\n[").append(i).append("] ");
+                out.append("Elements differ. ");
                 out.append(" expected = ");
                 out.append(expected[i]);
                 out.append(" observed = ");
@@ -291,24 +204,32 @@ class TestUtils {
         }
     }
 
+    /** verifies that two 2D arrays are close (sup norm) */
+    public static void assertEquals(String msg, float[][] expected, float[][] observed, float tolerance) {
+        assertArrayLengthsEqual(msg, expected.length, observed.length);
+        for (int i=0; i < expected.length; i++) {
+            assertEquals(msg + "[" + i + "]", expected[i], observed[i], tolerance);
+        }
+    }
+
+    /** verifies that two 3D arrays are close (sup norm) */
+    public static void assertEquals(String msg, float[][][] expected, float[][][] observed, float tolerance) {
+        assertArrayLengthsEqual(msg, expected.length, observed.length);
+        for (int i=0; i < expected.length; i++) {
+            assertEquals(msg + "[" + i + "]", expected[i], observed[i], tolerance);
+        }
+    }
+
     /** verifies that two arrays are close (sup norm) */
     public static void assertEquals(String msg, Complex[] expected, Complex[] observed, double tolerance) {
+        assertArrayLengthsEqual(msg, expected.length, observed.length);
         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("\n[").append(i).append("] ");
+                out.append("Real elements differ. ");
                 out.append(" expected = ");
                 out.append(expected[i].getReal());
                 out.append(" observed = ");
@@ -316,9 +237,8 @@ class TestUtils {
             }
             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("\n[").append(i).append("] ");
+                out.append("Imaginary elements differ. ");
                 out.append(" expected = ");
                 out.append(expected[i].getImaginary());
                 out.append(" observed = ");
@@ -330,50 +250,28 @@ class TestUtils {
         }
     }
 
-    /**
-     * 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]++;
+    /** verifies that two 2D arrays are close (sup norm) */
+    public static void assertEquals(String msg, Complex[][] expected, Complex[][] observed, double tolerance) {
+        assertArrayLengthsEqual(msg, expected.length, observed.length);
+        for (int i=0; i < expected.length; i++) {
+            assertEquals(msg + "[" + i + "]", expected[i], observed[i], tolerance);
         }
     }
 
-    /**
-     * 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++;
-            }
+    /** verifies that two 3D arrays are close (sup norm) */
+    public static void assertEquals(String msg, Complex[][][] expected, Complex[][][] observed, double tolerance) {
+        assertArrayLengthsEqual(msg, expected.length, observed.length);
+        for (int i=0; i < expected.length; i++) {
+            assertEquals(msg + "[" + i + "]", expected[i], observed[i], tolerance);
         }
-        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);
+    }
+
+    /** verifies that two 4D arrays are close (sup norm) */
+    public static void assertEquals(String msg, Complex[][][][] expected, Complex[][][][] observed, double tolerance) {
+        assertArrayLengthsEqual(msg, expected.length, observed.length);
+        for (int i=0; i < expected.length; i++) {
+            assertEquals(msg + "[" + i + "]", expected[i], observed[i], tolerance);
         }
-        return positiveMassCount;
     }
 
     /**
@@ -393,7 +291,7 @@ class TestUtils {
 
     /**
      * Returns true if the arguments are both NaN or they are
-     * equal as defined by {@link #equals(double,double) equals(x, y, 1)}.
+     * equal as defined by {@link Precision#equals(double,double) equals(x, y, 1)}.
      *
      * @param x first value
      * @param y second value
@@ -404,7 +302,23 @@ class TestUtils {
         return (x != x || y != y) ? !(x != x ^ y != y) : Precision.equals(x, y, 1);
     }
 
+    /**
+     * Assert that the given array lengths are the same
+     * @param msg Initial message
+     * @param expectedLength expected array length
+     * @param observedLength observed array length
+     */
+    private static void assertArrayLengthsEqual(String msg, int expectedLength, int observedLength) {
+        if (expectedLength != observedLength) {
+            StringBuilder out = new StringBuilder(msg);
+            if (msg != null && msg.length()>0) out.append("\n");
+            out.append("Arrays not same length. \n");
+            out.append("expected has length ").append(expectedLength);
+            out.append(" observed has length = ").append(observedLength);
+            Assert.fail(out.toString());
+        }
 
+    }
 }
 
 


[2/6] commons-numbers git commit: NUMBERS-56 Add missing unit tests and fix a couple of bugs in ComplexUtils (tidy up test array creation)

Posted by er...@apache.org.
NUMBERS-56 Add missing unit tests and fix a couple of bugs in ComplexUtils (tidy up test array creation)


Project: http://git-wip-us.apache.org/repos/asf/commons-numbers/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-numbers/commit/bd8d91cf
Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/bd8d91cf
Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/bd8d91cf

Branch: refs/heads/master
Commit: bd8d91cfe0cc15e0b695b00fcfc43d5d8b627aa4
Parents: cfa71fc
Author: Steve Bosman <St...@gmail.com>
Authored: Fri Dec 7 12:42:02 2018 +0000
Committer: Steve Bosman <St...@gmail.com>
Committed: Fri Dec 7 12:42:02 2018 +0000

----------------------------------------------------------------------
 .../complex/streams/ComplexUtilsTest.java       | 130 +++++++++++--------
 1 file changed, 78 insertions(+), 52 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/bd8d91cf/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/ComplexUtilsTest.java
----------------------------------------------------------------------
diff --git a/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/ComplexUtilsTest.java b/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/ComplexUtilsTest.java
index d927d88..6adbf3c 100644
--- a/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/ComplexUtilsTest.java
+++ b/commons-numbers-complex-streams/src/test/java/org/apache/commons/numbers/complex/streams/ComplexUtilsTest.java
@@ -113,67 +113,87 @@ public class ComplexUtilsTest {
         fi3d2 = new float[10][10][20];
         for (int i = 0; i < 20; i += 2) {
             int halfI = i / 2;
-            d[halfI] = halfI;
-            f[halfI] = halfI;
-            di[i] = i;
-            di[i + 1] = i + 1;
-            fi[i] = i;
-            fi[i + 1] = i + 1;
+
+            // Complex arrays
             c[halfI] = Complex.ofCartesian(i, i + 1);
             cr[halfI] = Complex.ofReal(halfI);
             ci[halfI] = Complex.ofCartesian(0, halfI);
+
+            // standalone - split equivalent to c
             sr[halfI] = i;
             si[halfI] = i + 1;
             sfr[halfI] = i;
             sfi[halfI] = i + 1;
+
+            // depending on method used equivalents to cr or ci
+            d[halfI] = halfI;
+            f[halfI] = halfI;
+
+            // interleaved - all equivalent to c2d
+            di[i] = i;
+            di[i + 1] = i + 1;
+            fi[i] = i;
+            fi[i + 1] = i + 1;
         }
         for (int i = 0; i < 10; i++) {
             for (int j = 0; j < 20; j += 2) {
                 int halfJ = j / 2;
-                sr2d[i][halfJ] = 10 * i + j;
-                si2d[i][halfJ] = 10 * i + j + 1;
-                sfr2d[i][halfJ] = 10 * i + j;
-                sfi2d[i][halfJ] = 10 * i + j + 1;
-                c2d[i][halfJ] = Complex.ofCartesian(10 * i + j, 10 * i + j + 1);
-                cr2d[i][halfJ] = Complex.ofReal(10 * i + j);
-                ci2d[i][halfJ] = Complex.ofCartesian(0, 10 * i + j + 1);
-
-                // interleaved
+                int real = 10 * i + j;
+                int imaginary = 10 * i + j + 1;
+
+                // Complex arrays
+                c2d[i][halfJ] = Complex.ofCartesian(real, imaginary);
+                cr2d[i][halfJ] = Complex.ofReal(real);
+                ci2d[i][halfJ] = Complex.ofCartesian(0, imaginary);
+
+                // standalone - split equivalent to c2d, standalone equivalent to cr2d or ci2d
+                sr2d[i][halfJ] = real;
+                si2d[i][halfJ] = imaginary;
+                sfr2d[i][halfJ] = real;
+                sfi2d[i][halfJ] = imaginary;
+
+                // interleaved - all equivalent to c2d
                 di2d0[j][i] = 10 * halfJ + 2 * i;
-                di2d0[j + 1][i] = 10 * halfJ + 2 * i + 1;
-                di2d1[i][j] = 10 * i + j;
-                di2d1[i][j + 1] = 10 * i + j + 1;
+                di2d0[j + 1][i] = di2d0[j][i] + 1;
+                di2d1[i][j] = real;
+                di2d1[i][j + 1] = imaginary;
                 fi2d0[j][i] = 10 * halfJ + 2 * i;
-                fi2d0[j + 1][i] = 10 * halfJ + 2 * i + 1;
-                fi2d1[i][j] = 10 * i + j;
-                fi2d1[i][j + 1] = 10 * i + j + 1;
+                fi2d0[j + 1][i] = fi2d0[j][i] + 1;
+                fi2d1[i][j] = real;
+                fi2d1[i][j + 1] = imaginary;
             }
         }
         for (int i = 0; i < 10; i++) {
             for (int j = 0; j < 10; j++) {
                 for (int k = 0; k < 20; k += 2) {
                     int halfK = k / 2;
-                    sr3d[i][j][halfK] = 100 * i + 10 * j + k;
-                    si3d[i][j][halfK] = 100 * i + 10 * j + k + 1;
-                    sfr3d[i][j][halfK] = 100 * i + 10 * j + k;
-                    sfi3d[i][j][halfK] = 100 * i + 10 * j + k + 1;
-                    c3d[i][j][halfK] = Complex.ofCartesian(100 * i + 10 * j + k, 100 * i + 10 * j + k + 1);
-                    cr3d[i][j][halfK] = Complex.ofReal(100 * i + 10 * j + k);
-                    ci3d[i][j][halfK] = Complex.ofCartesian(0, 100 * i + 10 * j + k + 1);
-
-                    // interleaved
+                    int real = 100 * i + 10 * j + k;
+                    int imaginary = 100 * i + 10 * j + k + 1;
+
+                    // Complex arrays
+                    c3d[i][j][halfK] = Complex.ofCartesian(real, imaginary);
+                    cr3d[i][j][halfK] = Complex.ofReal(real);
+                    ci3d[i][j][halfK] = Complex.ofCartesian(0, imaginary);
+
+                    // standalone - split equivalent to c3d, standalone equivalent to cr3d or ci3d
+                    sr3d[i][j][halfK] = real;
+                    si3d[i][j][halfK] = imaginary;
+                    sfr3d[i][j][halfK] = real;
+                    sfi3d[i][j][halfK] = imaginary;
+
+                    // interleaved - all equivalent to c3d
                     di3d0[k][i][j] = 100 * halfK + 10 * i + 2 * j;
-                    di3d0[k + 1][i][j] = 100 * halfK + 10 * i + 2 * j + 1;
+                    di3d0[k + 1][i][j] = di3d0[k][i][j] + 1;
                     di3d1[j][k][i] = 100 * j + 10 * halfK + 2 * i;
-                    di3d1[j][k + 1][i] = 100 * j + 10 * halfK + 2 * i + 1;
-                    di3d2[i][j][k] = 100 * i + 10 * j + k;
-                    di3d2[i][j][k + 1] = 100 * i + 10 * j + k + 1;
+                    di3d1[j][k + 1][i] = di3d1[j][k][i] + 1;
+                    di3d2[i][j][k] = real;
+                    di3d2[i][j][k + 1] = imaginary;
                     fi3d0[k][i][j] = 100 * halfK + 10 * i + 2 * j;
-                    fi3d0[k + 1][i][j] = 100 * halfK + 10 * i + 2 * j + 1;
+                    fi3d0[k + 1][i][j] = fi3d0[k][i][j] + 1;
                     fi3d1[j][k][i] = 100 * j + 10 * halfK + 2 * i;
-                    fi3d1[j][k + 1][i] = 100 * j + 10 * halfK + 2 * i + 1;
-                    fi3d2[i][j][k] = 100 * i + 10 * j + k;
-                    fi3d2[i][j][k + 1] = 100 * i + 10 * j + k + 1;
+                    fi3d1[j][k + 1][i] = fi3d1[j][k][i] + 1;
+                    fi3d2[i][j][k] = real;
+                    fi3d2[i][j][k + 1] = imaginary;
                 }
             }
         }
@@ -182,23 +202,29 @@ public class ComplexUtilsTest {
                 for (int k = 0; k < 10; k++) {
                     for (int l = 0; l < 20; l += 2) {
                         int halfL = l / 2;
-                        sr4d[i][j][k][halfL] = 1000 * i + 100 * j + 10 * k + l;
-                        si4d[i][j][k][halfL] = 1000 * i + 100 * j + 10 * k + l + 1;
-                        sfr4d[i][j][k][halfL] = 1000 * i + 100 * j + 10 * k + l;
-                        sfi4d[i][j][k][halfL] = 1000 * i + 100 * j + 10 * k + l + 1;
-                        c4d[i][j][k][halfL] = Complex.ofCartesian(1000 * i + 100 * j + 10 * k + l, 1000 * i + 100 * j + 10 * k + l + 1);
-                        cr4d[i][j][k][halfL] = Complex.ofReal(1000 * i + 100 * j + 10 * k + l);
-                        ci4d[i][j][k][halfL] = Complex.ofCartesian(0, 1000 * i + 100 * j + 10 * k + l + 1);
-
-                        // interleaved
+                        int real = 1000 * i + 100 * j + 10 * k + l;
+                        int imaginary = 1000 * i + 100 * j + 10 * k + l + 1;
+
+                        // Complex arrays
+                        c4d[i][j][k][halfL] = Complex.ofCartesian(real, imaginary);
+                        cr4d[i][j][k][halfL] = Complex.ofReal(real);
+                        ci4d[i][j][k][halfL] = Complex.ofCartesian(0, imaginary);
+
+                        // standalone - split equivalent to c4d, standalone equivalent to cr4d or ci4d
+                        sr4d[i][j][k][halfL] = real;
+                        si4d[i][j][k][halfL] = imaginary;
+                        sfr4d[i][j][k][halfL] = real;
+                        sfi4d[i][j][k][halfL] = imaginary;
+
+                        // interleaved - all equivalent to c4d
                         di4d0[l][i][j][k] = 1000 * halfL + 100 * i + 10 * j + 2 * k;
-                        di4d0[l + 1][i][j][k] = 1000 * halfL + 100 * i + 10 * j + 2 * k + 1;
+                        di4d0[l + 1][i][j][k] = di4d0[l][i][j][k] + 1;
                         di4d1[k][l][i][j] = 1000 * k + 100 * halfL + 10 * i + 2 * j;
-                        di4d1[k][l + 1][i][j] = 1000 * k + 100 * halfL + 10 * i + 2 * j + 1;
+                        di4d1[k][l + 1][i][j] = di4d1[k][l][i][j] + 1;
                         di4d2[j][k][l][i] = 1000 * j + 100 * k + 10 * halfL + 2 * i;
-                        di4d2[j][k][l + 1][i] = 1000 * j + 100 * k + 10 * halfL + 2 * i + 1;
-                        di4d3[i][j][k][l] = 1000 * i + 100 * j + 10 * k + l;
-                        di4d3[i][j][k][l + 1] = di4d3[i][j][k][l] + 1;
+                        di4d2[j][k][l + 1][i] = di4d2[j][k][l][i] + 1;
+                        di4d3[i][j][k][l] = real;
+                        di4d3[i][j][k][l + 1] = imaginary;
                     }
                 }
             }


[3/6] commons-numbers git commit: Update POM.

Posted by er...@apache.org.
Update POM.

Upgrade to CP 47.
Remove redundant configurations.


Project: http://git-wip-us.apache.org/repos/asf/commons-numbers/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-numbers/commit/63f80b19
Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/63f80b19
Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/63f80b19

Branch: refs/heads/master
Commit: 63f80b19cf1f12d4a1fa31bcbe183c55d22d77a5
Parents: bd8d91c
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
Authored: Sun Dec 9 00:33:32 2018 +0100
Committer: Gilles Sadowski <gi...@harfang.homelinux.org>
Committed: Sun Dec 9 00:33:32 2018 +0100

----------------------------------------------------------------------
 pom.xml | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/63f80b19/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index e39d755..dac53ef 100644
--- a/pom.xml
+++ b/pom.xml
@@ -19,7 +19,7 @@
   <parent>
     <groupId>org.apache.commons</groupId>
     <artifactId>commons-parent</artifactId>
-    <version>43</version>
+    <version>47</version>
   </parent>
 
   <modelVersion>4.0.0</modelVersion>
@@ -129,11 +129,9 @@
     <commons.encoding>UTF-8</commons.encoding>
     <maven.compiler.source>1.6</maven.compiler.source>
     <maven.compiler.target>1.6</maven.compiler.target>
-    <numbers.pmd.version>3.5</numbers.pmd.version>
-    <numbers.spotbugs.version>3.1.1</numbers.spotbugs.version>
-    <numbers.checkstyle.version>2.17</numbers.checkstyle.version>
-    <numbers.clirr.version>2.7</numbers.clirr.version>
-    <numbers.mathjax.version>2.7.1</numbers.mathjax.version>
+    <numbers.pmd.version>3.9.0</numbers.pmd.version>
+    <numbers.checkstyle.version>3.0.0</numbers.checkstyle.version>
+    <numbers.mathjax.version>2.7.2</numbers.mathjax.version>
     <!-- Workaround to avoid duplicating config files. -->
     <numbers.parent.dir>${basedir}</numbers.parent.dir>
 
@@ -234,7 +232,7 @@
       <plugin>
         <groupId>com.github.spotbugs</groupId>
         <artifactId>spotbugs-maven-plugin</artifactId>
-        <version>${numbers.spotbugs.version}</version>
+        <version>${commons.spotbugs.version}</version>
       </plugin>
       <plugin>
         <groupId>org.apache.rat</groupId>
@@ -336,7 +334,7 @@
       <plugin>
         <groupId>com.github.spotbugs</groupId>
         <artifactId>spotbugs-maven-plugin</artifactId>
-        <version>${numbers.spotbugs.version}</version>
+        <version>${commons.spotbugs.version}</version>
         <configuration>
           <threshold>Normal</threshold>
           <effort>Default</effort>
@@ -362,15 +360,6 @@
         </reportSets>
       </plugin>
       <plugin>
-        <groupId>org.codehaus.mojo</groupId>
-        <artifactId>clirr-maven-plugin</artifactId>
-        <version>${numbers.clirr.version}</version>
-        <configuration>
-          <minSeverity>${minSeverity}</minSeverity>
-          <ignoredDifferencesFile>${numbers.parent.dir}/src/main/resources/clirr/clirr-ignored.xml</ignoredDifferencesFile>
-        </configuration>
-      </plugin>
-      <plugin>
         <artifactId>maven-pmd-plugin</artifactId>
         <version>${numbers.pmd.version}</version>
         <configuration>


[5/6] commons-numbers git commit: Merge branch 'fix_NUMBERS-56__steve'

Posted by er...@apache.org.
Merge branch 'fix_NUMBERS-56__steve'

Closes #18


Project: http://git-wip-us.apache.org/repos/asf/commons-numbers/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-numbers/commit/9de66c2f
Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/9de66c2f
Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/9de66c2f

Branch: refs/heads/master
Commit: 9de66c2f50de858ba49fea816c3abed8168180cd
Parents: 44e5614 2a1989a
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
Authored: Sun Dec 9 00:38:34 2018 +0100
Committer: Gilles Sadowski <gi...@harfang.homelinux.org>
Committed: Sun Dec 9 00:38:34 2018 +0100

----------------------------------------------------------------------
 .../numbers/complex/streams/ComplexUtils.java   |  40 +-
 .../src/site/site.xml                           |  35 +
 .../complex/streams/ComplexUtilsTest.java       | 698 +++++++++++++------
 .../numbers/complex/streams/TestUtils.java      | 350 ++++------
 commons-numbers-complex/src/site/site.xml       |  35 +
 pom.xml                                         |  23 +-
 6 files changed, 702 insertions(+), 479 deletions(-)
----------------------------------------------------------------------



[6/6] commons-numbers git commit: Avoid crash of the surefire plugin.

Posted by er...@apache.org.
Avoid crash of the surefire plugin.


Project: http://git-wip-us.apache.org/repos/asf/commons-numbers/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-numbers/commit/8b47349c
Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/8b47349c
Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/8b47349c

Branch: refs/heads/master
Commit: 8b47349cef1ee4e3c5f8037ed5aad5b1d494cb1e
Parents: 9de66c2
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
Authored: Sun Dec 9 01:07:16 2018 +0100
Committer: Gilles Sadowski <gi...@harfang.homelinux.org>
Committed: Sun Dec 9 01:07:16 2018 +0100

----------------------------------------------------------------------
 pom.xml | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/8b47349c/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index dac53ef..227311d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -187,6 +187,9 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-surefire-plugin</artifactId>
         <configuration>
+          <!-- Fix for OpenJDK 8 now validating class-path attributes in Jar manifests. -->
+          <!-- See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=912333#63 -->
+          <useSystemClassLoader>false</useSystemClassLoader>
           <includes>
             <include>**/*Test.java</include>
           </includes>


[4/6] commons-numbers git commit: Add files (web site).

Posted by er...@apache.org.
Add files (web site).


Project: http://git-wip-us.apache.org/repos/asf/commons-numbers/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-numbers/commit/2a1989a9
Tree: http://git-wip-us.apache.org/repos/asf/commons-numbers/tree/2a1989a9
Diff: http://git-wip-us.apache.org/repos/asf/commons-numbers/diff/2a1989a9

Branch: refs/heads/master
Commit: 2a1989a919a0f3ccd0fb706f73649a3cd6c47d29
Parents: 63f80b1
Author: Gilles Sadowski <gi...@harfang.homelinux.org>
Authored: Sun Dec 9 00:35:20 2018 +0100
Committer: Gilles Sadowski <gi...@harfang.homelinux.org>
Committed: Sun Dec 9 00:35:20 2018 +0100

----------------------------------------------------------------------
 .../src/site/site.xml                           | 35 ++++++++++++++++++++
 commons-numbers-complex/src/site/site.xml       | 35 ++++++++++++++++++++
 2 files changed, 70 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/2a1989a9/commons-numbers-complex-streams/src/site/site.xml
----------------------------------------------------------------------
diff --git a/commons-numbers-complex-streams/src/site/site.xml b/commons-numbers-complex-streams/src/site/site.xml
new file mode 100644
index 0000000..5a61c39
--- /dev/null
+++ b/commons-numbers-complex-streams/src/site/site.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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.
+-->
+<project name="Numbers">
+  <bannerRight>
+    <name>Apache Commons Numbers</name>
+    <src>/images/commons_numbers.small.png</src>
+    <href>/index.html</href>
+  </bannerRight>
+
+  <body>
+    <menu name="Numbers Complex Streams">
+      <item name="Overview" href="index.html"/>
+      <item name="Latest API docs (development)"
+            href="apidocs/index.html"/>
+      <!--item name="Javadoc (1.0 release)"
+            href="http://commons.apache.org/rng/commons-numbers-complex-streams/javadocs/api-1.0/index.html"/-->
+    </menu>
+
+  </body>
+</project>

http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/2a1989a9/commons-numbers-complex/src/site/site.xml
----------------------------------------------------------------------
diff --git a/commons-numbers-complex/src/site/site.xml b/commons-numbers-complex/src/site/site.xml
new file mode 100644
index 0000000..0614a6c
--- /dev/null
+++ b/commons-numbers-complex/src/site/site.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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.
+-->
+<project name="Numbers">
+  <bannerRight>
+    <name>Apache Commons Numbers</name>
+    <src>/images/commons_numbers.small.png</src>
+    <href>/index.html</href>
+  </bannerRight>
+
+  <body>
+    <menu name="Numbers Complex">
+      <item name="Overview" href="index.html"/>
+      <item name="Latest API docs (development)"
+            href="apidocs/index.html"/>
+      <!--item name="Javadoc (1.0 release)"
+            href="http://commons.apache.org/rng/commons-numbers-complex/javadocs/api-1.0/index.html"/-->
+    </menu>
+
+  </body>
+</project>