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 565f7dbf40..fdfc7bdb9a 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::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, 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::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, DescentType, StatisticType, MatType>(NULL); - + RectangleTree, 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; }