MLPACK
1.0.10
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
src
mlpack
methods
fastmks
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
>
27
#include <
mlpack/core/metrics/ip_metric.hpp
>
28
#include "
fastmks_stat.hpp
"
29
#include <
mlpack/core/tree/cover_tree.hpp
>
30
31
namespace
mlpack {
32
namespace
fastmks {
33
64
template
<
65
typename
KernelType,
66
typename
TreeType =
tree::CoverTree<metric::IPMetric<KernelType>
,
67
tree::FirstPointIsRoot
,
FastMKSStat
>
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
; }
195
metric::IPMetric<KernelType>
&
Metric
() {
return
metric
; }
196
200
std::string
ToString
()
const
;
201
202
private
:
204
const
arma::mat&
referenceSet
;
206
const
arma::mat&
querySet
;
207
209
TreeType*
referenceTree
;
212
TreeType*
queryTree
;
213
215
bool
treeOwner
;
216
218
bool
single
;
220
bool
naive
;
221
223
metric::IPMetric<KernelType>
metric
;
224
226
void
InsertNeighbor
(arma::Mat<size_t>& indices,
227
arma::mat& products,
228
const
size_t
queryIndex,
229
const
size_t
pos,
230
const
size_t
neighbor,
231
const
double
distance);
232
};
233
234
};
// namespace fastmks
235
};
// namespace mlpack
236
237
// Include implementation.
238
#include "fastmks_impl.hpp"
239
240
#endif
Generated by
1.8.3.1