[mlpack-svn] r17177 - mlpack/trunk/src/mlpack/core/tree/rectangle_tree

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Sep 12 15:02:56 EDT 2014


Author: rcurtin
Date: Fri Sep 12 15:02:56 2014
New Revision: 17177

Log:
Fix some more signed/unsigned comparison warnings that I introduced with the
previous revision.


Modified:
   mlpack/trunk/src/mlpack/core/tree/rectangle_tree/r_star_tree_split_impl.hpp
   mlpack/trunk/src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp
   mlpack/trunk/src/mlpack/core/tree/rectangle_tree/x_tree_split_impl.hpp

Modified: mlpack/trunk/src/mlpack/core/tree/rectangle_tree/r_star_tree_split_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/tree/rectangle_tree/r_star_tree_split_impl.hpp	(original)
+++ mlpack/trunk/src/mlpack/core/tree/rectangle_tree/r_star_tree_split_impl.hpp	Fri Sep 12 15:02:56 2014
@@ -132,7 +132,7 @@
       // tree->MinLeafSize() + i points in one rectangle and the rest in
       // another.  Then we calculate the three scores for that distribution.
 
-      int cutOff = tree->MinLeafSize() + i;
+      size_t cutOff = tree->MinLeafSize() + i;
 
       // We'll calculate the max and min in each dimension by hand to save time.
       std::vector<double> maxG1(tree->Bound().Dim());
@@ -396,7 +396,7 @@
       // tree->MinNumChildren() + i points in one rectangle and the rest in
       // another.  Then we calculate the three scores for that distribution.
 
-      int cutOff = tree->MinNumChildren() + i;
+      size_t cutOff = tree->MinNumChildren() + i;
 
       // We'll calculate the max and min in each dimension by hand to save time.
       std::vector<double> maxG1(tree->Bound().Dim());
@@ -508,7 +508,7 @@
       // tree->MinNumChildren() + i points in one rectangle and the rest in
       // another.  Then we calculate the three scores for that distribution.
 
-      int cutOff = tree->MinNumChildren() + i;
+      size_t cutOff = tree->MinNumChildren() + i;
 
       // We'll calculate the max and min in each dimension by hand to save time.
       std::vector<double> maxG1(tree->Bound().Dim());

Modified: mlpack/trunk/src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp	(original)
+++ mlpack/trunk/src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp	Fri Sep 12 15:02:56 2014
@@ -240,7 +240,7 @@
     const int intI,
     const int intJ)
 {
-  int end = oldTree->Count();
+  size_t end = oldTree->Count();
 
   assert(end > 1); // If this isn't true, the tree is really weird.
 
@@ -294,7 +294,7 @@
     // First, calculate the starting volume.
     double volOne = 1.0;
     double volTwo = 1.0;
-    for (int i = 0; i < oldTree->Bound().Dim(); i++)
+    for (size_t i = 0; i < oldTree->Bound().Dim(); i++)
     {
       volOne *= treeOne->Bound()[i].Width();
       volTwo *= treeTwo->Bound()[i].Width();
@@ -382,7 +382,7 @@
     const int intJ)
 {
 
-  int end = oldTree->NumChildren();
+  size_t end = oldTree->NumChildren();
   assert(end > 1); // If this isn't true, the tree is really weird.
 
   assert(intI != intJ);

Modified: mlpack/trunk/src/mlpack/core/tree/rectangle_tree/x_tree_split_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/tree/rectangle_tree/x_tree_split_impl.hpp	(original)
+++ mlpack/trunk/src/mlpack/core/tree/rectangle_tree/x_tree_split_impl.hpp	Fri Sep 12 15:02:56 2014
@@ -415,7 +415,8 @@
     }
 
     // Track the minOverlapSplit data
-    if(minOverlapSplitDimension != -1 && j == minOverlapSplitDimension) {
+    if(minOverlapSplitDimension != tree->Bound().Dim() &&
+       j == minOverlapSplitDimension) {
       for(size_t i = 0; i < overlapedAreas.size(); i++) {
         if(overlapedAreas[i] < bestScoreMinOverlapSplit) {
           bestScoreMinOverlapSplit = overlapedAreas[i];
@@ -516,7 +517,8 @@
     }
 
     // Track the minOverlapSplit data
-    if(minOverlapSplitDimension != -1 && j == minOverlapSplitDimension) {
+    if(minOverlapSplitDimension != tree->Bound().Dim() &&
+       j == minOverlapSplitDimension) {
       for(size_t i = 0; i < overlapedAreas.size(); i++) {
         if(overlapedAreas[i] < bestScoreMinOverlapSplit) {
           minOverlapSplitUsesHi = true;
@@ -576,7 +578,7 @@
   // a "super node" (more accurately we resize this one to make it a super node).
   if(useMinOverlapSplit) {
     // If there is a dimension that might work, try that.
-    if(minOverlapSplitDimension != -1 && bestScoreMinOverlapSplit / areaOfBestMinOverlapSplit < MAX_OVERLAP) {
+    if(minOverlapSplitDimension != tree->Bound().Dim() && bestScoreMinOverlapSplit / areaOfBestMinOverlapSplit < MAX_OVERLAP) {
       std::vector<sortStruct> sorted2(tree->NumChildren());
       if (minOverlapSplitUsesHi) {
         for (size_t i = 0; i < sorted2.size(); i++) {
@@ -584,7 +586,7 @@
           sorted2[i].n = i;
         }
       } else {
-        for (int i = 0; i < sorted2.size(); i++) {
+        for (size_t i = 0; i < sorted2.size(); i++) {
           sorted2[i].d = tree->Children()[i]->Bound()[bestAxis].Lo();
           sorted2[i].n = i;
         }



More information about the mlpack-svn mailing list