\section{Range\+Search$<$ Metric\+Type, Mat\+Type, Tree\+Type $>$ Class Template Reference}
\label{classmlpack_1_1range_1_1RangeSearch}\index{Range\+Search$<$ Metric\+Type, Mat\+Type, Tree\+Type $>$@{Range\+Search$<$ Metric\+Type, Mat\+Type, Tree\+Type $>$}}


The \doxyref{Range\+Search}{p.}{classmlpack_1_1range_1_1RangeSearch} class is a template class for performing range searches.  


\subsection*{Public Types}
\begin{DoxyCompactItemize}
\item 
typedef Tree\+Type$<$ Metric\+Type, \textbf{ Range\+Search\+Stat}, Mat\+Type $>$ \textbf{ Tree}
\begin{DoxyCompactList}\small\item\em Convenience typedef. \end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ Range\+Search} (Mat\+Type reference\+Set, const bool naive=false, const bool single\+Mode=false, const Metric\+Type metric=Metric\+Type())
\begin{DoxyCompactList}\small\item\em Initialize the \doxyref{Range\+Search}{p.}{classmlpack_1_1range_1_1RangeSearch} object with a given reference dataset (this is the dataset which is searched). \end{DoxyCompactList}\item 
\textbf{ Range\+Search} (\textbf{ Tree} $\ast$reference\+Tree, const bool single\+Mode=false, const Metric\+Type metric=Metric\+Type())
\begin{DoxyCompactList}\small\item\em Initialize the \doxyref{Range\+Search}{p.}{classmlpack_1_1range_1_1RangeSearch} object with the given pre-\/constructed reference tree (this is the tree built on the reference set, which is the set that is searched). \end{DoxyCompactList}\item 
\textbf{ Range\+Search} (const bool naive=false, const bool single\+Mode=false, const Metric\+Type metric=Metric\+Type())
\begin{DoxyCompactList}\small\item\em Initialize the \doxyref{Range\+Search}{p.}{classmlpack_1_1range_1_1RangeSearch} object without any reference data. \end{DoxyCompactList}\item 
\textbf{ Range\+Search} (const \textbf{ Range\+Search} \&other)
\begin{DoxyCompactList}\small\item\em Construct the \doxyref{Range\+Search}{p.}{classmlpack_1_1range_1_1RangeSearch} model as a copy of the given model. \end{DoxyCompactList}\item 
\textbf{ Range\+Search} (\textbf{ Range\+Search} \&\&other)
\begin{DoxyCompactList}\small\item\em Construct the \doxyref{Range\+Search}{p.}{classmlpack_1_1range_1_1RangeSearch} model by taking ownership of the given model. \end{DoxyCompactList}\item 
\textbf{ $\sim$\+Range\+Search} ()
\begin{DoxyCompactList}\small\item\em Destroy the \doxyref{Range\+Search}{p.}{classmlpack_1_1range_1_1RangeSearch} object. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ Base\+Cases} () const
\begin{DoxyCompactList}\small\item\em Get the number of base cases during the last search. \end{DoxyCompactList}\item 
bool \textbf{ Naive} () const
\begin{DoxyCompactList}\small\item\em Get whether naive search is being used. \end{DoxyCompactList}\item 
bool \& \textbf{ Naive} ()
\begin{DoxyCompactList}\small\item\em Modify whether naive search is being used. \end{DoxyCompactList}\item 
\textbf{ Range\+Search} \& \textbf{ operator=} (\textbf{ Range\+Search} other)
\begin{DoxyCompactList}\small\item\em Copy the given \doxyref{Range\+Search}{p.}{classmlpack_1_1range_1_1RangeSearch} model. \end{DoxyCompactList}\item 
const Mat\+Type \& \textbf{ Reference\+Set} () const
\begin{DoxyCompactList}\small\item\em Return the reference set. \end{DoxyCompactList}\item 
\textbf{ Tree} $\ast$ \textbf{ Reference\+Tree} ()
\begin{DoxyCompactList}\small\item\em Return the reference tree (or N\+U\+LL if in naive mode). \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ Scores} () const
\begin{DoxyCompactList}\small\item\em Get the number of scores during the last search. \end{DoxyCompactList}\item 
void \textbf{ Search} (const Mat\+Type \&query\+Set, const \textbf{ math\+::\+Range} \&range, std\+::vector$<$ std\+::vector$<$ size\+\_\+t $>$$>$ \&neighbors, std\+::vector$<$ std\+::vector$<$ double $>$$>$ \&distances)
\begin{DoxyCompactList}\small\item\em Search for all reference points in the given range for each point in the query set, returning the results in the neighbors and distances objects. \end{DoxyCompactList}\item 
void \textbf{ Search} (\textbf{ Tree} $\ast$query\+Tree, const \textbf{ math\+::\+Range} \&range, std\+::vector$<$ std\+::vector$<$ size\+\_\+t $>$$>$ \&neighbors, std\+::vector$<$ std\+::vector$<$ double $>$$>$ \&distances)
\begin{DoxyCompactList}\small\item\em Given a pre-\/built query tree, search for all reference points in the given range for each point in the query set, returning the results in the neighbors and distances objects. \end{DoxyCompactList}\item 
void \textbf{ Search} (const \textbf{ math\+::\+Range} \&range, std\+::vector$<$ std\+::vector$<$ size\+\_\+t $>$$>$ \&neighbors, std\+::vector$<$ std\+::vector$<$ double $>$$>$ \&distances)
\begin{DoxyCompactList}\small\item\em Search for all points in the given range for each point in the reference set (which was passed to the constructor), returning the results in the neighbors and distances objects. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Archive $>$ }\\void \textbf{ serialize} (Archive \&ar, const unsigned int version)
\begin{DoxyCompactList}\small\item\em Serialize the model. \end{DoxyCompactList}\item 
bool \textbf{ Single\+Mode} () const
\begin{DoxyCompactList}\small\item\em Get whether single-\/tree search is being used. \end{DoxyCompactList}\item 
bool \& \textbf{ Single\+Mode} ()
\begin{DoxyCompactList}\small\item\em Modify whether single-\/tree search is being used. \end{DoxyCompactList}\item 
void \textbf{ Train} (Mat\+Type reference\+Set)
\begin{DoxyCompactList}\small\item\em Set the reference set to a new reference set, and build a tree if necessary. \end{DoxyCompactList}\item 
void \textbf{ Train} (\textbf{ Tree} $\ast$reference\+Tree)
\begin{DoxyCompactList}\small\item\em Set the reference tree to a new reference tree. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$typename Metric\+Type = metric\+::\+Euclidean\+Distance, typename Mat\+Type = arma\+::mat, template$<$ typename Tree\+Metric\+Type, typename Tree\+Stat\+Type, typename Tree\+Mat\+Type $>$ class Tree\+Type = tree\+::\+K\+D\+Tree$>$\newline
class mlpack\+::range\+::\+Range\+Search$<$ Metric\+Type, Mat\+Type, Tree\+Type $>$}

