[mlpack-svn] r16061 - 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
Fri Nov 22 12:01:59 EST 2013


Author: rcurtin
Date: Fri Nov 22 12:01:59 2013
New Revision: 16061

Log:
Add FurthestPointDistance() function.


Modified:
   mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp
   mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp

Modified: mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp	(original)
+++ mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree.hpp	Fri Nov 22 12:01:59 2013
@@ -285,6 +285,12 @@
   size_t NumChildren() const;
 
   /**
+   * Return the furthest distance to a point held in this node.  If this is not
+   * a leaf node, then the distance is 0 because the node holds no points.
+   */
+  double FurthestPointDistance() const;
+
+  /**
    * 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

Modified: mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp	(original)
+++ mlpack/trunk/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp	Fri Nov 22 12:01:59 2013
@@ -375,6 +375,22 @@
 }
 
 /**
+ * Return a bound on the furthest point in the node from the centroid.  This
+ * returns 0 unless the node is a leaf.
+ */
+template<typename BoundType, typename StatisticType, typename MatType>
+inline double BinarySpaceTree<BoundType, StatisticType, MatType>::
+    FurthestPointDistance() const
+{
+  if (IsLeaf())
+    return 0.0;
+
+  // Otherwise half of the maximum bound distance is sufficient (this is the
+  // distance from a corner of the bound to the centroid).
+  return bound.MaxDistance(bound);
+}
+
+/**
  * 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



More information about the mlpack-svn mailing list