[mlpack-svn] r15790 - mlpack/trunk/src/mlpack/methods/range_search

fastlab-svn at coffeetalk-1.cc.gatech.edu fastlab-svn at coffeetalk-1.cc.gatech.edu
Mon Sep 16 22:50:49 EDT 2013


Author: rcurtin
Date: Mon Sep 16 22:50:48 2013
New Revision: 15790

Log:
Add RangeSearchStat class.


Added:
   mlpack/trunk/src/mlpack/methods/range_search/range_search_stat.hpp
Modified:
   mlpack/trunk/src/mlpack/methods/range_search/CMakeLists.txt

Modified: mlpack/trunk/src/mlpack/methods/range_search/CMakeLists.txt
==============================================================================
--- mlpack/trunk/src/mlpack/methods/range_search/CMakeLists.txt	(original)
+++ mlpack/trunk/src/mlpack/methods/range_search/CMakeLists.txt	Mon Sep 16 22:50:48 2013
@@ -5,6 +5,7 @@
   range_search_impl.hpp
   range_search_rules.hpp
   range_search_rules_impl.hpp
+  range_search_stat.hpp
 )
 
 # Add directory name to sources.

Added: mlpack/trunk/src/mlpack/methods/range_search/range_search_stat.hpp
==============================================================================
--- (empty file)
+++ mlpack/trunk/src/mlpack/methods/range_search/range_search_stat.hpp	Mon Sep 16 22:50:48 2013
@@ -0,0 +1,57 @@
+/**
+ * @file range_search_stat.hpp
+ * @author Ryan Curtin
+ *
+ * Statistic class for RangeSearch, which just holds the last visited node and
+ * the corresponding base case result.
+ */
+#ifndef __MLPACK_METHODS_RANGE_SEARCH_RANGE_SEARCH_STAT_HPP
+#define __MLPACK_METHODS_RANGE_SEARCH_RANGE_SEARCH_STAT_HPP
+
+#include <mlpack/core.hpp>
+
+namespace mlpack {
+namespace neighbor {
+
+/**
+ * Statistic class for RangeSearch, to be set to the StatisticType of the tree
+ * type that range search is being performed with.  This class just holds the
+ * last visited node and the corresponding base case result.
+ */
+class RangeSearchStat
+{
+ public:
+  /**
+   * Initialize the statistic.
+   */
+  RangeSearchStat() : lastDistanceNode(NULL), lastDistance(0.0) { }
+
+  /**
+   * Initialize the statistic given a tree node that this statistic belongs to.
+   * In this case, we ignore the node.
+   */
+  template<typename TreeType>
+  RangeSearchStat(TreeType& /* node */) :
+      lastDistanceNode(NULL),
+      lastDistance(0.0) { }
+
+  //! Get the last distance evaluation node.
+  void* LastDistanceNode() const { return lastDistanceNode; }
+  //! Modify the last distance evaluation node.
+  void*& LastDistanceNode() { return lastDistanceNode; }
+  //! Get the last distance evaluation.
+  double LastDistance() const { return lastDistance; }
+  //! Modify the last distance evaluation.
+  double& LastDistance() { return lastDistance; }
+
+ private:
+  //! The last distance evaluation node.
+  void* lastDistanceNode;
+  //! The last distance evaluation.
+  double lastDistance;
+};
+
+}; // namespace neighbor
+}; // namespace mlpack
+
+#endif



More information about the mlpack-svn mailing list