[mlpack-svn] r15918 - mlpack/trunk/src/mlpack/core/tree/cover_tree
fastlab-svn at coffeetalk-1.cc.gatech.edu
fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Oct 4 00:29:45 EDT 2013
Author: rcurtin
Date: Fri Oct 4 00:29:45 2013
New Revision: 15918
Log:
Handle cases where the reference map is empty a little better.
Modified:
mlpack/trunk/src/mlpack/core/tree/cover_tree/dual_tree_traverser_impl.hpp
Modified: mlpack/trunk/src/mlpack/core/tree/cover_tree/dual_tree_traverser_impl.hpp
==============================================================================
--- mlpack/trunk/src/mlpack/core/tree/cover_tree/dual_tree_traverser_impl.hpp (original)
+++ mlpack/trunk/src/mlpack/core/tree/cover_tree/dual_tree_traverser_impl.hpp Fri Oct 4 00:29:45 2013
@@ -78,6 +78,10 @@
// First recurse down the reference nodes as necessary.
ReferenceRecursion(queryNode, referenceMap);
+ // Did the map get emptied?
+ if (referenceMap.size() == 0)
+ return; // Nothing to do!
+
// Now, reduce the scale of the query node by recursing. But we can't recurse
// if the query node is a leaf node.
if ((queryNode.Scale() != INT_MIN) &&
@@ -216,7 +220,8 @@
// First, reduce the maximum scale in the reference map down to the scale of
// the query node.
- while ((*referenceMap.rbegin()).first > queryNode.Scale())
+ while (!referenceMap.empty() &&
+ ((*referenceMap.rbegin()).first > queryNode.Scale()))
{
// If the query node's scale is INT_MIN and the reference map's maximum
// scale is INT_MIN, don't try to recurse...
More information about the mlpack-svn
mailing list