[mlpack-git] master: refactored src/mlpack/methods/*/ - updated MinDistance(), MaxDistance() and RangeDistance() calls (7ce36bc)

gitdub at mlpack.org gitdub at mlpack.org
Tue Sep 20 00:12:31 EDT 2016


Repository : https://github.com/mlpack/mlpack
On branch  : master
Link       : https://github.com/mlpack/mlpack/compare/045c16afa6fff8520722bbf19d98312e0eb24532...635238ba763335f6708b5560ae6606b008fdd609

>---------------------------------------------------------------

commit 7ce36bc35a9db7aed2f273aee9d84dc3bdc1fc45
Author: KANODIA <kanodia at ubuntu.ubuntu-domain>
Date:   Tue Sep 20 09:42:31 2016 +0530

    refactored src/mlpack/methods/*/ - updated MinDistance(), MaxDistance() and RangeDistance() calls


>---------------------------------------------------------------

7ce36bc35a9db7aed2f273aee9d84dc3bdc1fc45
 src/mlpack/methods/emst/dtb_rules_impl.hpp                          | 2 +-
 src/mlpack/methods/kmeans/dual_tree_kmeans_rules_impl.hpp           | 4 ++--
 .../neighbor_search/sort_policies/furthest_neighbor_sort_impl.hpp   | 6 +++---
 .../neighbor_search/sort_policies/nearest_neighbor_sort_impl.hpp    | 6 +++---
 src/mlpack/methods/range_search/range_search_rules_impl.hpp         | 2 +-
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/mlpack/methods/emst/dtb_rules_impl.hpp b/src/mlpack/methods/emst/dtb_rules_impl.hpp
index f60513b..7c75ed6 100644
--- a/src/mlpack/methods/emst/dtb_rules_impl.hpp
+++ b/src/mlpack/methods/emst/dtb_rules_impl.hpp
@@ -115,7 +115,7 @@ double DTBRules<MetricType, TreeType>::Score(TreeType& queryNode,
     return DBL_MAX;
 
   ++scores;
-  const double distance = queryNode.MinDistance(&referenceNode);
+  const double distance = queryNode.MinDistance(referenceNode);
   const double bound = CalculateBound(queryNode);
 
   // If all the points in the reference node are farther than the candidate
diff --git a/src/mlpack/methods/kmeans/dual_tree_kmeans_rules_impl.hpp b/src/mlpack/methods/kmeans/dual_tree_kmeans_rules_impl.hpp
index f91b5ef..2286455 100644
--- a/src/mlpack/methods/kmeans/dual_tree_kmeans_rules_impl.hpp
+++ b/src/mlpack/methods/kmeans/dual_tree_kmeans_rules_impl.hpp
@@ -216,7 +216,7 @@ inline double DualTreeKMeansRules<MetricType, TreeType>::Score(
       {
         // If this might affect the lower bound, make it more exact.
         queryNode.Stat().LowerBound() = std::min(queryNode.Stat().LowerBound(),
-            queryNode.MinDistance(&referenceNode));
+            queryNode.MinDistance(referenceNode));
         ++scores;
       }
 
@@ -228,7 +228,7 @@ inline double DualTreeKMeansRules<MetricType, TreeType>::Score(
   if (score != DBL_MAX)
   {
     // Get minimum and maximum distances.
-    const math::Range distances = queryNode.RangeDistance(&referenceNode);
+    const math::Range distances = queryNode.RangeDistance(referenceNode);
 
     score = distances.Lo();
     ++scores;
diff --git a/src/mlpack/methods/neighbor_search/sort_policies/furthest_neighbor_sort_impl.hpp b/src/mlpack/methods/neighbor_search/sort_policies/furthest_neighbor_sort_impl.hpp
index e3430cb..da9d4d6 100644
--- a/src/mlpack/methods/neighbor_search/sort_policies/furthest_neighbor_sort_impl.hpp
+++ b/src/mlpack/methods/neighbor_search/sort_policies/furthest_neighbor_sort_impl.hpp
@@ -18,7 +18,7 @@ inline double FurthestNeighborSort::BestNodeToNodeDistance(
 {
   // This is not implemented yet for the general case because the trees do not
   // accept arbitrary distance metrics.
-  return queryNode->MaxDistance(referenceNode);
+  return queryNode->MaxDistance(*referenceNode);
 }
 
 template<typename TreeType>
@@ -27,7 +27,7 @@ inline double FurthestNeighborSort::BestNodeToNodeDistance(
     const TreeType* referenceNode,
     const double centerToCenterDistance)
 {
-  return queryNode->MaxDistance(referenceNode, centerToCenterDistance);
+  return queryNode->MaxDistance(*referenceNode, centerToCenterDistance);
 }
 
 template<typename TreeType>
@@ -37,7 +37,7 @@ inline double FurthestNeighborSort::BestNodeToNodeDistance(
     const TreeType* referenceChildNode,
     const double centerToCenterDistance)
 {
-  return queryNode->MaxDistance(referenceNode, centerToCenterDistance) +
+  return queryNode->MaxDistance(*referenceNode, centerToCenterDistance) +
       referenceChildNode->ParentDistance();
 }
 
diff --git a/src/mlpack/methods/neighbor_search/sort_policies/nearest_neighbor_sort_impl.hpp b/src/mlpack/methods/neighbor_search/sort_policies/nearest_neighbor_sort_impl.hpp
index 5182913..608424a 100644
--- a/src/mlpack/methods/neighbor_search/sort_policies/nearest_neighbor_sort_impl.hpp
+++ b/src/mlpack/methods/neighbor_search/sort_policies/nearest_neighbor_sort_impl.hpp
@@ -18,7 +18,7 @@ inline double NearestNeighborSort::BestNodeToNodeDistance(
 {
   // This is not implemented yet for the general case because the trees do not
   // accept arbitrary distance metrics.
-  return queryNode->MinDistance(referenceNode);
+  return queryNode->MinDistance(*referenceNode);
 }
 
 template<typename TreeType>
@@ -27,7 +27,7 @@ inline double NearestNeighborSort::BestNodeToNodeDistance(
     const TreeType* referenceNode,
     const double centerToCenterDistance)
 {
-  return queryNode->MinDistance(referenceNode, centerToCenterDistance);
+  return queryNode->MinDistance(*referenceNode, centerToCenterDistance);
 }
 
 template<typename TreeType>
@@ -37,7 +37,7 @@ inline double NearestNeighborSort::BestNodeToNodeDistance(
     const TreeType* referenceChildNode,
     const double centerToCenterDistance)
 {
-  return queryNode->MinDistance(referenceChildNode, centerToCenterDistance) -
+  return queryNode->MinDistance(*referenceChildNode, centerToCenterDistance) -
       referenceChildNode->ParentDistance();
 }
 
diff --git a/src/mlpack/methods/range_search/range_search_rules_impl.hpp b/src/mlpack/methods/range_search/range_search_rules_impl.hpp
index a0629bb..0ed5ada 100644
--- a/src/mlpack/methods/range_search/range_search_rules_impl.hpp
+++ b/src/mlpack/methods/range_search/range_search_rules_impl.hpp
@@ -179,7 +179,7 @@ double RangeSearchRules<MetricType, TreeType>::Score(TreeType& queryNode,
   else
   {
     // Just perform the calculation.
-    distances = referenceNode.RangeDistance(&queryNode);
+    distances = referenceNode.RangeDistance(queryNode);
     ++scores;
   }
 




More information about the mlpack-git mailing list