[mlpack-svn] r10868 - mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Fri Dec 16 16:45:38 EST 2011


Author: vlad321
Date: 2011-12-16 16:45:38 -0500 (Fri, 16 Dec 2011)
New Revision: 10868

Modified:
   mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/furthest_neighbor_sort.cpp
   mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/furthest_neighbor_sort.hpp
   mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/furthest_neighbor_sort_impl.hpp
   mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/nearest_neighbor_sort.cpp
   mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/nearest_neighbor_sort.hpp
   mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/nearest_neighbor_sort_impl.hpp
Log:
Formatted /nearest_neighbor


Modified: mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/furthest_neighbor_sort.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/furthest_neighbor_sort.cpp	2011-12-16 21:38:45 UTC (rev 10867)
+++ mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/furthest_neighbor_sort.cpp	2011-12-16 21:45:38 UTC (rev 10868)
@@ -9,19 +9,17 @@
 using namespace mlpack::neighbor;
 
 size_t FurthestNeighborSort::SortDistance(const arma::vec& list,
-                                          double new_distance)
+                                          double newDistance)
 {
   // The first element in the list is the nearest neighbor.  We only want to
   // insert if the new distance is greater than the last element in the list.
-  if (new_distance < list[list.n_elem - 1])
+  if (newDistance < list[list.n_elem - 1])
     return (size_t() - 1); // Do not insert.
 
   // Search from the beginning.  This may not be the best way.
-  for (size_t i = 0; i < list.n_elem; i++)
-  {
-    if (new_distance >= list[i])
-      return i;
-  }
+  for (size_t i = 0; i < list.n_elem; i++)  
+    if (newDistance >= list[i])
+      return i;  
 
   // Control should never reach here.
   return (size_t() - 1);

Modified: mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/furthest_neighbor_sort.hpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/furthest_neighbor_sort.hpp	2011-12-16 21:38:45 UTC (rev 10867)
+++ mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/furthest_neighbor_sort.hpp	2011-12-16 21:45:38 UTC (rev 10868)
@@ -36,7 +36,7 @@
    * @return size_t containing the position to insert into, or (size_t() - 1)
    *     if the new distance should not be inserted.
    */
-  static size_t SortDistance(const arma::vec& list, double new_distance);
+  static size_t SortDistance(const arma::vec& list, double newDistance);
 
   /**
    * Return whether or not value is "better" than ref.  In this case, that means
@@ -58,8 +58,8 @@
    * function.
    */
   template<typename TreeType>
-  static double BestNodeToNodeDistance(const TreeType* query_node,
-                                       const TreeType* reference_node);
+  static double BestNodeToNodeDistance(const TreeType* queryNode,
+                                       const TreeType* referenceNode);
 
   /**
    * Return the best possible distance between a node and a point.  In our case,
@@ -67,8 +67,8 @@
    * given distance function.
    */
   template<typename TreeType>
-  static double BestPointToNodeDistance(const arma::vec& query_point,
-                                        const TreeType* reference_node);
+  static double BestPointToNodeDistance(const arma::vec& queryPoint,
+                                        const TreeType* referenceNode);
 
   /**
    * Return what should represent the worst possible distance with this

Modified: mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/furthest_neighbor_sort_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/furthest_neighbor_sort_impl.hpp	2011-12-16 21:38:45 UTC (rev 10867)
+++ mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/furthest_neighbor_sort_impl.hpp	2011-12-16 21:45:38 UTC (rev 10868)
@@ -13,22 +13,22 @@
 
 template<typename TreeType>
 double FurthestNeighborSort::BestNodeToNodeDistance(
-    const TreeType* query_node,
-    const TreeType* reference_node)
+    const TreeType* queryNode,
+    const TreeType* referenceNode)
 {
   // This is not implemented yet for the general case because the trees do not
   // accept arbitrary distance metrics.
-  return query_node->Bound().MaxDistance(reference_node->Bound());
+  return queryNode->Bound().MaxDistance(referenceNode->Bound());
 }
 
 template<typename TreeType>
 double FurthestNeighborSort::BestPointToNodeDistance(
     const arma::vec& point,
-    const TreeType* reference_node)
+    const TreeType* referenceNode)
 {
   // This is not implemented yet for the general case because the trees do not
   // accept arbitrary distance metrics.
-  return reference_node->Bound().MaxDistance(point);
+  return referenceNode->Bound().MaxDistance(point);
 }
 
 }; // namespace neighbor

Modified: mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/nearest_neighbor_sort.cpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/nearest_neighbor_sort.cpp	2011-12-16 21:38:45 UTC (rev 10867)
+++ mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/nearest_neighbor_sort.cpp	2011-12-16 21:45:38 UTC (rev 10868)
@@ -9,19 +9,17 @@
 using namespace mlpack::neighbor;
 
 size_t NearestNeighborSort::SortDistance(const arma::vec& list,
-                                         double new_distance)
+                                         double newDistance)
 {
   // The first element in the list is the nearest neighbor.  We only want to
   // insert if the new distance is less than the last element in the list.
-  if (new_distance > list[list.n_elem - 1])
+  if (newDistance > list[list.n_elem - 1])
     return (size_t() - 1); // Do not insert.
 
   // Search from the beginning.  This may not be the best way.
   for (size_t i = 0; i < list.n_elem; i++)
-  {
-    if (new_distance <= list[i])
-      return i;
-  }
+    if (newDistance <= list[i])
+      return i;  
 
   // Control should never reach here.
   return (size_t() - 1);

Modified: mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/nearest_neighbor_sort.hpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/nearest_neighbor_sort.hpp	2011-12-16 21:38:45 UTC (rev 10867)
+++ mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/nearest_neighbor_sort.hpp	2011-12-16 21:45:38 UTC (rev 10868)
@@ -40,7 +40,7 @@
    * @return size_t containing the position to insert into, or (size_t() - 1)
    *     if the new distance should not be inserted.
    */
-  static size_t SortDistance(const arma::vec& list, double new_distance);
+  static size_t SortDistance(const arma::vec& list, double newDistance);
 
   /**
    * Return whether or not value is "better" than ref.  In this case, that means
@@ -62,8 +62,8 @@
    * function.
    */
   template<typename TreeType>
-  static double BestNodeToNodeDistance(const TreeType* query_node,
-                                       const TreeType* reference_node);
+  static double BestNodeToNodeDistance(const TreeType* queryNode,
+                                       const TreeType* referenceNode);
 
   /**
    * Return the best possible distance between a node and a point.  In our case,
@@ -71,8 +71,8 @@
    * given distance function.
    */
   template<typename TreeType>
-  static double BestPointToNodeDistance(const arma::vec& query_point,
-                                        const TreeType* reference_node);
+  static double BestPointToNodeDistance(const arma::vec& queryPoint,
+                                        const TreeType* referenceNode);
 
   /**
    * Return what should represent the worst possible distance with this

Modified: mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/nearest_neighbor_sort_impl.hpp
===================================================================
--- mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/nearest_neighbor_sort_impl.hpp	2011-12-16 21:38:45 UTC (rev 10867)
+++ mlpack/trunk/src/mlpack/methods/neighbor_search/sort_policies/nearest_neighbor_sort_impl.hpp	2011-12-16 21:45:38 UTC (rev 10868)
@@ -13,22 +13,22 @@
 
 template<typename TreeType>
 double NearestNeighborSort::BestNodeToNodeDistance(
-    const TreeType* query_node,
-    const TreeType* reference_node)
+    const TreeType* queryNode,
+    const TreeType* referenceNode)
 {
   // This is not implemented yet for the general case because the trees do not
   // accept arbitrary distance metrics.
-  return query_node->Bound().MinDistance(reference_node->Bound());
+  return queryNode->Bound().MinDistance(referenceNode->Bound());
 }
 
 template<typename TreeType>
 double NearestNeighborSort::BestPointToNodeDistance(
     const arma::vec& point,
-    const TreeType* reference_node)
+    const TreeType* referenceNode)
 {
   // This is not implemented yet for the general case because the trees do not
   // accept arbitrary distance metrics.
-  return reference_node->Bound().MinDistance(point);
+  return referenceNode->Bound().MinDistance(point);
 }
 
 }; // namespace neighbor




More information about the mlpack-svn mailing list