[mlpack-svn] r16551 - mlpack/trunk/src/mlpack/core/tree/rectangle_tree
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Mon May 26 11:33:19 EDT 2014
Author: andrewmw94
Date: Mon May 26 11:33:19 2014
New Revision: 16551
Log:
more R tree stuff. Still no build
Modified:
mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp
Modified: mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp (original)
+++ mlpack/trunk/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp Mon May 26 11:33:19 2014
@@ -77,8 +77,8 @@
}
template<typename StatisticType,
- typename MatType,
- typename SplitType>
+ typename MatType,
+ typename SplitType>
inline bool BinarySpaceTree<StatisticType, MatType, SplitType>::
IsLeaf() const
{
@@ -86,6 +86,115 @@
}
/**
+ * Returns the number of children in this node.
+ */
+template<typename StatisticType,
+ typename MatType,
+ typename SplitType>
+inline size_t RectangleTree<StatisticType, MatType, SplitType>::
+ NumChildren() const
+{
+ return NumChildren;
+}
+
+/**
+ * Return a bound on the furthest point in the node form the centroid.
+ * This returns 0 unless the node is a leaf.
+ */
+template<typename StatisticType,
+ typename MatType,
+ typename SplitType>
+inline double RectangleTree<StatisticType, MatType, SplitType>::
+FurthestPointDistance() const
+{
+ if(!IsLeaf())
+ return 0.0;
+
+ // Otherwise return the distance from the centroid to a corner of the bound.
+ return 0.5 * bound.Diameter();
+}
+
+/**
+ * Return the furthest possible descendant distance. This returns the maximum
+ * distance from the centroid to the edge of the bound and not the empirical
+ * quantity which is the actual furthest descendant distance. So the actual
+ * furthest descendant distance may be less than what this method returns (but
+ * it will never be greater than this).
+ */
+template<typename StatisiticType,
+ typename MatType,
+ typename SplitType>
+inline double RectangleTree<StatisticType, MatType, SplitType>::
+ FurthestDescendantDistance() const
+{
+ return furthestDescendantDistance;
+}
+
+/**
+ * Return the specified child.
+ */
+template<typename StatisticType,
+ typename MatType,
+ typename SplitType>
+inline RectangleTree<StatisticType, MatType, SplitType>&
+ RectangleTree<StatisticType, MatType, SplitType>::
+ Child(const size_t child) const
+{
+ return children[child];
+}
+
+/**
+ * Return the number of points contained in this node. Zero if it is not a leaf.
+ */
+template<typename StatisticType,
+ typename MatType,
+ typename SplitType>
+inline size_t RectangleTree<StatisticType, MatType, SplitType>::
+ NumPoints() const
+{
+ if(numChildren == 0)
+ return 0;
+
+ return count;
+}
+
+/**
+ * Return the number of descendants contained in this node. MEANINIGLESS AS IT CURRENTLY STANDS.
+ */
+template<typename StatisticType,
+ typename MatType,
+ typename SplitType>
+inline size_t RectangleTree<StatisticType, MatType, SplitType>::
+ NumDescendants() const
+{
+ return count;
+}
+
+/**
+ * Return the index of a particular descendant contained in this node. SEE OTHER WARNINGS
+ */
+template<typename StatisticType,
+ typename MatType,
+ typename SplitType>
+inline size_t RectangleTree<StatisticType, MatType, SplitType>::
+ Descendant(const size_t index> const
+{
+ return (begin + index);
+}
+
+/**
+ * Return the index of a particular point contained in this node. SEE OTHER WARNINGS
+ */
+template<typename StatisticType,
+ typename MatType,
+ typename SplitType>
+inline size_t RectangleTree<StatisticType, MatType, SplitType>::
+ Point(const size_t index> const
+{
+ return (begin + index);
+}
+
+/**
* Return the last point in the tree. SINCE THE TREE STORES DATA SEPARATELY IN EACH LEAF
* THIS IS CURRENTLY MEANINGLESS.
*/
More information about the mlpack-svn
mailing list