couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r664093 - /incubator/couchdb/trunk/share/www/script/couch_tests.js
Date Fri, 06 Jun 2008 19:30:34 GMT
Author: damien
Date: Fri Jun  6 12:30:34 2008
New Revision: 664093

URL: http://svn.apache.org/viewvc?rev=664093&view=rev
Log:
Added comments and clarity to the reduce/combine test. again

Modified:
    incubator/couchdb/trunk/share/www/script/couch_tests.js

Modified: incubator/couchdb/trunk/share/www/script/couch_tests.js
URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/share/www/script/couch_tests.js?rev=664093&r1=664092&r2=664093&view=diff
==============================================================================
--- incubator/couchdb/trunk/share/www/script/couch_tests.js [utf-8] (original)
+++ incubator/couchdb/trunk/share/www/script/couch_tests.js [utf-8] Fri Jun  6 12:30:34 2008
@@ -361,14 +361,11 @@
         if (combine) {
           // This is the combine phase, we are re-reducing previosuly returned
           // reduce values.
-          
           for(var i in values) {
             count = count + values[i].count;
             total = total + values[i].total;
             sqrTotal = sqrTotal + (values[i].sqrTotal * values[i].sqrTotal);
           }
-          var variance =  (sqrTotal - ((total * total)/count)) / count;
-          stdDeviation = Math.sqrt(variance);
         }
         else {
           // This is the reduce phase, we are reducing over emitted values from
@@ -378,12 +375,13 @@
             sqrTotal = sqrTotal + (values[i] * values[i])
           }
           count = values.length;
-          var variance =  (sqrTotal - ((total * total)/count)) / count;
-          stdDeviation = Math.sqrt(variance);
         }
         
-        // the reduce results. It contains enough information to compute
-        // further reduce results, and the final output values.
+        var variance =  (sqrTotal - ((total * total)/count)) / count;
+        stdDeviation = Math.sqrt(variance);
+          
+        // the reduce result. It contains enough information to combine with 
+        // more reduce results, and the final output values.
         return {"stdDeviation":stdDeviation,"count":count,
             "total":total,"sqrTotal":sqrTotal};
       };



Mime
View raw message