From a7bf71a91d7cea1a893f8a7ecfe239ce8a61e3ef Mon Sep 17 00:00:00 2001 From: Ryan Curtin Date: Fri, 23 Sep 2016 17:21:23 -0400 Subject: [PATCH] Add traits and main include file. --- src/mlpack/core/tree/octree.hpp | 15 ++++++ src/mlpack/core/tree/octree/traits.hpp | 66 ++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 src/mlpack/core/tree/octree.hpp create mode 100644 src/mlpack/core/tree/octree/traits.hpp diff --git a/src/mlpack/core/tree/octree.hpp b/src/mlpack/core/tree/octree.hpp new file mode 100644 index 0000000000..f60f73840a --- /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 +#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 0000000000..4a0f9564c9 --- /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 + +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 +class TreeTraits> +{ + 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