[mlpack-git] master: Add traits and main include file. (a7bf71a)

gitdub at mlpack.org gitdub at mlpack.org
Fri Sep 23 17:21:23 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/9ef7339d40550a974b3939e9fcb966fac2c09065...ebdb5abeaa3fd621a06ae663862bb72df76d2b40

>---------------------------------------------------------------

commit a7bf71a91d7cea1a893f8a7ecfe239ce8a61e3ef
Author: Ryan Curtin <ryan at ratml.org>
Date:   Fri Sep 23 17:21:23 2016 -0400

    Add traits and main include file.


>---------------------------------------------------------------

a7bf71a91d7cea1a893f8a7ecfe239ce8a61e3ef
 src/mlpack/core/tree/octree.hpp        | 15 ++++++++
 src/mlpack/core/tree/octree/traits.hpp | 66 ++++++++++++++++++++++++++++++++++
 2 files changed, 81 insertions(+)

diff --git a/src/mlpack/core/tree/octree.hpp b/src/mlpack/core/tree/octree.hpp
new file mode 100644
index 0000000..f60f738
--- /dev/null
+++ b/src/mlpack/core/tree/octree.hpp
@@ -0,0 +1,15 @@
+/**
+ * @file octree.hpp
+ * @author Ryan Curtin
+ *
+ * Include all the necessary files to use the Octree class.
+ */
+#ifndef MLPACK_CORE_TREE_OCTREE_HPP
+#define MLPACK_CORE_TREE_OCTREE_HPP
+
+#include <mlpack/core.hpp>
+#include "bounds.hpp"
+#include "octree/octree.hpp"
+#include "octree/traits.hpp"
+
+#endif
diff --git a/src/mlpack/core/tree/octree/traits.hpp b/src/mlpack/core/tree/octree/traits.hpp
new file mode 100644
index 0000000..4a0f956
--- /dev/null
+++ b/src/mlpack/core/tree/octree/traits.hpp
@@ -0,0 +1,66 @@
+/**
+ * @file traits.hpp
+ * @author Ryan Curtin
+ *
+ * Specialization of the TreeTraits class for the Octree class.
+ */
+#ifndef MLPACK_CORE_TREE_OCTREE_TRAITS_HPP
+#define MLPACK_CORE_TREE_OCTREE_TRAITS_HPP
+
+#include <mlpack/core/tree/tree_traits.hpp>
+
+namespace mlpack {
+namespace tree {
+
+/**
+ * This is a specialization of the TreeTraits class to the Octree tree type.  It
+ * defines characteristics of the octree, and is used to help write
+ * tree-independent (but still optimized) tree-based algorithms.  See
+ * mlpack/core/tree/tree_traits.hpp for more information.
+ */
+template<typename MetricType,
+         typename StatisticType,
+         typename MatType>
+class TreeTraits<Octree<MetricType, StatisticType, MatType>>
+{
+ public:
+  /**
+   * No octree nodes will overlap.
+   */
+  static const bool HasOverlappingChildren = false;
+
+  /**
+   * Points are not shared across nodes in the octree.
+   */
+  static const bool HasDuplicatedPoints = false;
+
+  /**
+   * There is no guarantee that the first point in a node is its centroid.
+   */
+  static const bool FirstPointIsCentroid = false;
+
+  /**
+   * Points are not contained at multiple levels of the octree.
+   */
+  static const bool HasSelfChildren = false;
+
+  /**
+   * Points are rearranged during building of the tree.
+   */
+  static const bool RearrangesDataset = true;
+
+  /**
+   * This is not necessarily a binary tree.
+   */
+  static const bool BinaryTree = false;
+
+  /**
+   * NumDescendants() represents the number of unique descendant points.
+   */
+  static const bool UniqueNumDescendants = true;
+};
+
+} // namespace tree
+} // namespace mlpack
+
+#endif




More information about the mlpack-git mailing list