[mlpack-git] master: Use existing bounds, if we can. (3dc8249)
gitdub at big.cc.gt.atl.ga.us
gitdub at big.cc.gt.atl.ga.us
Thu Mar 12 16:03:09 EDT 2015
Repository : https://github.com/mlpack/mlpack
On branch : master
Link : https://github.com/mlpack/mlpack/compare/eddd7167d69b6c88b271ef2e51d1c20e13f1acd8...70342dd8e5c17e0c164cfb8189748671e9c0dd44
>---------------------------------------------------------------
commit 3dc8249ce7b1be594c71a1f55af7552fd3e313f2
Author: Ryan Curtin <ryan at ratml.org>
Date: Thu Feb 5 15:12:58 2015 -0500
Use existing bounds, if we can.
>---------------------------------------------------------------
3dc8249ce7b1be594c71a1f55af7552fd3e313f2
src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp | 6 ++++++
1 file changed, 6 insertions(+)
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 20172d3..131c132 100644
--- a/src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp
+++ b/src/mlpack/methods/neighbor_search/neighbor_search_rules_impl.hpp
@@ -394,6 +394,12 @@ inline double NeighborSearchRules<SortPolicy, MetricType, TreeType>::
bestDistance = queryNode.Parent()->Stat().SecondBound();
}
+ // Could the existing bounds be better?
+ if (SortPolicy::IsBetter(queryNode.Stat().FirstBound(), worstDistance))
+ worstDistance = queryNode.Stat().FirstBound();
+ if (SortPolicy::IsBetter(queryNode.Stat().SecondBound(), bestDistance))
+ bestDistance = queryNode.Stat().SecondBound();
+
// Cache bounds for later.
queryNode.Stat().FirstBound() = worstDistance;
queryNode.Stat().SecondBound() = bestDistance;
More information about the mlpack-git
mailing list