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 2011/04/01 11:24:54 UTC

svn commit: r1087630 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math/stat/correlation/PearsonsCorrelation.java test/java/org/apache/commons/math/stat/correlation/PearsonsCorrelationTest.java

Author: erans
Date: Fri Apr  1 09:24:53 2011
New Revision: 1087630

URL: http://svn.apache.org/viewvc?rev=1087630&view=rev
Log:
MATH-549
Reverted changes performed in revision 1086057.

Modified:
    commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/correlation/PearsonsCorrelation.java
    commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/correlation/PearsonsCorrelationTest.java

Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/correlation/PearsonsCorrelation.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/correlation/PearsonsCorrelation.java?rev=1087630&r1=1087629&r2=1087630&view=diff
==============================================================================
--- commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/correlation/PearsonsCorrelation.java (original)
+++ commons/proper/math/trunk/src/main/java/org/apache/commons/math/stat/correlation/PearsonsCorrelation.java Fri Apr  1 09:24:53 2011
@@ -225,8 +225,7 @@ public class PearsonsCorrelation {
      * @throws  IllegalArgumentException if the arrays lengths do not match or
      * there is insufficient data
      */
-    public static double correlation(final double[] xArray, final double[] yArray)
-        throws IllegalArgumentException {
+    public double correlation(final double[] xArray, final double[] yArray) throws IllegalArgumentException {
         SimpleRegression regression = new SimpleRegression();
         if (xArray.length != yArray.length) {
             throw new DimensionMismatchException(xArray.length, yArray.length);

Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/correlation/PearsonsCorrelationTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/correlation/PearsonsCorrelationTest.java?rev=1087630&r1=1087629&r2=1087630&view=diff
==============================================================================
--- commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/correlation/PearsonsCorrelationTest.java (original)
+++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/stat/correlation/PearsonsCorrelationTest.java Fri Apr  1 09:24:53 2011
@@ -194,7 +194,7 @@ public class PearsonsCorrelationTest {
     public void testConstant() {
         double[] noVariance = new double[] {1, 1, 1, 1};
         double[] values = new double[] {1, 2, 3, 4};
-        Assert.assertTrue(Double.isNaN(PearsonsCorrelation.correlation(noVariance, values)));
+        Assert.assertTrue(Double.isNaN(new PearsonsCorrelation().correlation(noVariance, values)));
     }
 
 
@@ -207,7 +207,7 @@ public class PearsonsCorrelationTest {
         double[] one = new double[] {1};
         double[] two = new double[] {2};
         try {
-            PearsonsCorrelation.correlation(one, two);
+            new PearsonsCorrelation().correlation(one, two);
             Assert.fail("Expecting IllegalArgumentException");
         } catch (IllegalArgumentException ex) {
             // Expected
@@ -277,7 +277,7 @@ public class PearsonsCorrelationTest {
         double[][] data = matrix.getData();
         double[] x = matrix.getColumn(0);
         double[] y = matrix.getColumn(1);
-        Assert.assertEquals(PearsonsCorrelation.correlation(x, y),
+        Assert.assertEquals(new PearsonsCorrelation().correlation(x, y),
                 corrInstance.getCorrelationMatrix().getEntry(0, 1), Double.MIN_VALUE);
         TestUtils.assertEquals("Correlation matrix", corrInstance.getCorrelationMatrix(),
                 new PearsonsCorrelation().computeCorrelationMatrix(data), Double.MIN_VALUE);