[mlpack] 172/324: Use the bound's cached MinWidth() for MinimumBoundDistance().

Barak A. Pearlmutter barak+git at cs.nuim.ie
Sun Aug 17 08:22:07 UTC 2014


This is an automated email from the git hooks/post-receive script.

bap pushed a commit to branch svn-trunk
in repository mlpack.

commit 4c6da879ef80d9c802897ce6dfe989356134b8be
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Thu Jul 10 14:31:37 2014 +0000

    Use the bound's cached MinWidth() for MinimumBoundDistance().
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16811 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 .../binary_space_tree/binary_space_tree_impl.hpp    | 21 +--------------------
 .../core/tree/rectangle_tree/rectangle_tree.hpp     |  2 +-
 2 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp b/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
index f8eb5cf..dc82eab 100644
--- a/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
+++ b/src/mlpack/core/tree/binary_space_tree/binary_space_tree_impl.hpp
@@ -238,7 +238,6 @@ BinarySpaceTree<BoundType, StatisticType, MatType, SplitType>::BinarySpaceTree(
     splitDimension(other.splitDimension),
     parentDistance(other.parentDistance),
     furthestDescendantDistance(other.furthestDescendantDistance),
-    minimumBoundDistance(other.minimumBoundDistance),
     dataset(other.dataset)
 {
   // Create left and right children (if any).
@@ -471,7 +470,7 @@ template<typename BoundType,
 inline double BinarySpaceTree<BoundType, StatisticType, MatType, SplitType>::
     MinimumBoundDistance() const
 {
-  return minimumBoundDistance;
+  return bound.MinWidth();
 }
 
 /**
@@ -572,15 +571,6 @@ void BinarySpaceTree<BoundType, StatisticType, MatType, SplitType>::SplitNode(
   // Calculate the furthest descendant distance.
   furthestDescendantDistance = 0.5 * bound.Diameter();
 
-  // Find the minimum distance to any bound edge.
-  minimumBoundDistance = DBL_MAX;
-  for (size_t i = 0; i < bound.Dim(); ++i)
-  {
-    const double dist = std::max(bound[i].Hi() - bound[i].Lo(), 0.0);
-    if (dist < minimumBoundDistance)
-      minimumBoundDistance = dist;
-  }
-
   // Now, check if we need to split at all.
   if (count <= maxLeafSize)
     return; // We can't split this.
@@ -637,15 +627,6 @@ void BinarySpaceTree<BoundType, StatisticType, MatType, SplitType>::SplitNode(
   // Calculate the furthest descendant distance.
   furthestDescendantDistance = 0.5 * bound.Diameter();
 
-  // Find the minimum distance to any bound edge.
-  minimumBoundDistance = DBL_MAX;
-  for (size_t i = 0; i < bound.Dim(); ++i)
-  {
-    const double dist = std::max(bound[i].Hi() - bound[i].Lo(), 0.0);
-    if (dist < minimumBoundDistance)
-      minimumBoundDistance = dist;
-  }
-
   // First, check if we need to split at all.
   if (count <= maxLeafSize)
     return; // We can't split this.
diff --git a/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp b/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp
index 564454c..af00aab 100644
--- a/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp
+++ b/src/mlpack/core/tree/rectangle_tree/rectangle_tree.hpp
@@ -268,7 +268,7 @@ class RectangleTree
   //! Return the minimum distance from the center to any edge of the bound.
   //! Currently, this returns 0, which doesn't break algorithms, but it isn't
   //! necessarily correct, either.
-  double MinimumBoundDistance() const { return 0.0; }
+  double MinimumBoundDistance() const { return bound.MinWidth(); }
 
   //! Return the distance from the center of this node to the center of the
   //! parent node.

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git



More information about the debian-science-commits mailing list