[mlpack] 53/58: Workaround for the fact that BallBounds may have larger furthest descendant distances in their children.

Barak A. Pearlmutter barak+git at cs.nuim.ie
Tue Sep 9 13:19:43 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 8d2236ac95b191ddc0b96b33c91f412308832baf
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date:   Tue Aug 26 16:15:31 2014 +0000

    Workaround for the fact that BallBounds may have larger furthest descendant
    distances in their children.
    
    
    git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@17121 9d5b8971-822b-0410-80eb-d18c1038ef23
---
 src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp b/src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp
index 9a009d9..20172d3 100644
--- a/src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp
+++ b/src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp
@@ -364,10 +364,11 @@ inline double NeighborSearchRules<SortPolicy, MetricType, TreeType>::
   for (size_t i = 0; i < queryNode.NumChildren(); ++i)
   {
     const double firstBound = queryNode.Child(i).Stat().FirstBound();
+    const double adjustment = std::max(0.0,
+        queryNode.FurthestDescendantDistance() -
+        queryNode.Child(i).FurthestDescendantDistance());
     const double adjustedSecondBound = SortPolicy::CombineWorst(
-        queryNode.Child(i).Stat().SecondBound(),
-        2 * (queryNode.FurthestDescendantDistance() -
-             queryNode.Child(i).FurthestDescendantDistance()));
+        queryNode.Child(i).Stat().SecondBound(), 2 * adjustment);
 
     if (SortPolicy::IsBetter(worstDistance, firstBound))
       worstDistance = firstBound;

-- 
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