[mlpack-svn] r13334 - in mlpack/trunk/src/mlpack/core/tree: . binary_space_tree
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Sat Aug 4 23:00:56 EDT 2012
Author: rcurtin
Date: 2012-08-04 23:00:55 -0400 (Sat, 04 Aug 2012)
New Revision: 13334
Added:
mlpack/trunk/src/mlpack/core/tree/binary_space_tree.hpp
mlpack/trunk/src/mlpack/core/tree/binary_space_tree/single_tree_traverser.hpp
mlpack/trunk/src/mlpack/core/tree/cover_tree.hpp
Log:
Add a few files we forgot, including the convenience include files which include
both trees and traversers.
Added: mlpack/trunk/src/mlpack/core/tree/binary_space_tree/single_tree_traverser.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/tree/binary_space_tree/single_tree_traverser.hpp (rev 0)
+++ mlpack/trunk/src/mlpack/core/tree/binary_space_tree/single_tree_traverser.hpp 2012-08-05 03:00:55 UTC (rev 13334)
@@ -0,0 +1,57 @@
+/**
+ * @file single_tree_traverser.hpp
+ * @author Ryan Curtin
+ *
+ * A nested class of BinarySpaceTree which traverses the entire tree with a
+ * given set of rules which indicate the branches which can be pruned and the
+ * order in which to recurse. This traverser is a depth-first traverser.
+ */
+#ifndef __MLPACK_CORE_TREE_BINARY_SPACE_TREE_SINGLE_TREE_TRAVERSER_HPP
+#define __MLPACK_CORE_TREE_BINARY_SPACE_TREE_SINGLE_TREE_TRAVERSER_HPP
+
+#include <mlpack/core.hpp>
+
+#include "binary_space_tree.hpp"
+
+namespace mlpack {
+namespace tree {
+
+template<typename BoundType, typename StatisticType, typename MatType>
+template<typename RuleType>
+class BinarySpaceTree<BoundType, StatisticType, MatType>::SingleTreeTraverser
+{
+ public:
+ /**
+ * Instantiate the single tree traverser with the given rule set.
+ */
+ SingleTreeTraverser(RuleType& rule);
+
+ /**
+ * Traverse the tree with the given point.
+ *
+ * @param queryIndex The index of the point in the query set which is being
+ * used as the query point.
+ * @param referenceNode The tree node to be traversed.
+ */
+ void Traverse(const size_t queryIndex, BinarySpaceTree& referenceNode);
+
+ //! Get the number of prunes.
+ size_t NumPrunes() const { return numPrunes; }
+ //! Modify the number of prunes.
+ size_t& NumPrunes() { return numPrunes; }
+
+ private:
+ //! Reference to the rules with which the tree will be traversed.
+ RuleType& rule;
+
+ //! The number of nodes which have been pruned during traversal.
+ size_t numPrunes;
+};
+
+}; // namespace tree
+}; // namespace mlpack
+
+// Include implementation.
+#include "single_tree_traverser_impl.hpp"
+
+#endif
Added: mlpack/trunk/src/mlpack/core/tree/binary_space_tree.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/tree/binary_space_tree.hpp (rev 0)
+++ mlpack/trunk/src/mlpack/core/tree/binary_space_tree.hpp 2012-08-05 03:00:55 UTC (rev 13334)
@@ -0,0 +1,15 @@
+/**
+ * @file binary_space_tree.hpp
+ * @author Ryan Curtin
+ *
+ * Include all the necessary files to use the BinarySpaceTree class.
+ */
+#ifndef __MLPACK_CORE_TREE_BINARY_SPACE_TREE_HPP
+#define __MLPACK_CORE_TREE_BINARY_SPACE_TREE_HPP
+
+#include "bounds.hpp"
+#include "binary_space_tree/binary_space_tree.hpp"
+#include "binary_space_tree/single_tree_traverser.hpp"
+#include "binary_space_tree/dual_tree_traverser.hpp"
+
+#endif
Added: mlpack/trunk/src/mlpack/core/tree/cover_tree.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/tree/cover_tree.hpp (rev 0)
+++ mlpack/trunk/src/mlpack/core/tree/cover_tree.hpp 2012-08-05 03:00:55 UTC (rev 13334)
@@ -0,0 +1,15 @@
+/**
+ * @file cover_tree.hpp
+ * @author Ryan Curtin
+ *
+ * Includes all the necessary files to use the CoverTree class.
+ */
+#ifndef __MLPACK_CORE_TREE_COVER_TREE_HPP
+#define __MLPACK_CORE_TREE_COVER_TREE_HPP
+
+#include "bounds.hpp"
+#include "cover_tree/cover_tree.hpp"
+#include "cover_tree/single_tree_traverser.hpp"
+#include "cover_tree/dual_tree_traverser.hpp"
+
+#endif
More information about the mlpack-svn
mailing list