From 191c375a8d733ab68c7ca68bb52386d63eb9bfb9 Mon Sep 17 00:00:00 2001 From: theJonan Date: Tue, 3 Oct 2017 14:10:20 +0300 Subject: [PATCH] CI fixes. --- src/mlpack/core/tree/enumerate_tree.hpp | 38 +++++++++++++----------- src/mlpack/methods/det/dt_utils.hpp | 4 +-- src/mlpack/methods/det/dt_utils_impl.hpp | 5 ++-- 3 files changed, 25 insertions(+), 22 deletions(-) diff --git a/src/mlpack/core/tree/enumerate_tree.hpp b/src/mlpack/core/tree/enumerate_tree.hpp index 7dcf0e258d..734f48df2d 100644 --- a/src/mlpack/core/tree/enumerate_tree.hpp +++ b/src/mlpack/core/tree/enumerate_tree.hpp @@ -17,26 +17,28 @@ namespace mlpack { namespace tree /** Trees and tree-building procedures. */ { namespace enumerate { - // Actual implementation of the enumeration. The problem is the unified detection - // if we're on the root, because Enter and Leave expect the parent being passed. - template - void EnumerateTreeImpl(TreeType* tree, Walker& walker, bool root) +// Actual implementation of the enumeration. The problem is the unified +// detection if we're on the root, because Enter and Leave expect the +// parent being passed. +template +void EnumerateTreeImpl(TreeType* tree, Walker& walker, bool root) +{ + if (root) + walker.Enter(tree, (const TreeType*)nullptr); + + const size_t numChildren = tree->NumChildren(); + for (size_t i = 0; i < numChildren; ++i) { - if (root) - walker.Enter(tree, (const TreeType*)nullptr); - - const size_t numChildren = tree->NumChildren(); - for (size_t i = 0; i < numChildren; ++i) - { - TreeType* child = tree->ChildPtr(i); - walker.Enter(child, tree); - EnumerateTreeImpl(child, walker, false); - walker.Leave(child, tree); - } - - if (root) - walker.Leave(tree, (const TreeType*)nullptr); + TreeType* child = tree->ChildPtr(i); + walker.Enter(child, tree); + EnumerateTreeImpl(child, walker, false); + walker.Leave(child, tree); } + + if (root) + walker.Leave(tree, (const TreeType*)nullptr); +} + } // namespace enumerate /** diff --git a/src/mlpack/methods/det/dt_utils.hpp b/src/mlpack/methods/det/dt_utils.hpp index 9fc81c2541..8e49597936 100644 --- a/src/mlpack/methods/det/dt_utils.hpp +++ b/src/mlpack/methods/det/dt_utils.hpp @@ -77,7 +77,7 @@ DTree* Trainer(MatType& dataset, */ class PathCacher { -public: + public: enum PathFormat { FormatLR, @@ -102,7 +102,7 @@ public: size_t NumNodes() const { return pathCache.size(); } -protected: + protected: typedef std::list > PathType; typedef std::vector > PathCacheType; diff --git a/src/mlpack/methods/det/dt_utils_impl.hpp b/src/mlpack/methods/det/dt_utils_impl.hpp index dcd69e9f23..b453e8d6df 100644 --- a/src/mlpack/methods/det/dt_utils_impl.hpp +++ b/src/mlpack/methods/det/dt_utils_impl.hpp @@ -347,7 +347,8 @@ template PathCacher::PathCacher(PathCacher::PathFormat fmt, DTree* dtree) : format(fmt) { - // Here we use TagTree()'s output to determine the number of _nodes_ in the tree). + // Here we use TagTree()'s output to determine the + // number of _nodes_ in the tree. pathCache.resize(dtree->TagTree(0, true)); pathCache[0] = PathCacheType::value_type(-1, ""); tree::EnumerateTree(dtree, *this); @@ -411,4 +412,4 @@ const std::string& PathCacher::PathFor(int tag) const } // namespace det } // namespace mlpack -#endif +#endif // MLPACK_METHODS_DET_DT_UTILS_IMPL_HPP