\section{Cosine\+Tree Class Reference}
\label{classmlpack_1_1tree_1_1CosineTree}\index{Cosine\+Tree@{Cosine\+Tree}}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ Cosine\+Tree} (const arma\+::mat \&dataset)
\begin{DoxyCompactList}\small\item\em \doxyref{Cosine\+Tree}{p.}{classmlpack_1_1tree_1_1CosineTree} constructor for the root node of the tree. \end{DoxyCompactList}\item 
\textbf{ Cosine\+Tree} (\textbf{ Cosine\+Tree} \&parent\+Node, const std\+::vector$<$ size\+\_\+t $>$ \&sub\+Indices)
\begin{DoxyCompactList}\small\item\em \doxyref{Cosine\+Tree}{p.}{classmlpack_1_1tree_1_1CosineTree} constructor for nodes other than the root node of the tree. \end{DoxyCompactList}\item 
\textbf{ Cosine\+Tree} (const arma\+::mat \&dataset, const double epsilon, const double delta)
\begin{DoxyCompactList}\small\item\em Construct the \doxyref{Cosine\+Tree}{p.}{classmlpack_1_1tree_1_1CosineTree} and the basis for the given matrix, and passed \textquotesingle{}epsilon\textquotesingle{} and \textquotesingle{}delta\textquotesingle{} parameters. \end{DoxyCompactList}\item 
\textbf{ Cosine\+Tree} (const \textbf{ Cosine\+Tree} \&other)
\begin{DoxyCompactList}\small\item\em Copy the given tree. \end{DoxyCompactList}\item 
\textbf{ Cosine\+Tree} (\textbf{ Cosine\+Tree} \&\&other)
\begin{DoxyCompactList}\small\item\em Move the given tree. \end{DoxyCompactList}\item 
\textbf{ $\sim$\+Cosine\+Tree} ()
\begin{DoxyCompactList}\small\item\em Clean up the \doxyref{Cosine\+Tree}{p.}{classmlpack_1_1tree_1_1CosineTree}\+: release allocated memory (including children). \end{DoxyCompactList}\item 
void \textbf{ Basis\+Vector} (arma\+::vec \&b\+Vector)
\begin{DoxyCompactList}\small\item\em Set the basis vector of the node. \end{DoxyCompactList}\item 
arma\+::vec \& \textbf{ Basis\+Vector} ()
\begin{DoxyCompactList}\small\item\em Get the basis vector of the node. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ Binary\+Search} (arma\+::vec \&c\+Distribution, double value, size\+\_\+t start, size\+\_\+t end)
\begin{DoxyCompactList}\small\item\em Sample a column based on the cumulative Length-\/\+Squared distribution of the cosine node, and a randomly generated value in the range [0, 1]. \end{DoxyCompactList}\item 
void \textbf{ Calculate\+Centroid} ()
\begin{DoxyCompactList}\small\item\em Calculate centroid of the columns present in the node. \end{DoxyCompactList}\item 
void \textbf{ Calculate\+Cosines} (arma\+::vec \&cosines)
\begin{DoxyCompactList}\small\item\em Calculate cosines of the columns present in the node, with respect to the sampled splitting point. \end{DoxyCompactList}\item 
arma\+::vec \& \textbf{ Centroid} ()
\begin{DoxyCompactList}\small\item\em Get pointer to the centroid vector. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ Column\+Sample\+LS} ()
\begin{DoxyCompactList}\small\item\em Sample a point from the Length-\/\+Squared distribution of the cosine node. \end{DoxyCompactList}\item 
void \textbf{ Column\+Samples\+LS} (std\+::vector$<$ size\+\_\+t $>$ \&sampled\+Indices, arma\+::vec \&probabilities, size\+\_\+t num\+Samples)
\begin{DoxyCompactList}\small\item\em Sample \textquotesingle{}num\+Samples\textquotesingle{} points from the Length-\/\+Squared distribution of the cosine node. \end{DoxyCompactList}\item 
void \textbf{ Construct\+Basis} (\textbf{ Cosine\+Node\+Queue} \&tree\+Queue)
\begin{DoxyCompactList}\small\item\em Constructs the final basis matrix, after the cosine tree construction. \end{DoxyCompactList}\item 
void \textbf{ Cosine\+Node\+Split} ()
\begin{DoxyCompactList}\small\item\em This function splits the cosine node into two children based on the cosines of the columns contained in the node, with respect to the sampled splitting point. \end{DoxyCompactList}\item 
double \textbf{ Frob\+Norm\+Squared} () const
\begin{DoxyCompactList}\small\item\em Get the Frobenius norm squared of columns in the node. \end{DoxyCompactList}\item 
const arma\+::mat \& \textbf{ Get\+Dataset} () const
\begin{DoxyCompactList}\small\item\em Get pointer to the dataset matrix. \end{DoxyCompactList}\item 
void \textbf{ Get\+Final\+Basis} (arma\+::mat \&final\+Basis)
\begin{DoxyCompactList}\small\item\em Returns the basis of the constructed subspace. \end{DoxyCompactList}\item 
void \textbf{ L2\+Error} (const double error)
\begin{DoxyCompactList}\small\item\em Set the Monte Carlo error. \end{DoxyCompactList}\item 
double \textbf{ L2\+Error} () const
\begin{DoxyCompactList}\small\item\em Get the Monte Carlo error. \end{DoxyCompactList}\item 
\textbf{ Cosine\+Tree} $\ast$ \textbf{ Left} () const
\begin{DoxyCompactList}\small\item\em Get pointer to the left child of the node. \end{DoxyCompactList}\item 
\textbf{ Cosine\+Tree} $\ast$\& \textbf{ Left} ()
\begin{DoxyCompactList}\small\item\em Modify the pointer to the left child of the node. \end{DoxyCompactList}\item 
void \textbf{ Modified\+Gram\+Schmidt} (\textbf{ Cosine\+Node\+Queue} \&tree\+Queue, arma\+::vec \&centroid, arma\+::vec \&new\+Basis\+Vector, arma\+::vec $\ast$add\+Basis\+Vector=N\+U\+LL)
\begin{DoxyCompactList}\small\item\em Calculates the orthonormalization of the passed centroid, with respect to the current vector subspace. \end{DoxyCompactList}\item 
double \textbf{ Monte\+Carlo\+Error} (\textbf{ Cosine\+Tree} $\ast$node, \textbf{ Cosine\+Node\+Queue} \&tree\+Queue, arma\+::vec $\ast$add\+Basis\+Vector1=N\+U\+LL, arma\+::vec $\ast$add\+Basis\+Vector2=N\+U\+LL)
\begin{DoxyCompactList}\small\item\em Estimates the squared error of the projection of the input node\textquotesingle{}s matrix onto the current vector subspace. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ Num\+Columns} () const
\begin{DoxyCompactList}\small\item\em Get number of columns of input matrix in the node. \end{DoxyCompactList}\item 
\textbf{ Cosine\+Tree} \& \textbf{ operator=} (const \textbf{ Cosine\+Tree} \&other)
\begin{DoxyCompactList}\small\item\em Copy the given Cosine Tree. \end{DoxyCompactList}\item 
\textbf{ Cosine\+Tree} \& \textbf{ operator=} (\textbf{ Cosine\+Tree} \&\&other)
\begin{DoxyCompactList}\small\item\em Take ownership of the given Cosine Tree. \end{DoxyCompactList}\item 
\textbf{ Cosine\+Tree} $\ast$ \textbf{ Parent} () const
\begin{DoxyCompactList}\small\item\em Get pointer to the parent node. \end{DoxyCompactList}\item 
\textbf{ Cosine\+Tree} $\ast$\& \textbf{ Parent} ()
\begin{DoxyCompactList}\small\item\em Modify the pointer to the parent node. \end{DoxyCompactList}\item 
\textbf{ Cosine\+Tree} $\ast$ \textbf{ Right} () const
\begin{DoxyCompactList}\small\item\em Get pointer to the right child of the node. \end{DoxyCompactList}\item 
\textbf{ Cosine\+Tree} $\ast$\& \textbf{ Right} ()
\begin{DoxyCompactList}\small\item\em Modify the pointer to the left child of the node. \end{DoxyCompactList}\item 
size\+\_\+t \textbf{ Split\+Point\+Index} () const
\begin{DoxyCompactList}\small\item\em Get the column index of split point of the node. \end{DoxyCompactList}\item 
std\+::vector$<$ size\+\_\+t $>$ \& \textbf{ Vector\+Indices} ()
\begin{DoxyCompactList}\small\item\em Get the indices of columns in the node. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}


