commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ericbarnh...@apache.org
Subject [36/36] commons-numbers git commit: Merge branch 'complex-dev'
Date Fri, 26 Jan 2018 14:44:56 GMT
Merge branch 'complex-dev'


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

Branch: refs/heads/master
Commit: 4b955ca24a338ffa89bb49b3b0c8cabeb35fbea7
Parents: 71303aa 8830e47
Author: Eric Barnhill <ericbarnhill@apache.org>
Authored: Fri Jan 26 15:36:15 2018 +0100
Committer: Eric Barnhill <ericbarnhill@apache.org>
Committed: Fri Jan 26 15:36:15 2018 +0100

----------------------------------------------------------------------
 .gitignore                                      |   1 +
 .../apache/commons/numbers/complex/Complex.java | 819 +++++++++----------
 .../commons/numbers/complex/ComplexUtils.java   | 806 ++++++++++++------
 .../commons/numbers/complex/CStandardTest.java  | 282 +++++++
 .../commons/numbers/complex/ComplexTest.java    | 687 +---------------
 5 files changed, 1273 insertions(+), 1322 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-numbers/blob/4b955ca2/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/ComplexUtils.java
----------------------------------------------------------------------
diff --cc commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/ComplexUtils.java
index 1275b27,529521d..3fabfab
--- a/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/ComplexUtils.java
+++ b/commons-numbers-complex/src/main/java/org/apache/commons/numbers/complex/ComplexUtils.java
@@@ -744,17 -881,17 +881,17 @@@ public class ComplexUtils 
       */
      public static double[][] complex2Interleaved(Complex[][] c, int interleavedDim) {
          if (interleavedDim > 1 || interleavedDim < 0) {
 -            new IndexOutOfRangeException(interleavedDim);
 +            throw new IndexOutOfRangeException(interleavedDim);
          }
-         final int width = c.length;
-         final int height = c[0].length;
-         double[][] d;
+         final int w = c.length;
+         final int h = c[0].length;
+         double[][] i;
          if (interleavedDim == 0) {
-             d = new double[2 * width][height];
-             for (int x = 0; x < width; x++) {
-                 for (int y = 0; y < height; y++) {
-                     d[x * 2][y] = c[x][y].getReal();
-                     d[x * 2 + 1][y] = c[x][y].getImaginary();
+             i = new double[2 * w][h];
+             for (int x = 0; x < w; x++) {
+                 for (int y = 0; y < h; y++) {
+                     i[x * 2][y] = c[x][y].getReal();
+                     i[x * 2 + 1][y] = c[x][y].getImaginary();
                  }
              }
          } else {
@@@ -797,19 -934,19 +934,19 @@@
       */
      public static double[][][] complex2Interleaved(Complex[][][] c, int interleavedDim)
{
          if (interleavedDim > 2 || interleavedDim < 0) {
 -            new IndexOutOfRangeException(interleavedDim);
 +            throw new IndexOutOfRangeException(interleavedDim);
          }
-         int width = c.length;
-         int height = c[0].length;
-         int depth = c[0][0].length;
-         double[][][] d;
+         int w = c.length;
+         int h = c[0].length;
+         int d = c[0][0].length;
+         double[][][] i;
          if (interleavedDim == 0) {
-             d = new double[2 * width][height][depth];
-             for (int x = 0; x < width; x++) {
-                 for (int y = 0; y < height; y++) {
-                     for (int z = 0; z < depth; z++) {
-                         d[x * 2][y][z] = c[x][y][z].getReal();
-                         d[x * 2 + 1][y][z] = c[x][y][z].getImaginary();
+             i = new double[2 * w][h][d];
+             for (int x = 0; x < w; x++) {
+                 for (int y = 0; y < h; y++) {
+                     for (int z = 0; z < d; z++) {
+                         i[x * 2][y][z] = c[x][y][z].getReal();
+                         i[x * 2 + 1][y][z] = c[x][y][z].getImaginary();
                      }
                  }
              }
@@@ -865,17 -1089,17 +1089,17 @@@
       */
      public static float[][] complex2InterleavedFloat(Complex[][] c, int interleavedDim)
{
          if (interleavedDim > 1 || interleavedDim < 0) {
 -            new IndexOutOfRangeException(interleavedDim);
 +            throw new IndexOutOfRangeException(interleavedDim);
          }
-         final int width = c.length;
-         final int height = c[0].length;
-         float[][] d;
+         final int w = c.length;
+         final int h = c[0].length;
+         float[][] i;
          if (interleavedDim == 0) {
-             d = new float[2 * width][height];
-             for (int x = 0; x < width; x++) {
-                 for (int y = 0; y < height; y++) {
-                     d[x * 2][y] = (float) c[x][y].getReal();
-                     d[x * 2 + 1][y] = (float) c[x][y].getImaginary();
+             i = new float[2 * w][h];
+             for (int x = 0; x < w; x++) {
+                 for (int y = 0; y < h; y++) {
+                     i[x * 2][y] = (float) c[x][y].getReal();
+                     i[x * 2 + 1][y] = (float) c[x][y].getImaginary();
                  }
              }
          } else {
@@@ -919,19 -1143,19 +1143,19 @@@
       */
      public static float[][][] complex2InterleavedFloat(Complex[][][] c, int interleavedDim)
{
          if (interleavedDim > 2 || interleavedDim < 0) {
 -            new IndexOutOfRangeException(interleavedDim);
 +            throw new IndexOutOfRangeException(interleavedDim);
          }
-         final int width = c.length;
-         final int height = c[0].length;
-         final int depth = c[0][0].length;
-         float[][][] d;
+         final int w = c.length;
+         final int h = c[0].length;
+         final int d = c[0][0].length;
+         float[][][] i;
          if (interleavedDim == 0) {
-             d = new float[2 * width][height][depth];
-             for (int x = 0; x < width; x++) {
-                 for (int y = 0; y < height; y++) {
-                     for (int z = 0; z < depth; z++) {
-                         d[x * 2][y][z] = (float) c[x][y][z].getReal();
-                         d[x * 2 + 1][y][z] = (float) c[x][y][z].getImaginary();
+             i = new float[2 * w][h][d];
+             for (int x = 0; x < w; x++) {
+                 for (int y = 0; y < h; y++) {
+                     for (int z = 0; z < d; z++) {
+                         i[x * 2][y][z] = (float) c[x][y][z].getReal();
+                         i[x * 2 + 1][y][z] = (float) c[x][y][z].getImaginary();
                      }
                  }
              }
@@@ -983,20 -1207,20 +1207,20 @@@
       * @param interleavedDim Depth level of the array to interleave
       * @return 2D {@code Complex} array
       *
-      * @since 4.0
+      * @since 1.0
       */
-     public static Complex[][] interleaved2Complex(double[][] d, int interleavedDim) {
+     public static Complex[][] interleaved2Complex(double[][] i, int interleavedDim) {
          if (interleavedDim > 1 || interleavedDim < 0) {
 -            new IndexOutOfRangeException(interleavedDim);
 +            throw new IndexOutOfRangeException(interleavedDim);
          }
-         final int width = d.length;
-         final int height = d[0].length;
+         final int w = i.length;
+         final int h = i[0].length;
          Complex[][] c;
          if (interleavedDim == 0) {
-             c = new Complex[width / 2][height];
-             for (int x = 0; x < width / 2; x++) {
-                 for (int y = 0; y < height; y++) {
-                     c[x][y] = new Complex(d[x * 2][y], d[x * 2 + 1][y]);
+             c = new Complex[w / 2][h];
+             for (int x = 0; x < w / 2; x++) {
+                 for (int y = 0; y < h; y++) {
+                     c[x][y] = new Complex(i[x * 2][y], i[x * 2 + 1][y]);
                  }
              }
          } else {
@@@ -1032,22 -1256,22 +1256,22 @@@
       * @param interleavedDim Depth level of the array to interleave
       * @return 3D {@code Complex} array
       *
-      * @since 4.0
+      * @since 1.0
       */
-     public static Complex[][][] interleaved2Complex(double[][][] d, int interleavedDim)
{
+     public static Complex[][][] interleaved2Complex(double[][][] i, int interleavedDim)
{
          if (interleavedDim > 2 || interleavedDim < 0) {
 -            new IndexOutOfRangeException(interleavedDim);
 +            throw new IndexOutOfRangeException(interleavedDim);
          }
-         final int width = d.length;
-         final int height = d[0].length;
-         final int depth = d[0][0].length;
+         final int w = i.length;
+         final int h = i[0].length;
+         final int d = i[0][0].length;
          Complex[][][] c;
          if (interleavedDim == 0) {
-             c = new Complex[width / 2][height][depth];
-             for (int x = 0; x < width / 2; x++) {
-                 for (int y = 0; y < height; y++) {
-                     for (int z = 0; z < depth; z++) {
-                         c[x][y][z] = new Complex(d[x * 2][y][z], d[x * 2 + 1][y][z]);
+             c = new Complex[w / 2][h][d];
+             for (int x = 0; x < w / 2; x++) {
+                 for (int y = 0; y < h; y++) {
+                     for (int z = 0; z < d; z++) {
+                         c[x][y][z] = new Complex(i[x * 2][y][z], i[x * 2 + 1][y][z]);
                      }
                  }
              }
@@@ -1095,20 -1386,20 +1386,20 @@@
       * @param interleavedDim Depth level of the array to interleave
       * @return 2D {@code Complex} array
       *
-      * @since 4.0
+      * @since 1.0
       */
-     public static Complex[][] interleaved2Complex(float[][] d, int interleavedDim) {
+     public static Complex[][] interleaved2Complex(float[][] i, int interleavedDim) {
          if (interleavedDim > 1 || interleavedDim < 0) {
 -            new IndexOutOfRangeException(interleavedDim);
 +            throw new IndexOutOfRangeException(interleavedDim);
          }
-         final int width = d.length;
-         final int height = d[0].length;
+         final int w = i.length;
+         final int h = i[0].length;
          Complex[][] c;
          if (interleavedDim == 0) {
-             c = new Complex[width / 2][height];
-             for (int x = 0; x < width / 2; x++) {
-                 for (int y = 0; y < height; y++) {
-                     c[x][y] = new Complex(d[x * 2][y], d[x * 2 + 1][y]);
+             c = new Complex[w / 2][h];
+             for (int x = 0; x < w / 2; x++) {
+                 for (int y = 0; y < h; y++) {
+                     c[x][y] = new Complex(i[x * 2][y], i[x * 2 + 1][y]);
                  }
              }
          } else {
@@@ -1144,22 -1435,22 +1435,22 @@@
       * @param interleavedDim Depth level of the array to interleave
       * @return 3D {@code Complex} array
       *
-      * @since 4.0
+      * @since 1.0
       */
-     public static Complex[][][] interleaved2Complex(float[][][] d, int interleavedDim) {
+     public static Complex[][][] interleaved2Complex(float[][][] i, int interleavedDim) {
          if (interleavedDim > 2 || interleavedDim < 0) {
 -            new IndexOutOfRangeException(interleavedDim);
 +            throw new IndexOutOfRangeException(interleavedDim);
          }
-         final int width = d.length;
-         final int height = d[0].length;
-         final int depth = d[0][0].length;
+         final int w = i.length;
+         final int h = i[0].length;
+         final int d = i[0][0].length;
          Complex[][][] c;
          if (interleavedDim == 0) {
-             c = new Complex[width / 2][height][depth];
-             for (int x = 0; x < width/2; x ++) {
-                 for (int y = 0; y < height; y++) {
-                     for (int z = 0; z < depth; z++) {
-                         c[x][y][z] = new Complex(d[x * 2][y][z], d[x * 2 + 1][y][z]);
+             c = new Complex[w / 2][h][d];
+             for (int x = 0; x < w/2; x ++) {
+                 for (int y = 0; y < h; y++) {
+                     for (int z = 0; z < d; z++) {
+                         c[x][y][z] = new Complex(i[x * 2][y][z], i[x * 2 + 1][y][z]);
                      }
                  }
              }


Mime
View raw message