[mlpack] 129/324: Split RAQueryStat into its own class.
Barak A. Pearlmutter
barak+git at cs.nuim.ie
Sun Aug 17 08:22:03 UTC 2014
This is an automated email from the git hooks/post-receive script.
bap pushed a commit to branch svn-trunk
in repository mlpack.
commit a114ec2ac51b6078ac7146187cd2ab962874da97
Author: rcurtin <rcurtin at 9d5b8971-822b-0410-80eb-d18c1038ef23>
Date: Mon Jul 7 11:46:05 2014 +0000
Split RAQueryStat into its own class.
git-svn-id: http://svn.cc.gatech.edu/fastlab/mlpack/trunk@16768 9d5b8971-822b-0410-80eb-d18c1038ef23
---
src/mlpack/methods/rann/CMakeLists.txt | 10 +++--
src/mlpack/methods/rann/ra_query_stat.hpp | 67 +++++++++++++++++++++++++++++++
src/mlpack/methods/rann/ra_search.hpp | 51 +----------------------
3 files changed, 74 insertions(+), 54 deletions(-)
diff --git a/src/mlpack/methods/rann/CMakeLists.txt b/src/mlpack/methods/rann/CMakeLists.txt
index c5af352..b848cd2 100644
--- a/src/mlpack/methods/rann/CMakeLists.txt
+++ b/src/mlpack/methods/rann/CMakeLists.txt
@@ -2,16 +2,18 @@
# Anything not in this list will not be compiled into the output library
# Do not include test programs here
set(SOURCES
-
# rank-approximate search files
ra_search.hpp
ra_search_impl.hpp
- # The rank-approximate search rules
+ # rank-approximate search rules
ra_search_rules.hpp
ra_search_rules_impl.hpp
- # The typedefs
+ # query statistic
+ ra_query_stat.hpp
+
+ # typedefs
ra_typedef.hpp
)
@@ -33,4 +35,4 @@ target_link_libraries(allkrann
mlpack
)
-install(TARGETS allkrann RUNTIME DESTINATION bin)
\ No newline at end of file
+install(TARGETS allkrann RUNTIME DESTINATION bin)
diff --git a/src/mlpack/methods/rann/ra_query_stat.hpp b/src/mlpack/methods/rann/ra_query_stat.hpp
new file mode 100644
index 0000000..47ad4dc
--- /dev/null
+++ b/src/mlpack/methods/rann/ra_query_stat.hpp
@@ -0,0 +1,67 @@
+/**
+ * @file ra_query_stat.hpp
+ * @author Parikshit Ram
+ *
+ * Defines the RAQueryStat class, which is the statistic used for
+ * rank-approximate nearest neighbor search (RASearch).
+ */
+#ifndef __MLPACK_METHODS_RANN_RA_QUERY_STAT_HPP
+#define __MLPACK_METHODS_RANN_RA_QUERY_STAT_HPP
+
+#include <mlpack/core.hpp>
+
+#include <mlpack/core/tree/binary_space_tree.hpp>
+
+#include <mlpack/core/metrics/lmetric.hpp>
+#include <mlpack/methods/neighbor_search/sort_policies/nearest_neighbor_sort.hpp>
+
+namespace mlpack {
+namespace neighbor {
+
+/**
+ * Extra data for each node in the tree. For neighbor searches, each node only
+ * needs to store a bound on neighbor distances.
+ *
+ * Every query is required to make a minimum number of samples to guarantee the
+ * desired approximation error. The 'numSamplesMade' keeps track of the minimum
+ * number of samples made by all queries in the node in question.
+ */
+template<typename SortPolicy>
+class RAQueryStat
+{
+ public:
+ /**
+ * Initialize the statistic with the worst possible distance according to our
+ * sorting policy.
+ */
+ RAQueryStat() : bound(SortPolicy::WorstDistance()), numSamplesMade(0) { }
+
+ /**
+ * Initialization for a node.
+ */
+ template<typename TreeType>
+ RAQueryStat(const TreeType& /* node */) :
+ bound(SortPolicy::WorstDistance()),
+ numSamplesMade(0)
+ { }
+
+ //! Get the bound.
+ double Bound() const { return bound; }
+ //! Modify the bound.
+ double& Bound() { return bound; }
+
+ //! Get the number of samples made.
+ size_t NumSamplesMade() const { return numSamplesMade; }
+ //! Modify the number of samples made.
+ size_t& NumSamplesMade() { return numSamplesMade; }
+
+ private:
+ //! The bound on the node's neighbor distances.
+ double bound;
+
+ //! The minimum number of samples made by any query in this node.
+ size_t numSamplesMade;
+
+};
+
+#endif
diff --git a/src/mlpack/methods/rann/ra_search.hpp b/src/mlpack/methods/rann/ra_search.hpp
index 4c50e06..c25e468 100644
--- a/src/mlpack/methods/rann/ra_search.hpp
+++ b/src/mlpack/methods/rann/ra_search.hpp
@@ -25,56 +25,7 @@
#include <mlpack/core/metrics/lmetric.hpp>
#include <mlpack/methods/neighbor_search/sort_policies/nearest_neighbor_sort.hpp>
-namespace mlpack {
-namespace neighbor /** Neighbor-search routines. These include
- * all-nearest-neighbors and all-furthest-neighbors
- * searches. */ {
-
-/**
- * Extra data for each node in the tree. For neighbor searches, each node only
- * needs to store a bound on neighbor distances.
- *
- * Every query is required to make a minimum number of samples to guarantee the
- * desired approximation error. The 'numSamplesMade' keeps track of the minimum
- * number of samples made by all queries in the node in question.
- */
-template<typename SortPolicy>
-class RAQueryStat
-{
- private:
- //! The bound on the node's neighbor distances.
- double bound;
-
- //! The minimum number of samples made by any query in this node.
- size_t numSamplesMade;
-
- public:
- /**
- * Initialize the statistic with the worst possible distance according to our
- * sorting policy.
- */
- RAQueryStat() : bound(SortPolicy::WorstDistance()), numSamplesMade(0) { }
-
- /**
- * Initialization for a node.
- */
- template<typename TreeType>
- RAQueryStat(const TreeType& /* node */) :
- bound(SortPolicy::WorstDistance()),
- numSamplesMade(0)
- { }
-
- //! Get the bound.
- double Bound() const { return bound; }
- //! Modify the bound.
- double& Bound() { return bound; }
-
- //! Get the number of samples made.
- size_t NumSamplesMade() const { return numSamplesMade; }
- //! Modify the number of samples made.
- size_t& NumSamplesMade() { return numSamplesMade; }
-
-};
+#include "ra_query_stat.hpp"
/**
* The RASearch class: This class provides a generic manner to perform
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mlpack.git
More information about the debian-science-commits
mailing list