[mlpack] 04/149: Fix some more signed/unsigned comparison warnings that I introduced with the previous revision.

Barak A. Pearlmutter barak+git at pearlmutter.net
Sat May 2 09:11:03 UTC 2015


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch svn-trunk
in repository mlpack.

commit bb74e399013594d65ab2062976103fd63c821f5e
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Fri Sep 12 19:02:56 2014 +0000

    Fix some more signed/unsigned comparison warnings that I introduced with the
    previous revision.
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@17177 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 src/mlpack/core/tree/rectangle_tree/r_star_tree_split_impl.hpp |  6 +++---
 src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp      |  6 +++---
 src/mlpack/core/tree/rectangle_tree/x_tree_split_impl.hpp      | 10 ++++++----
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/mlpack/core/tree/rectangle_tree/r_star_tree_split_impl.hpp b/src/mlpack/core/tree/rectangle_tree/r_star_tree_split_impl.hpp
index 2d771c0..8aef253 100644
--- a/src/mlpack/core/tree/rectangle_tree/r_star_tree_split_impl.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/r_star_tree_split_impl.hpp
@@ -132,7 +132,7 @@ void RStarTreeSplit<DescentType, StatisticType, MatType>::SplitLeafNode(
       // 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 @@ bool RStarTreeSplit<DescentType, StatisticType, MatType>::SplitNonLeafNode(
       // 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 @@ bool RStarTreeSplit<DescentType, StatisticType, MatType>::SplitNonLeafNode(
       // 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());
diff --git a/src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp b/src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp
index 22aa7a1..417b5ff 100644
--- a/src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp
@@ -240,7 +240,7 @@ void RTreeSplit<DescentType, StatisticType, MatType>::AssignPointDestNode(
     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 @@ void RTreeSplit<DescentType, StatisticType, MatType>::AssignPointDestNode(
     // 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 @@ void RTreeSplit<DescentType, StatisticType, MatType>::AssignNodeDestNode(
     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);
diff --git a/src/mlpack/core/tree/rectangle_tree/x_tree_split_impl.hpp b/src/mlpack/core/tree/rectangle_tree/x_tree_split_impl.hpp
index 5ab24ff..3f527cf 100644
--- a/src/mlpack/core/tree/rectangle_tree/x_tree_split_impl.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/x_tree_split_impl.hpp
@@ -415,7 +415,8 @@ bool XTreeSplit<DescentType, StatisticType, MatType>::SplitNonLeafNode(
     }
 
     // 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 @@ bool XTreeSplit<DescentType, StatisticType, MatType>::SplitNonLeafNode(
     }
 
     // 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 @@ bool XTreeSplit<DescentType, StatisticType, MatType>::SplitNonLeafNode(
   // 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 @@ bool XTreeSplit<DescentType, StatisticType, MatType>::SplitNonLeafNode(
           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;
         }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git



More information about the debian-science-commits mailing list