From af653723d6413f5f24c8cbc8bb57dd5fdee953ac Mon Sep 17 00:00:00 2001 From: Marcus Edel Date: Mon, 1 Jan 2018 15:24:04 +0100 Subject: [PATCH] Adjust SplitType/TypeInfo structure; match with the existing PerformSplit interface. --- src/mlpack/core/tree/octree/octree.hpp | 17 ++++++++++------- src/mlpack/core/tree/octree/octree_impl.hpp | 8 ++++---- 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/src/mlpack/core/tree/octree/octree.hpp b/src/mlpack/core/tree/octree/octree.hpp index b746b45855..78184d30f7 100644 --- a/src/mlpack/core/tree/octree/octree.hpp +++ b/src/mlpack/core/tree/octree/octree.hpp @@ -428,15 +428,18 @@ class Octree /** * This is used for sorting points while splitting. */ - struct SplitInfo + struct SplitType { - //! Create the SplitInfo object. - SplitInfo(const size_t d, const arma::vec& c) : d(d), center(c) {} + struct SplitInfo + { + //! Create the SplitInfo object. + SplitInfo(const size_t d, const arma::vec& c) : d(d), center(c) {} - //! The dimension we are splitting on. - size_t d; - //! The center of the node. - const arma::vec& center; + //! The dimension we are splitting on. + size_t d; + //! The center of the node. + const arma::vec& center; + }; template static bool AssignToLeftNode(const VecType& point, const SplitInfo& s) diff --git a/src/mlpack/core/tree/octree/octree_impl.hpp b/src/mlpack/core/tree/octree/octree_impl.hpp index 2253de14d0..ac5211da7f 100644 --- a/src/mlpack/core/tree/octree/octree_impl.hpp +++ b/src/mlpack/core/tree/octree/octree_impl.hpp @@ -695,8 +695,8 @@ void Octree::SplitNode( // children of index 2^(d - 1) - 1 and less will be on the left side, and // all points belonging to children of index 2^(d - 1) and above will be on // the right side. - SplitInfo s(d, center); - const size_t firstRight = split::PerformSplit(*dataset, + typename SplitType::SplitInfo s(d, center); + const size_t firstRight = split::PerformSplit(*dataset, childBegin, childCount, s); // We can set the first index of the right child. The first index of the @@ -797,8 +797,8 @@ void Octree::SplitNode( // children of index 2^(d - 1) - 1 and less will be on the left side, and // all points belonging to children of index 2^(d - 1) and above will be on // the right side. - SplitInfo s(d, center); - const size_t firstRight = split::PerformSplit(*dataset, + typename SplitType::SplitInfo s(d, center); + const size_t firstRight = split::PerformSplit(*dataset, childBegin, childCount, s, oldFromNew); // We can set the first index of the right child. The first index of the