commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From er...@apache.org
Subject svn commit: r1067278 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/analysis/solvers/ main/java/org/apache/commons/math/optimization/direct/ main/java/org/apache/commons/math/util/ test/java/org/apache/commons/math/optimization/...
Date Fri, 04 Feb 2011 20:43:41 GMT
Author: erans
Date: Fri Feb  4 20:43:41 2011
New Revision: 1067278

URL: http://svn.apache.org/viewvc?rev=1067278&view=rev
Log:
MATH-442
Waiting for paperwork.

Removed:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/optimization/direct/CMAESOptimizer.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/optimization/direct/CMAESOptimizerTest.java
Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/   (props
changed)
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/MathUtilsTest.java

Propchange: commons/proper/math/trunk/src/main/java/org/apache/commons/math/analysis/solvers/
            ('svn:mergeinfo' removed)

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java?rev=1067278&r1=1067277&r2=1067278&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/util/MathUtils.java Fri
Feb  4 20:43:41 2011
@@ -2220,31 +2220,9 @@ public final class MathUtils {
      * @return the copied array.
      */
      public static int[] copyOf(int[] source) {
-         return copyOf(source, source.length);
-     }
-
-    /**
-     * Creates a copy of the {@code source} array.
-     *
-     * @param source Array to be copied.
-     * @return the copied array.
-     */
-     public static double[] copyOf(double[] source) {
-         return copyOf(source, source.length);
-     }
-
-    /**
-     * Creates a copy of the {@code source} array.
-     *
-     * @param source Array to be copied.
-     * @param len Number of entries to copy. If smaller then the source
-     * length, the copy will be truncated, if larger it will padded with
-     * zeroes.
-     * @return the copied array.
-     */
-    public static int[] copyOf(int[] source, int len) {
+         final int len = source.length;
          final int[] output = new int[len];
-         System.arraycopy(source, 0, output, 0, FastMath.min(len, source.length));
+         System.arraycopy(source, 0, output, 0, len);
          return output;
      }
 
@@ -2252,14 +2230,12 @@ public final class MathUtils {
      * Creates a copy of the {@code source} array.
      *
      * @param source Array to be copied.
-     * @param len Number of entries to copy. If smaller then the source
-     * length, the copy will be truncated, if larger it will padded with
-     * zeroes.
      * @return the copied array.
      */
-    public static double[] copyOf(double[] source, int len) {
+     public static double[] copyOf(double[] source) {
+         final int len = source.length;
          final double[] output = new double[len];
-         System.arraycopy(source, 0, output, 0, FastMath.min(len, source.length));
+         System.arraycopy(source, 0, output, 0, len);
          return output;
      }
 }

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/MathUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/MathUtilsTest.java?rev=1067278&r1=1067277&r2=1067278&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/MathUtilsTest.java
(original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/util/MathUtilsTest.java
Fri Feb  4 20:43:41 2011
@@ -1557,35 +1557,6 @@ public final class MathUtilsTest extends
         }
     }
 
-    public void testCopyOfInt2() {
-        final int[] source = { Integer.MIN_VALUE,
-                               -1, 0, 1, 3, 113, 4769,
-                               Integer.MAX_VALUE };
-        final int offset = 3;
-        final int[] dest = MathUtils.copyOf(source, source.length - offset);
-
-        assertEquals(dest.length, source.length - offset);
-        for (int i = 0; i < source.length - offset; i++) {
-            assertEquals(source[i], dest[i]);
-        }
-    }
-
-    public void testCopyOfInt3() {
-        final int[] source = { Integer.MIN_VALUE,
-                               -1, 0, 1, 3, 113, 4769,
-                               Integer.MAX_VALUE };
-        final int offset = 3;
-        final int[] dest = MathUtils.copyOf(source, source.length + offset);
-
-        assertEquals(dest.length, source.length + offset);
-        for (int i = 0; i < source.length; i++) {
-            assertEquals(source[i], dest[i]);
-        }
-        for (int i = source.length; i < source.length + offset; i++) {
-            assertEquals(0, dest[i], 0);
-        }
-    }
-
     public void testCopyOfDouble() {
         final double[] source = { Double.NEGATIVE_INFINITY,
                                   -Double.MAX_VALUE,
@@ -1602,43 +1573,4 @@ public final class MathUtilsTest extends
             assertEquals(source[i], dest[i], 0);
         }
     }
-
-    public void testCopyOfDouble2() {
-        final double[] source = { Double.NEGATIVE_INFINITY,
-                                  -Double.MAX_VALUE,
-                                  -1, 0,
-                                  Double.MIN_VALUE,
-                                  Math.ulp(1d),
-                                  1, 3, 113, 4769,
-                                  Double.MAX_VALUE,
-                                  Double.POSITIVE_INFINITY };
-        final int offset = 3;
-        final double[] dest = MathUtils.copyOf(source, source.length - offset);
-
-        assertEquals(dest.length, source.length - offset);
-        for (int i = 0; i < source.length - offset; i++) {
-            assertEquals(source[i], dest[i], 0);
-        }
-    }
-
-    public void testCopyOfDouble3() {
-        final double[] source = { Double.NEGATIVE_INFINITY,
-                                  -Double.MAX_VALUE,
-                                  -1, 0,
-                                  Double.MIN_VALUE,
-                                  Math.ulp(1d),
-                                  1, 3, 113, 4769,
-                                  Double.MAX_VALUE,
-                                  Double.POSITIVE_INFINITY };
-        final int offset = 3;
-        final double[] dest = MathUtils.copyOf(source, source.length + offset);
-
-        assertEquals(dest.length, source.length + offset);
-        for (int i = 0; i < source.length; i++) {
-            assertEquals(source[i], dest[i], 0);
-        }
-        for (int i = source.length; i < source.length + offset; i++) {
-            assertEquals(0, dest[i], 0);
-        }
-    }
 }



Mime
View raw message