Definition at line 29 of file cosine\+\_\+tree.\+hpp.



\subsection{Constructor \& Destructor Documentation}
\mbox{\label{classmlpack_1_1tree_1_1CosineTree_a1e27589e566f3ce121eadf14387c3a44}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Cosine\+Tree@{Cosine\+Tree}}
\index{Cosine\+Tree@{Cosine\+Tree}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Cosine\+Tree()\hspace{0.1cm}{\footnotesize\ttfamily [1/5]}}
{\footnotesize\ttfamily \textbf{ Cosine\+Tree} (\begin{DoxyParamCaption}\item[{const arma\+::mat \&}]{dataset }\end{DoxyParamCaption})}



\doxyref{Cosine\+Tree}{p.}{classmlpack_1_1tree_1_1CosineTree} constructor for the root node of the tree. 

It initializes the necessary variables required for splitting of the node, and building the tree further. It takes a pointer to the input matrix and calculates the relevant variables using it.


\begin{DoxyParams}{Parameters}
{\em dataset} & Matrix for which cosine tree is constructed. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1tree_1_1CosineTree_af0b662915d683d5fb725a35c578f4e51}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Cosine\+Tree@{Cosine\+Tree}}
\index{Cosine\+Tree@{Cosine\+Tree}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Cosine\+Tree()\hspace{0.1cm}{\footnotesize\ttfamily [2/5]}}
{\footnotesize\ttfamily \textbf{ Cosine\+Tree} (\begin{DoxyParamCaption}\item[{\textbf{ Cosine\+Tree} \&}]{parent\+Node,  }\item[{const std\+::vector$<$ size\+\_\+t $>$ \&}]{sub\+Indices }\end{DoxyParamCaption})}



