[mlpack-git] master, mlpack-1.0.x: more R tree stuff. Still no build (baba8bd)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 5 21:47:42 EST 2015
Repository : https://github.com/mlpack/mlpack
On branches: master,mlpack-1.0.x
Link : https://github.com/mlpack/mlpack/compare/904762495c039e345beba14c1142fd719b3bd50e...f94823c800ad6f7266995c700b1b630d5ffdcf40
>---------------------------------------------------------------
commit baba8bde7b3774c041aec0d849ace911ad0cc35b
Author: andrewmw94 <andrewmw94 at gmail.com>
Date: Mon May 26 15:33:19 2014 +0000
more R tree stuff. Still no build
>---------------------------------------------------------------
baba8bde7b3774c041aec0d849ace911ad0cc35b
.../tree/rectangle_tree/rectangle_tree_impl.hpp | 113 ++++++++++++++++++++-
1 file changed, 111 insertions(+), 2 deletions(-)
diff --git a/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp b/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp
index df48dcb..ed18b46 100644
--- a/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/rectangle_tree_impl.hpp
@@ -77,8 +77,8 @@ size_t RectangleTree<StatisticType, MatType, SplitType>::
}
template<typename StatisticType,
- typename MatType,
- typename SplitType>
+ typename MatType,
+ typename SplitType>
inline bool BinarySpaceTree<StatisticType, MatType, SplitType>::
IsLeaf() const
{
@@ -86,6 +86,115 @@ inline bool BinarySpaceTree<StatisticType, MatType, SplitType>::
}
/**
+ * 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-git
mailing list