commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r764211 - /commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/Covariance.java
Date Sat, 11 Apr 2009 15:57:04 GMT
Author: psteitz
Date: Sat Apr 11 15:57:03 2009
New Revision: 764211

URL: http://svn.apache.org/viewvc?rev=764211&view=rev
Log:
Fixed incorrect type spec, simplified references.

Modified:
    commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/Covariance.java

Modified: commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/Covariance.java
URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/Covariance.java?rev=764211&r1=764210&r2=764211&view=diff
==============================================================================
--- commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/Covariance.java
(original)
+++ commons/proper/math/trunk/src/java/org/apache/commons/math/stat/correlation/Covariance.java
Sat Apr 11 15:57:03 2009
@@ -187,11 +187,11 @@
         throws IllegalArgumentException {
         Mean mean = new Mean();
         double result = 0d;
-        long length = xArray.length;
+        int length = xArray.length;
         if(length == yArray.length && length > 1) {
             double xMean = mean.evaluate(xArray);
             double yMean = mean.evaluate(yArray);
-            for (int i = 0; i < xArray.length; i++) {
+            for (int i = 0; i < length; i++) {
                 double xDev = xArray[i] - xMean;
                 double yDev = yArray[i] - yMean;
                 result += (xDev * yDev - result) / (i + 1);
@@ -201,7 +201,7 @@
             throw MathRuntimeException.createIllegalArgumentException(
                "arrays must have the same length and both must have at " +
                "least two elements. xArray has size {0}, yArray has {1} elements",
-                    xArray.length, yArray.length);
+                    length, yArray.length);
         }
         return biasCorrected ? result * ((double) length / (double)(length - 1)) : result;
     }



Mime
View raw message