[mlpack-svn] r14367 - mlpack/trunk/src/mlpack/core/tree/cover_tree

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Feb 22 16:57:45 EST 2013


Author: rcurtin
Date: 2013-02-22 16:57:45 -0500 (Fri, 22 Feb 2013)
New Revision: 14367

Modified:
   mlpack/trunk/src/mlpack/core/tree/cover_tree/cover_tree_impl.hpp
Log:
Reset parents correctly in the case of implicit nodes.


Modified: mlpack/trunk/src/mlpack/core/tree/cover_tree/cover_tree_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/tree/cover_tree/cover_tree_impl.hpp	2013-02-22 19:52:19 UTC (rev 14366)
+++ mlpack/trunk/src/mlpack/core/tree/cover_tree/cover_tree_impl.hpp	2013-02-22 21:57:45 UTC (rev 14367)
@@ -78,6 +78,9 @@
     // Now take its child.
     children.push_back(&(old->Child(0)));
 
+    // Set its parent correctly.
+    old->Child(0).Parent() = this;
+
     // Remove its child (so it doesn't delete it).
     old->Children().erase(old->Children().begin() + old->Children().size() - 1);
 
@@ -160,6 +163,9 @@
       // Now take its child.
       children.push_back(&(old->Child(0)));
 
+      // Set its parent correctly.
+      old->Child(0).Parent() = this;
+
       // Remove its child (so it doesn't delete it).
       old->Children().erase(old->Children().begin() + old->Children().size()
           - 1);
@@ -289,6 +295,9 @@
     // Now take its child.
     children.push_back(&(old->Child(0)));
 
+    // Set its parent correctly.
+    old->Child(0).Parent() = this;
+
     // Remove its child (so it doesn't delete it).
     old->Children().erase(old->Children().begin() + old->Children().size() - 1);
 
@@ -393,6 +402,9 @@
       // Now take its child.
       children.push_back(&(old->Child(0)));
 
+      // Set its parent correctly.
+      old->Child(0).Parent() = this;
+
       // Remove its child (so it doesn't delete it).
       old->Children().erase(old->Children().begin() + old->Children().size()
           - 1);




More information about the mlpack-svn mailing list