\doxyref{Cosine\+Tree}{p.}{classmlpack_1_1tree_1_1CosineTree} constructor for nodes other than the root node of the tree. 

It takes in a pointer to the parent node and a list of column indices which mentions the columns to be included in the node. The function calculate the relevant variables just like the constructor above.


\begin{DoxyParams}{Parameters}
{\em parent\+Node} & Pointer to the parent cosine node. \\
\hline
{\em sub\+Indices} & Pointer to vector of column indices to be included. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1tree_1_1CosineTree_aa5804a437ebafa1260b20e93b1bee74e}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Cosine\+Tree@{Cosine\+Tree}}
\index{Cosine\+Tree@{Cosine\+Tree}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Cosine\+Tree()\hspace{0.1cm}{\footnotesize\ttfamily [3/5]}}
{\footnotesize\ttfamily \textbf{ Cosine\+Tree} (\begin{DoxyParamCaption}\item[{const arma\+::mat \&}]{dataset,  }\item[{const double}]{epsilon,  }\item[{const double}]{delta }\end{DoxyParamCaption})}



Construct the \doxyref{Cosine\+Tree}{p.}{classmlpack_1_1tree_1_1CosineTree} and the basis for the given matrix, and passed \textquotesingle{}epsilon\textquotesingle{} and \textquotesingle{}delta\textquotesingle{} parameters. 

The \doxyref{Cosine\+Tree}{p.}{classmlpack_1_1tree_1_1CosineTree} is constructed by splitting nodes in the direction of maximum error, stored using a priority queue. Basis vectors are added from the left and right children of the split node. The basis vector from a node is the orthonormalized centroid of its columns. The splitting continues till the Monte Carlo estimate of the input matrix\textquotesingle{}s projection on the obtained subspace is less than a fraction of the norm of the input matrix.


\begin{DoxyParams}{Parameters}
{\em dataset} & Matrix for which the \doxyref{Cosine\+Tree}{p.}{classmlpack_1_1tree_1_1CosineTree} is constructed. \\
\hline
{\em epsilon} & Error tolerance fraction for calculated subspace. \\
\hline
{\em delta} & Cumulative probability for Monte Carlo error lower bound. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1tree_1_1CosineTree_a942c8b7b73edbba8217d61effe19295d}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Cosine\+Tree@{Cosine\+Tree}}
\index{Cosine\+Tree@{Cosine\+Tree}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Cosine\+Tree()\hspace{0.1cm}{\footnotesize\ttfamily [4/5]}}
{\footnotesize\ttfamily \textbf{ Cosine\+Tree} (\begin{DoxyParamCaption}\item[{const \textbf{ Cosine\+Tree} \&}]{other }\end{DoxyParamCaption})}



Copy the given tree. 

Be careful! This may use a lot of memory.


