MLPACK  1.0.8
fastmks.hpp
Go to the documentation of this file.
1 
23 #ifndef __MLPACK_METHODS_FASTMKS_FASTMKS_HPP
24 #define __MLPACK_METHODS_FASTMKS_FASTMKS_HPP
25 
26 #include <mlpack/core.hpp>
28 #include "fastmks_stat.hpp"
30 
31 namespace mlpack {
32 namespace fastmks {
33 
64 template<
65  typename KernelType,
68 >
69 class FastMKS
70 {
71  public:
81  FastMKS(const arma::mat& referenceSet,
82  const bool single = false,
83  const bool naive = false);
84 
95  FastMKS(const arma::mat& referenceSet,
96  const arma::mat& querySet,
97  const bool single = false,
98  const bool naive = false);
99 
111  FastMKS(const arma::mat& referenceSet,
112  KernelType& kernel,
113  const bool single = false,
114  const bool naive = false);
115 
128  FastMKS(const arma::mat& referenceSet,
129  const arma::mat& querySet,
130  KernelType& kernel,
131  const bool single = false,
132  const bool naive = false);
133 
146  FastMKS(const arma::mat& referenceSet,
147  TreeType* referenceTree,
148  const bool single = false,
149  const bool naive = false);
150 
164  FastMKS(const arma::mat& referenceSet,
165  TreeType* referenceTree,
166  const arma::mat& querySet,
167  TreeType* queryTree,
168  const bool single = false,
169  const bool naive = false);
170 
172  ~FastMKS();
173 
188  void Search(const size_t k,
189  arma::Mat<size_t>& indices,
190  arma::mat& products);
191 
193  const metric::IPMetric<KernelType>& Metric() const { return metric; }
196 
197  private:
199  const arma::mat& referenceSet;
201  const arma::mat& querySet;
202 
204  TreeType* referenceTree;
207  TreeType* queryTree;
208 
210  bool treeOwner;
211 
213  bool single;
215  bool naive;
216 
219 
221  void InsertNeighbor(arma::Mat<size_t>& indices,
222  arma::mat& products,
223  const size_t queryIndex,
224  const size_t pos,
225  const size_t neighbor,
226  const double distance);
227 };
228 
229 }; // namespace fastmks
230 }; // namespace mlpack
231 
232 // Include implementation.
233 #include "fastmks_impl.hpp"
234 
235 #endif