Go to the documentation of this file.
13 #ifndef MLPACK_METHODS_RANGE_SEARCH_RANGE_SEARCH_HPP
14 #define MLPACK_METHODS_RANGE_SEARCH_RANGE_SEARCH_HPP
38 typename MatType = arma::mat,
39 template<
typename TreeMetricType,
40 typename TreeStatType,
46 typedef TreeType<MetricType, RangeSearchStat, MatType>
Tree;
65 const bool naive =
false,
66 const bool singleMode =
false,
67 const MetricType metric = MetricType());
92 const bool singleMode =
false,
93 const MetricType metric = MetricType());
106 const bool singleMode =
false,
107 const MetricType metric = MetricType());
185 std::vector<std::vector<size_t>>& neighbors,
186 std::vector<std::vector<double>>& distances);
226 std::vector<std::vector<size_t>>& neighbors,
227 std::vector<std::vector<double>>& distances);
259 std::vector<std::vector<size_t>>& neighbors,
260 std::vector<std::vector<double>>& distances);
268 bool Naive()
const {
return naive; }
278 template<
typename Archive>
279 void serialize(Archive& ar,
const unsigned int version);
289 std::vector<size_t> oldFromNewReferences;
294 const MatType* referenceSet;
320 #include "range_search_impl.hpp"
bool & SingleMode()
Modify whether single-tree search is being used.
void Search(const math::Range &range, std::vector< std::vector< size_t >> &neighbors, std::vector< std::vector< double >> &distances)
Search for all points in the given range for each point in the reference set (which was passed to the...
The core includes that mlpack expects; standard C++ includes and Armadillo.
void Train(Tree *referenceTree)
Set the reference tree to a new reference tree.
bool SingleMode() const
Get whether single-tree search is being used.
A binary space partitioning tree, such as a KD-tree or a ball tree.
Tree * ReferenceTree()
Return the reference tree (or NULL if in naive mode).
RangeSearch(const bool naive=false, const bool singleMode=false, const MetricType metric=MetricType())
Initialize the RangeSearch object without any reference data.
const MatType & ReferenceSet() const
Return the reference set.
bool & Naive()
Modify whether naive search is being used.
void serialize(Archive &ar, const unsigned int version)
Serialize the model.
Linear algebra utility functions, generally performed on matrices or vectors.
void Search(const MatType &querySet, const math::Range &range, std::vector< std::vector< size_t >> &neighbors, std::vector< std::vector< double >> &distances)
Search for all reference points in the given range for each point in the query set,...
size_t BaseCases() const
Get the number of base cases during the last search.
TrainVisitor sets the reference set to a new reference set on the given RSType.
void Train(MatType referenceSet)
Set the reference set to a new reference set, and build a tree if necessary.
RangeSearch(MatType referenceSet, const bool naive=false, const bool singleMode=false, const MetricType metric=MetricType())
Initialize the RangeSearch object with a given reference dataset (this is the dataset which is search...
RangeSearch(const RangeSearch &other)
Construct the RangeSearch model as a copy of the given model.
RangeSearch & operator=(RangeSearch other)
Copy the given RangeSearch model.
LMetric< 2, true > EuclideanDistance
The Euclidean (L2) distance.
~RangeSearch()
Destroy the RangeSearch object.
RangeSearch(RangeSearch &&other)
Construct the RangeSearch model by taking ownership of the given model.
bool Naive() const
Get whether naive search is being used.
TreeType< MetricType, RangeSearchStat, MatType > Tree
Convenience typedef.
void Search(Tree *queryTree, const math::Range &range, std::vector< std::vector< size_t >> &neighbors, std::vector< std::vector< double >> &distances)
Given a pre-built query tree, search for all reference points in the given range for each point in th...
The RangeSearch class is a template class for performing range searches.
size_t Scores() const
Get the number of scores during the last search.
RangeSearch(Tree *referenceTree, const bool singleMode=false, const MetricType metric=MetricType())
Initialize the RangeSearch object with the given pre-constructed reference tree (this is the tree bui...