[mlpack-svn] r12660 - mlpack/trunk/src/mlpack/core/tree

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Wed May 9 16:24:39 EDT 2012


Author: rcurtin
Date: 2012-05-09 16:24:39 -0400 (Wed, 09 May 2012)
New Revision: 12660

Modified:
   mlpack/trunk/src/mlpack/core/tree/cover_tree_impl.hpp
Log:
Save just a little time where we can.


Modified: mlpack/trunk/src/mlpack/core/tree/cover_tree_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/tree/cover_tree_impl.hpp	2012-05-09 20:20:14 UTC (rev 12659)
+++ mlpack/trunk/src/mlpack/core/tree/cover_tree_impl.hpp	2012-05-09 20:24:39 UTC (rev 12660)
@@ -306,7 +306,9 @@
   // because all the points in the near set should be used up.
   farSetSize = childFarSetSize;
 
-  ComputeDistances(pointIndex, indices, distances, farSetSize);
+  // No need to rebuild the distances if we never modified them.
+  if (nearSet.n_elem != 0)
+    ComputeDistances(pointIndex, indices, distances, farSetSize);
 }
 
 template<typename MetricType, typename RootPointPolicy, typename StatisticType>




More information about the mlpack-svn mailing list