The \doxyref{Range\+Search}{p.}{classmlpack_1_1range_1_1RangeSearch} class is a template class for performing range searches. 

It is implemented in the style of a generalized tree-\/independent dual-\/tree algorithm; for more details on the actual algorithm, see the \doxyref{Range\+Search\+Rules}{p.}{classmlpack_1_1range_1_1RangeSearchRules} class.


\begin{DoxyTemplParams}{Template Parameters}
{\em Metric\+Type} & Metric to use for range search calculations. \\
\hline
{\em Mat\+Type} & Type of data to use. \\
\hline
{\em Tree\+Type} & Type of tree to use; must satisfy the Tree\+Type policy A\+PI. \\
\hline
\end{DoxyTemplParams}


Definition at line 42 of file range\+\_\+search.\+hpp.



\subsection{Member Typedef Documentation}
\mbox{\label{classmlpack_1_1range_1_1RangeSearch_a5cbbe0e3dd87208f402ebd5a35dcd608}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!Tree@{Tree}}
\index{Tree@{Tree}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{Tree}
{\footnotesize\ttfamily typedef Tree\+Type$<$Metric\+Type, \textbf{ Range\+Search\+Stat}, Mat\+Type$>$ \textbf{ Tree}}



Convenience typedef. 



Definition at line 46 of file range\+\_\+search.\+hpp.



\subsection{Constructor \& Destructor Documentation}
\mbox{\label{classmlpack_1_1range_1_1RangeSearch_a9292d974d50191623b9f26d7f2ccea1d}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!Range\+Search@{Range\+Search}}
\index{Range\+Search@{Range\+Search}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{Range\+Search()\hspace{0.1cm}{\footnotesize\ttfamily [1/5]}}
{\footnotesize\ttfamily \textbf{ Range\+Search} (\begin{DoxyParamCaption}\item[{Mat\+Type}]{reference\+Set,  }\item[{const bool}]{naive = {\ttfamily false},  }\item[{const bool}]{single\+Mode = {\ttfamily false},  }\item[{const Metric\+Type}]{metric = {\ttfamily MetricType()} }\end{DoxyParamCaption})}



Initialize the \doxyref{Range\+Search}{p.}{classmlpack_1_1range_1_1RangeSearch} object with a given reference dataset (this is the dataset which is searched). 

Optionally, perform the computation in naive mode or single-\/tree mode. Additionally, an instantiated metric can be given, for cases where the distance metric holds data.

This method will move the matrices to internal copies, which are rearranged during tree-\/building. You can avoid creating an extra copy by pre-\/constructing the trees and passing them in using std\+::move.


\begin{DoxyParams}{Parameters}
{\em reference\+Set} & Reference dataset. \\
\hline
{\em naive} & Whether the computation should be done in O(n$^\wedge$2) naive mode. \\
\hline
{\em single\+Mode} & Whether single-\/tree computation should be used (as opposed to dual-\/tree computation). \\
\hline
{\em metric} & Instantiated distance metric. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1range_1_1RangeSearch_a6d201f3cf484ea56a37daabeb0cded94}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!Range\+Search@{Range\+Search}}
\index{Range\+Search@{Range\+Search}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{Range\+Search()\hspace{0.1cm}{\footnotesize\ttfamily [2/5]}}
{\footnotesize\ttfamily \textbf{ Range\+Search} (\begin{DoxyParamCaption}\item[{\textbf{ Tree} $\ast$}]{reference\+Tree,  }\item[{const bool}]{single\+Mode = {\ttfamily false},  }\item[{const Metric\+Type}]{metric = {\ttfamily MetricType()} }\end{DoxyParamCaption})}



Initialize the \doxyref{Range\+Search}{p.}{classmlpack_1_1range_1_1RangeSearch} object with the given pre-\/constructed reference tree (this is the tree built on the reference set, which is the set that is searched). 

Optionally, choose to use single-\/tree mode, which will not build a tree on query points. Naive mode is not available as an option for this constructor. Additionally, an instantiated distance metric can be given, for cases where the distance metric holds data.

There is no copying of the data matrices in this constructor (because tree-\/building is not necessary), so this is the constructor to use when copies absolutely must be avoided.

\begin{DoxyNote}{Note}
Because tree-\/building (at least with Binary\+Space\+Tree) modifies the ordering of a matrix, be aware that mapping of the points back to their original indices is not done when this constructor is used.
\end{DoxyNote}

\begin{DoxyParams}{Parameters}
{\em reference\+Tree} & Pre-\/built tree for reference points. \\
\hline
{\em single\+Mode} & Whether single-\/tree computation should be used (as opposed to dual-\/tree computation). \\
\hline
{\em metric} & Instantiated distance metric. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1range_1_1RangeSearch_a838592644923cb86943f789ca0522bd1}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!Range\+Search@{Range\+Search}}
\index{Range\+Search@{Range\+Search}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{Range\+Search()\hspace{0.1cm}{\footnotesize\ttfamily [3/5]}}
{\footnotesize\ttfamily \textbf{ Range\+Search} (\begin{DoxyParamCaption}\item[{const bool}]{naive = {\ttfamily false},  }\item[{const bool}]{single\+Mode = {\ttfamily false},  }\item[{const Metric\+Type}]{metric = {\ttfamily MetricType()} }\end{DoxyParamCaption})}



Initialize the \doxyref{Range\+Search}{p.}{classmlpack_1_1range_1_1RangeSearch} object without any reference data. 

If the monochromatic \doxyref{Search()}{p.}{classmlpack_1_1range_1_1RangeSearch_a0df148abcabf67c5876e942e12279f8e} is called before a reference set is set with \doxyref{Train()}{p.}{classmlpack_1_1range_1_1RangeSearch_a27ba39af83e3cb01f2e6fbec159adf0e}, no results will be returned (since the reference set is empty).


\begin{DoxyParams}{Parameters}
{\em naive} & Whether to use naive search. \\
\hline
{\em single\+Mode} & Whether single-\/tree computation should be used (as opposed to dual-\/tree computation). \\
\hline
{\em metric} & Instantiated metric. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1range_1_1RangeSearch_af751a5f912b2f3eb714567b6b6ca7c2d}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!Range\+Search@{Range\+Search}}
\index{Range\+Search@{Range\+Search}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{Range\+Search()\hspace{0.1cm}{\footnotesize\ttfamily [4/5]}}
{\footnotesize\ttfamily \textbf{ Range\+Search} (\begin{DoxyParamCaption}\item[{const \textbf{ Range\+Search}$<$ Metric\+Type, Mat\+Type, Tree\+Type $>$ \&}]{other }\end{DoxyParamCaption})}



Construct the \doxyref{Range\+Search}{p.}{classmlpack_1_1range_1_1RangeSearch} model as a copy of the given model. 

Note that this may be computationally intensive!


\begin{DoxyParams}{Parameters}
{\em other} & \doxyref{Range\+Search}{p.}{classmlpack_1_1range_1_1RangeSearch} model to copy. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1range_1_1RangeSearch_aeb192154ad7a75d89fcc6dbb6ffc1f24}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!Range\+Search@{Range\+Search}}
\index{Range\+Search@{Range\+Search}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{Range\+Search()\hspace{0.1cm}{\footnotesize\ttfamily [5/5]}}
{\footnotesize\ttfamily \textbf{ Range\+Search} (\begin{DoxyParamCaption}\item[{\textbf{ Range\+Search}$<$ Metric\+Type, Mat\+Type, Tree\+Type $>$ \&\&}]{other }\end{DoxyParamCaption})}



Construct the \doxyref{Range\+Search}{p.}{classmlpack_1_1range_1_1RangeSearch} model by taking ownership of the given model. 


\begin{DoxyParams}{Parameters}
{\em other} & \doxyref{Range\+Search}{p.}{classmlpack_1_1range_1_1RangeSearch} model to take ownership of. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1range_1_1RangeSearch_a250641479dfc9c4881bdae8c960f767f}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!````~Range\+Search@{$\sim$\+Range\+Search}}
\index{````~Range\+Search@{$\sim$\+Range\+Search}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{$\sim$\+Range\+Search()}
{\footnotesize\ttfamily $\sim$\textbf{ Range\+Search} (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Destroy the \doxyref{Range\+Search}{p.}{classmlpack_1_1range_1_1RangeSearch} object. 

If trees were created, they will be deleted. 

\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1range_1_1RangeSearch_a3f4bd5d0aa64ea090796725f7755287d}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!Base\+Cases@{Base\+Cases}}
\index{Base\+Cases@{Base\+Cases}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{Base\+Cases()}
{\footnotesize\ttfamily size\+\_\+t Base\+Cases (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the number of base cases during the last search. 



Definition at line 273 of file range\+\_\+search.\+hpp.

\mbox{\label{classmlpack_1_1range_1_1RangeSearch_a343230e7d7344e3f7d5f5f2eb89cf2c5}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!Naive@{Naive}}
\index{Naive@{Naive}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{Naive()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily bool Naive (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get whether naive search is being used. 



Definition at line 268 of file range\+\_\+search.\+hpp.

\mbox{\label{classmlpack_1_1range_1_1RangeSearch_af7d397adca3f411b4e2d2f977b280ce6}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!Naive@{Naive}}
\index{Naive@{Naive}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{Naive()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily bool\& Naive (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify whether naive search is being used. 



Definition at line 270 of file range\+\_\+search.\+hpp.

\mbox{\label{classmlpack_1_1range_1_1RangeSearch_adc7076d0a727d71add6d5618a201f96d}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!operator=@{operator=}}
\index{operator=@{operator=}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{operator=()}
{\footnotesize\ttfamily \textbf{ Range\+Search}\& operator= (\begin{DoxyParamCaption}\item[{\textbf{ Range\+Search}$<$ Metric\+Type, Mat\+Type, Tree\+Type $>$}]{other }\end{DoxyParamCaption})}



Copy the given \doxyref{Range\+Search}{p.}{classmlpack_1_1range_1_1RangeSearch} model. 

Use std\+::move to pass in the model if the old copy is no longer needed.


\begin{DoxyParams}{Parameters}
{\em other} & \doxyref{Range\+Search}{p.}{classmlpack_1_1range_1_1RangeSearch} model to copy. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1range_1_1RangeSearch_a0a975940b302b4efec85bbe2d8b36251}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!Reference\+Set@{Reference\+Set}}
\index{Reference\+Set@{Reference\+Set}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{Reference\+Set()}
{\footnotesize\ttfamily const Mat\+Type\& Reference\+Set (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Return the reference set. 



Definition at line 282 of file range\+\_\+search.\+hpp.

\mbox{\label{classmlpack_1_1range_1_1RangeSearch_a92cb2297c084f56afea6f37e3c894f52}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!Reference\+Tree@{Reference\+Tree}}
\index{Reference\+Tree@{Reference\+Tree}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{Reference\+Tree()}
{\footnotesize\ttfamily \textbf{ Tree}$\ast$ Reference\+Tree (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Return the reference tree (or N\+U\+LL if in naive mode). 



Definition at line 285 of file range\+\_\+search.\+hpp.

\mbox{\label{classmlpack_1_1range_1_1RangeSearch_a4d1e40c0bf406280a237ca1b487e3c62}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!Scores@{Scores}}
\index{Scores@{Scores}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{Scores()}
{\footnotesize\ttfamily size\+\_\+t Scores (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the number of scores during the last search. 



Definition at line 275 of file range\+\_\+search.\+hpp.



References Range\+Search$<$ Metric\+Type, Mat\+Type, Tree\+Type $>$\+::serialize().

\mbox{\label{classmlpack_1_1range_1_1RangeSearch_a0df148abcabf67c5876e942e12279f8e}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!Search@{Search}}
\index{Search@{Search}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{Search()\hspace{0.1cm}{\footnotesize\ttfamily [1/3]}}
{\footnotesize\ttfamily void Search (\begin{DoxyParamCaption}\item[{const Mat\+Type \&}]{query\+Set,  }\item[{const \textbf{ math\+::\+Range} \&}]{range,  }\item[{std\+::vector$<$ std\+::vector$<$ size\+\_\+t $>$$>$ \&}]{neighbors,  }\item[{std\+::vector$<$ std\+::vector$<$ double $>$$>$ \&}]{distances }\end{DoxyParamCaption})}



Search for all reference points in the given range for each point in the query set, returning the results in the neighbors and distances objects. 

Each entry in the external vector corresponds to a query point. Each of these entries holds a vector which contains the indices and distances of the reference points falling into the given range.

That is\+:


\begin{DoxyItemize}
\item neighbors.\+size() and distances.\+size() both equal the number of query points.
\item neighbors[i] contains the indices of all the points in the reference set which have distances inside the given range to query point i.
\item distances[i] contains all of the distances corresponding to the indices contained in neighbors[i].
\item neighbors[i] and distances[i] are not sorted in any particular order.
\end{DoxyItemize}


\begin{DoxyParams}{Parameters}
{\em query\+Set} & Set of query points to search with. \\
\hline
{\em range} & Range of distances in which to search. \\
\hline
{\em neighbors} & Object which will hold the list of neighbors for each point which fell into the given range, for each query point. \\
\hline
{\em distances} & Object which will hold the list of distances for each point which fell into the given range, for each query point. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1range_1_1RangeSearch_a24f0beece99aedbee1edf5890f5bc235}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!Search@{Search}}
\index{Search@{Search}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{Search()\hspace{0.1cm}{\footnotesize\ttfamily [2/3]}}
{\footnotesize\ttfamily void Search (\begin{DoxyParamCaption}\item[{\textbf{ Tree} $\ast$}]{query\+Tree,  }\item[{const \textbf{ math\+::\+Range} \&}]{range,  }\item[{std\+::vector$<$ std\+::vector$<$ size\+\_\+t $>$$>$ \&}]{neighbors,  }\item[{std\+::vector$<$ std\+::vector$<$ double $>$$>$ \&}]{distances }\end{DoxyParamCaption})}



Given a pre-\/built query tree, search for all reference points in the given range for each point in the query set, returning the results in the neighbors and distances objects. 

Each entry in the external vector corresponds to a query point. Each of these entries holds a vector which contains the indices and distances of the reference points falling into the given range.

That is\+:


\begin{DoxyItemize}
\item neighbors.\+size() and distances.\+size() both equal the number of query points.
\item neighbors[i] contains the indices of all the points in the reference set which have distances inside the given range to query point i.
\item distances[i] contains all of the distances corresponding to the indices contained in neighbors[i].
\item neighbors[i] and distances[i] are not sorted in any particular order.
\end{DoxyItemize}

If either naive or single\+Mode are set to true, this will throw an invalid\+\_\+argument exception; passing in a query tree implies dual-\/tree search.

If you want to use the reference tree as the query tree, instead call the overload of \doxyref{Search()}{p.}{classmlpack_1_1range_1_1RangeSearch_a0df148abcabf67c5876e942e12279f8e} that does not take a query set.


\begin{DoxyParams}{Parameters}
{\em query\+Tree} & Tree built on query points. \\
\hline
{\em range} & Range of distances in which to search. \\
\hline
{\em neighbors} & Object which will hold the list of neighbors for each point which fell into the given range, for each query point. \\
\hline
{\em distances} & Object which will hold the list of distances for each point which fell into the given range, for each query point. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1range_1_1RangeSearch_a3868480bcd41a740550657144b5f7018}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!Search@{Search}}
\index{Search@{Search}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{Search()\hspace{0.1cm}{\footnotesize\ttfamily [3/3]}}
{\footnotesize\ttfamily void Search (\begin{DoxyParamCaption}\item[{const \textbf{ math\+::\+Range} \&}]{range,  }\item[{std\+::vector$<$ std\+::vector$<$ size\+\_\+t $>$$>$ \&}]{neighbors,  }\item[{std\+::vector$<$ std\+::vector$<$ double $>$$>$ \&}]{distances }\end{DoxyParamCaption})}



Search for all points in the given range for each point in the reference set (which was passed to the constructor), returning the results in the neighbors and distances objects. 

This means that the query set and the reference set are the same.

Each entry in the external vector corresponds to a query point. Each of these entries holds a vector which contains the indices and distances of the reference points falling into the given range.

That is\+:


\begin{DoxyItemize}
\item neighbors.\+size() and distances.\+size() both equal the number of query points.
\item neighbors[i] contains the indices of all the points in the reference set which have distances inside the given range to query point i.
\item distances[i] contains all of the distances corresponding to the indices contained in neighbors[i].
\item neighbors[i] and distances[i] are not sorted in any particular order.
\end{DoxyItemize}


\begin{DoxyParams}{Parameters}
{\em range} & Range of distances in which to search. \\
\hline
{\em neighbors} & Object which will hold the list of neighbors for each point which fell into the given range, for each query point. \\
\hline
{\em distances} & Object which will hold the list of distances for each point which fell into the given range, for each query point. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1range_1_1RangeSearch_a68e832cb064e3b7ca978d8e5911cf700}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!serialize@{serialize}}
\index{serialize@{serialize}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{serialize()}
{\footnotesize\ttfamily void serialize (\begin{DoxyParamCaption}\item[{Archive \&}]{ar,  }\item[{const unsigned int}]{version }\end{DoxyParamCaption})}



Serialize the model. 



Referenced by Range\+Search$<$ Metric\+Type, Mat\+Type, Tree\+Type $>$\+::\+Scores().

\mbox{\label{classmlpack_1_1range_1_1RangeSearch_a7477b3e8499a6158bbe177e7f30d4947}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!Single\+Mode@{Single\+Mode}}
\index{Single\+Mode@{Single\+Mode}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{Single\+Mode()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily bool Single\+Mode (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get whether single-\/tree search is being used. 



Definition at line 263 of file range\+\_\+search.\+hpp.

\mbox{\label{classmlpack_1_1range_1_1RangeSearch_adadacd63ddeadf138d834b1fdc632773}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!Single\+Mode@{Single\+Mode}}
\index{Single\+Mode@{Single\+Mode}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{Single\+Mode()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily bool\& Single\+Mode (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify whether single-\/tree search is being used. 



Definition at line 265 of file range\+\_\+search.\+hpp.

\mbox{\label{classmlpack_1_1range_1_1RangeSearch_a27ba39af83e3cb01f2e6fbec159adf0e}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!Train@{Train}}
\index{Train@{Train}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{Train()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily void Train (\begin{DoxyParamCaption}\item[{Mat\+Type}]{reference\+Set }\end{DoxyParamCaption})}



Set the reference set to a new reference set, and build a tree if necessary. 

This method is called \textquotesingle{}\doxyref{Train()}{p.}{classmlpack_1_1range_1_1RangeSearch_a27ba39af83e3cb01f2e6fbec159adf0e}\textquotesingle{} in order to match the rest of the mlpack abstractions, even though calling this \char`\"{}training\char`\"{} is maybe a bit of a stretch.

Use std\+::move to pass in the reference set if the old copy is no longer needed.


\begin{DoxyParams}{Parameters}
{\em reference\+Set} & New set of reference data. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1range_1_1RangeSearch_a3d1133fe6bda66e7143fd7aab27cbd04}} 
\index{mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}!Train@{Train}}
\index{Train@{Train}!mlpack\+::range\+::\+Range\+Search@{mlpack\+::range\+::\+Range\+Search}}
\subsubsection{Train()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily void Train (\begin{DoxyParamCaption}\item[{\textbf{ Tree} $\ast$}]{reference\+Tree }\end{DoxyParamCaption})}



Set the reference tree to a new reference tree. 



The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
/var/www/mlpack.\+ratml.\+org/mlpack.\+org/\+\_\+src/mlpack-\/git/src/mlpack/methods/range\+\_\+search/\textbf{ range\+\_\+search.\+hpp}\end{DoxyCompactItemize}