\begin{DoxyParams}{Parameters}
{\em other} & Tree to copy from. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1tree_1_1CosineTree_a5ead62f02a3ae19dcd9a9e191f35eedc}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Cosine\+Tree@{Cosine\+Tree}}
\index{Cosine\+Tree@{Cosine\+Tree}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Cosine\+Tree()\hspace{0.1cm}{\footnotesize\ttfamily [5/5]}}
{\footnotesize\ttfamily \textbf{ Cosine\+Tree} (\begin{DoxyParamCaption}\item[{\textbf{ Cosine\+Tree} \&\&}]{other }\end{DoxyParamCaption})}



Move the given tree. 

The tree passed as a parameter will be emptied and will not be usable after this call.


\begin{DoxyParams}{Parameters}
{\em other} & Tree to move. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1tree_1_1CosineTree_adae22b854e7002416890ec21adc97b7f}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!````~Cosine\+Tree@{$\sim$\+Cosine\+Tree}}
\index{````~Cosine\+Tree@{$\sim$\+Cosine\+Tree}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{$\sim$\+Cosine\+Tree()}
{\footnotesize\ttfamily $\sim$\textbf{ Cosine\+Tree} (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Clean up the \doxyref{Cosine\+Tree}{p.}{classmlpack_1_1tree_1_1CosineTree}\+: release allocated memory (including children). 



\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1tree_1_1CosineTree_a737b8825f2df2dfe7d1b8e7aa9bb38fe}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Basis\+Vector@{Basis\+Vector}}
\index{Basis\+Vector@{Basis\+Vector}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Basis\+Vector()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily void Basis\+Vector (\begin{DoxyParamCaption}\item[{arma\+::vec \&}]{b\+Vector }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Set the basis vector of the node. 



Definition at line 215 of file cosine\+\_\+tree.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1CosineTree_a35c61237d24a9f7a9ef127d4b215ea86}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Basis\+Vector@{Basis\+Vector}}
\index{Basis\+Vector@{Basis\+Vector}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Basis\+Vector()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily arma\+::vec\& Basis\+Vector (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Get the basis vector of the node. 



Definition at line 218 of file cosine\+\_\+tree.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1CosineTree_ad80836c9171855e61a260a4fddcf3a0e}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Binary\+Search@{Binary\+Search}}
\index{Binary\+Search@{Binary\+Search}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Binary\+Search()}
{\footnotesize\ttfamily size\+\_\+t Binary\+Search (\begin{DoxyParamCaption}\item[{arma\+::vec \&}]{c\+Distribution,  }\item[{double}]{value,  }\item[{size\+\_\+t}]{start,  }\item[{size\+\_\+t}]{end }\end{DoxyParamCaption})}



Sample a column based on the cumulative Length-\/\+Squared distribution of the cosine node, and a randomly generated value in the range [0, 1]. 

Binary search is more efficient than searching linearly for the same. This leads a significant speedup when there are large number of columns to choose from and when a number of samples are to be drawn from the distribution.


\begin{DoxyParams}{Parameters}
{\em c\+Distribution} & Cumulative LS distribution of columns in the node. \\
\hline
{\em value} & Randomly generated value in the range [0, 1]. \\
\hline
{\em start} & Starting index of the distribution interval to search in. \\
\hline
{\em end} & Ending index of the distribution interval to search in. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1tree_1_1CosineTree_aeb3842c2f9a0e3e1d49f8e6ce7f6431e}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Calculate\+Centroid@{Calculate\+Centroid}}
\index{Calculate\+Centroid@{Calculate\+Centroid}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Calculate\+Centroid()}
{\footnotesize\ttfamily void Calculate\+Centroid (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Calculate centroid of the columns present in the node. 

The calculated centroid is used as a basis vector for the cosine tree being constructed. \mbox{\label{classmlpack_1_1tree_1_1CosineTree_aafe1e87172a3f6628428e28895df5257}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Calculate\+Cosines@{Calculate\+Cosines}}
\index{Calculate\+Cosines@{Calculate\+Cosines}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Calculate\+Cosines()}
{\footnotesize\ttfamily void Calculate\+Cosines (\begin{DoxyParamCaption}\item[{arma\+::vec \&}]{cosines }\end{DoxyParamCaption})}



Calculate cosines of the columns present in the node, with respect to the sampled splitting point. 

The calculated cosine values are useful for splitting the node into its children.


\begin{DoxyParams}{Parameters}
{\em cosines} & Vector to store the cosine values in. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1tree_1_1CosineTree_a656ee900ec6d5a1548d3023d7df8bb9a}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Centroid@{Centroid}}
\index{Centroid@{Centroid}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Centroid()}
{\footnotesize\ttfamily arma\+::vec\& Centroid (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Get pointer to the centroid vector. 



Definition at line 212 of file cosine\+\_\+tree.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1CosineTree_a112729f2530c75f0eb57263e916214d2}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Column\+Sample\+LS@{Column\+Sample\+LS}}
\index{Column\+Sample\+LS@{Column\+Sample\+LS}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Column\+Sample\+L\+S()}
{\footnotesize\ttfamily size\+\_\+t Column\+Sample\+LS (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Sample a point from the Length-\/\+Squared distribution of the cosine node. 

The function uses \textquotesingle{}l2\+Norms\+Squared\textquotesingle{} to calculate the cumulative probability distribution of the column vectors. The sampling is based on a randomly generated value in the range [0, 1]. \mbox{\label{classmlpack_1_1tree_1_1CosineTree_a18ab1e417b5a6e5afc59e138a3f9a2cc}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Column\+Samples\+LS@{Column\+Samples\+LS}}
\index{Column\+Samples\+LS@{Column\+Samples\+LS}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Column\+Samples\+L\+S()}
{\footnotesize\ttfamily void Column\+Samples\+LS (\begin{DoxyParamCaption}\item[{std\+::vector$<$ size\+\_\+t $>$ \&}]{sampled\+Indices,  }\item[{arma\+::vec \&}]{probabilities,  }\item[{size\+\_\+t}]{num\+Samples }\end{DoxyParamCaption})}



Sample \textquotesingle{}num\+Samples\textquotesingle{} points from the Length-\/\+Squared distribution of the cosine node. 

The function uses \textquotesingle{}l2\+Norms\+Squared\textquotesingle{} to calculate the cumulative probability distribution of the column vectors. The sampling is based on a randomly generated values in the range [0, 1]. \mbox{\label{classmlpack_1_1tree_1_1CosineTree_a01062cbdaa12bf83523adb1bd82265b8}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Construct\+Basis@{Construct\+Basis}}
\index{Construct\+Basis@{Construct\+Basis}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Construct\+Basis()}
{\footnotesize\ttfamily void Construct\+Basis (\begin{DoxyParamCaption}\item[{\textbf{ Cosine\+Node\+Queue} \&}]{tree\+Queue }\end{DoxyParamCaption})}



Constructs the final basis matrix, after the cosine tree construction. 


\begin{DoxyParams}{Parameters}
{\em tree\+Queue} & Priority queue of cosine nodes. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1tree_1_1CosineTree_afeda1ec11ecff5a7ff307f509f0b1835}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Cosine\+Node\+Split@{Cosine\+Node\+Split}}
\index{Cosine\+Node\+Split@{Cosine\+Node\+Split}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Cosine\+Node\+Split()}
{\footnotesize\ttfamily void Cosine\+Node\+Split (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



This function splits the cosine node into two children based on the cosines of the columns contained in the node, with respect to the sampled splitting point. 

The function also calls the \doxyref{Cosine\+Tree}{p.}{classmlpack_1_1tree_1_1CosineTree} constructor for the children. \mbox{\label{classmlpack_1_1tree_1_1CosineTree_abec1aa0484eaa45e2df3781738a8a585}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Frob\+Norm\+Squared@{Frob\+Norm\+Squared}}
\index{Frob\+Norm\+Squared@{Frob\+Norm\+Squared}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Frob\+Norm\+Squared()}
{\footnotesize\ttfamily double Frob\+Norm\+Squared (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the Frobenius norm squared of columns in the node. 



Definition at line 239 of file cosine\+\_\+tree.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1CosineTree_a84462278f191fbce4e4f9b436a8ce833}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Get\+Dataset@{Get\+Dataset}}
\index{Get\+Dataset@{Get\+Dataset}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Get\+Dataset()}
{\footnotesize\ttfamily const arma\+::mat\& Get\+Dataset (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get pointer to the dataset matrix. 



Definition at line 201 of file cosine\+\_\+tree.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1CosineTree_ac081c8635ac1998cdc2d0ba6331ff8b8}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Get\+Final\+Basis@{Get\+Final\+Basis}}
\index{Get\+Final\+Basis@{Get\+Final\+Basis}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Get\+Final\+Basis()}
{\footnotesize\ttfamily void Get\+Final\+Basis (\begin{DoxyParamCaption}\item[{arma\+::mat \&}]{final\+Basis }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Returns the basis of the constructed subspace. 



Definition at line 198 of file cosine\+\_\+tree.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1CosineTree_a852a4616e03de1e8f22c0adde1d3883b}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!L2\+Error@{L2\+Error}}
\index{L2\+Error@{L2\+Error}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{L2\+Error()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily void L2\+Error (\begin{DoxyParamCaption}\item[{const double}]{error }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Set the Monte Carlo error. 



Definition at line 207 of file cosine\+\_\+tree.\+hpp.



Referenced by Compare\+Cosine\+Node\+::operator()().

\mbox{\label{classmlpack_1_1tree_1_1CosineTree_a8cd1d30174d667db3fdada33a3d252df}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!L2\+Error@{L2\+Error}}
\index{L2\+Error@{L2\+Error}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{L2\+Error()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily double L2\+Error (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the Monte Carlo error. 



Definition at line 209 of file cosine\+\_\+tree.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1CosineTree_a117ea48bf4b5bc63da841c9c0d7c7652}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Left@{Left}}
\index{Left@{Left}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Left()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily \textbf{ Cosine\+Tree}$\ast$ Left (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get pointer to the left child of the node. 



Definition at line 226 of file cosine\+\_\+tree.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1CosineTree_a1dbecfcbe00f5907e781c2aee77b9d9f}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Left@{Left}}
\index{Left@{Left}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Left()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily \textbf{ Cosine\+Tree}$\ast$\& Left (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify the pointer to the left child of the node. 



Definition at line 228 of file cosine\+\_\+tree.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1CosineTree_a6ab743d941fc8714af909f7217618f21}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Modified\+Gram\+Schmidt@{Modified\+Gram\+Schmidt}}
\index{Modified\+Gram\+Schmidt@{Modified\+Gram\+Schmidt}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Modified\+Gram\+Schmidt()}
{\footnotesize\ttfamily void Modified\+Gram\+Schmidt (\begin{DoxyParamCaption}\item[{\textbf{ Cosine\+Node\+Queue} \&}]{tree\+Queue,  }\item[{arma\+::vec \&}]{centroid,  }\item[{arma\+::vec \&}]{new\+Basis\+Vector,  }\item[{arma\+::vec $\ast$}]{add\+Basis\+Vector = {\ttfamily NULL} }\end{DoxyParamCaption})}



Calculates the orthonormalization of the passed centroid, with respect to the current vector subspace. 


\begin{DoxyParams}{Parameters}
{\em tree\+Queue} & Priority queue of cosine nodes. \\
\hline
{\em centroid} & Centroid of the node being added to the basis. \\
\hline
{\em new\+Basis\+Vector} & Orthonormalized centroid of the node. \\
\hline
{\em add\+Basis\+Vector} & Address to additional basis vector. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1tree_1_1CosineTree_ae2980acb1c0f87ce2d61a4869396c0b2}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Monte\+Carlo\+Error@{Monte\+Carlo\+Error}}
\index{Monte\+Carlo\+Error@{Monte\+Carlo\+Error}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Monte\+Carlo\+Error()}
{\footnotesize\ttfamily double Monte\+Carlo\+Error (\begin{DoxyParamCaption}\item[{\textbf{ Cosine\+Tree} $\ast$}]{node,  }\item[{\textbf{ Cosine\+Node\+Queue} \&}]{tree\+Queue,  }\item[{arma\+::vec $\ast$}]{add\+Basis\+Vector1 = {\ttfamily NULL},  }\item[{arma\+::vec $\ast$}]{add\+Basis\+Vector2 = {\ttfamily NULL} }\end{DoxyParamCaption})}



Estimates the squared error of the projection of the input node\textquotesingle{}s matrix onto the current vector subspace. 

A normal distribution is fit using weighted norms of projections of samples drawn from the input node\textquotesingle{}s matrix columns. The error is calculated as the difference between the Frobenius norm of the input node\textquotesingle{}s matrix and lower bound of the normal distribution.


\begin{DoxyParams}{Parameters}
{\em node} & Node for which Monte Carlo estimate is calculated. \\
\hline
{\em tree\+Queue} & Priority queue of cosine nodes. \\
\hline
{\em add\+Basis\+Vector1} & Address to first additional basis vector. \\
\hline
{\em add\+Basis\+Vector2} & Address to second additional basis vector. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1tree_1_1CosineTree_a323ed936aead88b2ea455f50ae69c8fc}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Num\+Columns@{Num\+Columns}}
\index{Num\+Columns@{Num\+Columns}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Num\+Columns()}
{\footnotesize\ttfamily size\+\_\+t Num\+Columns (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get number of columns of input matrix in the node. 



Definition at line 236 of file cosine\+\_\+tree.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1CosineTree_af8121e5098ebb982090b5ed45a62df29}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!operator=@{operator=}}
\index{operator=@{operator=}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{operator=()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily \textbf{ Cosine\+Tree}\& operator= (\begin{DoxyParamCaption}\item[{const \textbf{ Cosine\+Tree} \&}]{other }\end{DoxyParamCaption})}



Copy the given Cosine Tree. 


\begin{DoxyParams}{Parameters}
{\em other} & The tree to be copied. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1tree_1_1CosineTree_a23a3bd9c804619bc01dd3ba416628526}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!operator=@{operator=}}
\index{operator=@{operator=}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{operator=()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily \textbf{ Cosine\+Tree}\& operator= (\begin{DoxyParamCaption}\item[{\textbf{ Cosine\+Tree} \&\&}]{other }\end{DoxyParamCaption})}



Take ownership of the given Cosine Tree. 


\begin{DoxyParams}{Parameters}
{\em other} & The tree to take ownership of. \\
\hline
\end{DoxyParams}
\mbox{\label{classmlpack_1_1tree_1_1CosineTree_aec29260d76499bcc20ca4f51fe09298f}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Parent@{Parent}}
\index{Parent@{Parent}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Parent()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily \textbf{ Cosine\+Tree}$\ast$ Parent (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get pointer to the parent node. 



Definition at line 221 of file cosine\+\_\+tree.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1CosineTree_af2d49b8a1a37b2ec59641f82ccfb89cb}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Parent@{Parent}}
\index{Parent@{Parent}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Parent()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily \textbf{ Cosine\+Tree}$\ast$\& Parent (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify the pointer to the parent node. 



Definition at line 223 of file cosine\+\_\+tree.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1CosineTree_a53e967056641c574128ef47abb868018}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Right@{Right}}
\index{Right@{Right}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Right()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily \textbf{ Cosine\+Tree}$\ast$ Right (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get pointer to the right child of the node. 



Definition at line 231 of file cosine\+\_\+tree.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1CosineTree_af635bb87df3ce2a8caf0fcaab3825d9b}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Right@{Right}}
\index{Right@{Right}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Right()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily \textbf{ Cosine\+Tree}$\ast$\& Right (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify the pointer to the left child of the node. 



Definition at line 233 of file cosine\+\_\+tree.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1CosineTree_a5bf7901eea75fb61ba5f32ae1dc5f19c}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Split\+Point\+Index@{Split\+Point\+Index}}
\index{Split\+Point\+Index@{Split\+Point\+Index}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Split\+Point\+Index()}
{\footnotesize\ttfamily size\+\_\+t Split\+Point\+Index (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the column index of split point of the node. 



Definition at line 242 of file cosine\+\_\+tree.\+hpp.

\mbox{\label{classmlpack_1_1tree_1_1CosineTree_ac53c500b862d0a97806070d4685fd77e}} 
\index{mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}!Vector\+Indices@{Vector\+Indices}}
\index{Vector\+Indices@{Vector\+Indices}!mlpack\+::tree\+::\+Cosine\+Tree@{mlpack\+::tree\+::\+Cosine\+Tree}}
\subsubsection{Vector\+Indices()}
{\footnotesize\ttfamily std\+::vector$<$size\+\_\+t$>$\& Vector\+Indices (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Get the indices of columns in the node. 



Definition at line 204 of file cosine\+\_\+tree.\+hpp.



The documentation for this class was generated from the following file\+:\begin{DoxyCompactItemize}
\item 
/var/www/mlpack.\+ratml.\+org/mlpack.\+org/\+\_\+src/mlpack-\/3.\+3.\+1/src/mlpack/core/tree/cosine\+\_\+tree/\textbf{ cosine\+\_\+tree.\+hpp}\end{DoxyCompactItemize}
