[mlpack] 62/324: keep the root node at the same address.

Barak A. Pearlmutter barak+git at cs.nuim.ie
Sun Aug 17 08:21:56 UTC 2014


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

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

commit bc95ab6c983e2f866d0a4a9d48c86541a431342b
Author: andrewmw94 <andrewmw94 at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Thu Jun 19 20:34:24 2014 +0000

    keep the root node at the same address.
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16693 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 src/mlpack/core/tree/rectangle_tree/r_tree_split_impl.hpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

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 565f7db..fdfc7bd 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
@@ -35,7 +35,10 @@ void RTreeSplit<DescentType, StatisticType, MatType>::SplitLeafNode(
   // If we are splitting the root node, we need will do things differently so that the constructor
   // and other methods don't confuse the end user by giving an address of another node.
   if(tree->Parent() == NULL) {
-    
+    RectangleTree<RTreeSplit<DescentType, StatisticType, MatType>, DescentType,  StatisticType, MatType> copy = *tree; // We actually want to copy this way.  Pointers and everything.
+    copy.Parent() = tree;
+    tree->Count() = 0;
+    tree->Children()[++(tree->NumChildren())] = © // Because this was a leaf node, numChildren must be 0.
     return;
   }
   
@@ -100,8 +103,10 @@ bool RTreeSplit<DescentType, StatisticType, MatType>::SplitNonLeafNode(
   // If we are splitting the root node, we need will do things differently so that the constructor
   // and other methods don't confuse the end user by giving an address of another node.
   if(tree->Parent() == NULL) {
-    //tree->Parent() = new RectangleTree<RTreeSplit<DescentType, StatisticType, MatType>, DescentType,  StatisticType, MatType>(NULL);
-    
+    RectangleTree<RTreeSplit<DescentType, StatisticType, MatType>, DescentType,  StatisticType, MatType> copy = *tree; // We actually want to copy this way.  Pointers and everything.
+    copy.Parent() = tree;
+    tree->NumChildren() = 0;
+    tree->Children()[++(tree->NumChildren())] = © // Because this was a leaf node, numChildren must be 0.
     return true;
   }
   

-- 
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