[mlpack-svn] r11572 - mlpack/trunk/src/mlpack/core/tree

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Tue Feb 21 15:48:47 EST 2012


Author: jcline3
Date: 2012-02-21 15:48:47 -0500 (Tue, 21 Feb 2012)
New Revision: 11572

Modified:
   mlpack/trunk/src/mlpack/core/tree/mrkd_statistic.hpp
Log:
Make this actually compile when used with BinarySpaceTree


Modified: mlpack/trunk/src/mlpack/core/tree/mrkd_statistic.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/tree/mrkd_statistic.hpp	2012-02-21 19:07:54 UTC (rev 11571)
+++ mlpack/trunk/src/mlpack/core/tree/mrkd_statistic.hpp	2012-02-21 20:48:47 UTC (rev 11572)
@@ -39,18 +39,18 @@
                    const size_t begin,
                    const size_t count)
     :
-      dataset(dataset),
+      dataset(&dataset),
       begin(begin),
       count(count)
     {
       centerOfMass = dataset[begin];
-      for(int i = begin+1; i < begin+count; ++i)
-        centerOfMass += dataset[i];
+      for(size_t i = begin+1; i < begin+count; ++i)
+        centerOfMass += dataset.row(i);
       centerOfMass /= count;
 
       sumOfSquaredNorms = 0.0;
-      for(int i = begin; i < begin+count; ++i)
-        sumOfSquaredNorms += arma::norm(dataset[i], 2);
+      for(size_t i = begin; i < begin+count; ++i)
+        sumOfSquaredNorms += arma::norm(dataset.row(i), 2);
     }
 
     /**
@@ -70,11 +70,11 @@
                    const MRKDStatistic& leftStat,
                    const MRKDStatistic& rightStat)
     :
-      dataset(dataset),
+      dataset(&dataset),
       begin(begin),
       count(count),
-      leftStat(leftStat),
-      rightStat(rightStat)
+      leftStat(&leftStat),
+      rightStat(&rightStat)
     {
       sumOfSquaredNorms = leftStat.sumOfSquaredNorms + rightStat.sumOfSquaredNorms;
 
@@ -85,14 +85,14 @@
 
     //! The data points this object contains
     const arma::mat* dataset;
+    //! The initial item in the dataset, so we don't have to make a copy
+    size_t begin;
+    //! The number of items in the dataset
+    size_t count;
     //! The left child 
     const MRKDStatistic* leftStat;
     //! The right child 
     const MRKDStatistic* rightStat;
-    //! The initial item in the dataset, so we don't have to make a copy
-    const size_t begin;
-    //! The number of items in the dataset
-    const size_t count;
 
     // Computed statistics
     //! The center of mass for this dataset




More information about the mlpack-svn mailing list