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

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri May 18 19:03:14 EDT 2012


Author: rcurtin
Date: 2012-05-18 19:03:13 -0400 (Fri, 18 May 2012)
New Revision: 12727

Modified:
   mlpack/trunk/src/mlpack/core/tree/cover_tree_impl.hpp
Log:
Use unsafe_col() 'cause it's faster.


Modified: mlpack/trunk/src/mlpack/core/tree/cover_tree_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/core/tree/cover_tree_impl.hpp	2012-05-18 22:33:32 UTC (rev 12726)
+++ mlpack/trunk/src/mlpack/core/tree/cover_tree_impl.hpp	2012-05-18 23:03:13 UTC (rev 12727)
@@ -394,8 +394,8 @@
     const CoverTree<MetricType, RootPointPolicy, StatisticType>* other) const
 {
   // Every cover tree node will contain points up to EC^(scale + 1) away.
-  return MetricType::Evaluate(dataset.col(point),
-      other->Dataset().col(other->Point())) -
+  return MetricType::Evaluate(dataset.unsafe_col(point),
+      other->Dataset().unsafe_col(other->Point())) -
       std::pow(expansionConstant, scale + 1) -
       std::pow(other->ExpansionConstant(), other->Scale() + 1);
 }
@@ -412,8 +412,8 @@
 double CoverTree<MetricType, RootPointPolicy, StatisticType>::MaxDistance(
     const CoverTree<MetricType, RootPointPolicy, StatisticType>* other) const
 {
-  return MetricType::Evaluate(dataset.col(point),
-      other->Dataset().col(other->Point())) +
+  return MetricType::Evaluate(dataset.unsafe_col(point),
+      other->Dataset().unsafe_col(other->Point())) +
       std::pow(expansionConstant, scale + 1) +
       std::pow(other->ExpansionConstant(), other->Scale() + 1);
 }
@@ -490,8 +490,8 @@
   // modified.
   for (size_t i = 0; i < pointSetSize; ++i)
   {
-    distances[i] = MetricType::Evaluate(dataset.col(pointIndex),
-        dataset.col(indices[i]));
+    distances[i] = MetricType::Evaluate(dataset.unsafe_col(pointIndex),
+        dataset.unsafe_col(indices[i]));
   }
 }
 




More information about the mlpack-svn mailing list