\section{I\+P\+Metric$<$ Kernel\+Type $>$ Class Template Reference}
\label{classmlpack_1_1metric_1_1IPMetric}\index{I\+P\+Metric$<$ Kernel\+Type $>$@{I\+P\+Metric$<$ Kernel\+Type $>$}}


The inner product metric, \doxyref{I\+P\+Metric}{p.}{classmlpack_1_1metric_1_1IPMetric}, takes a given Mercer kernel (Kernel\+Type), and when \doxyref{Evaluate()}{p.}{classmlpack_1_1metric_1_1IPMetric_a55e03560fb8c7923de4a43df9a265437} is called, returns the distance between the two points in kernel space\+:  




Inheritance diagram for I\+P\+Metric$<$ Kernel\+Type $>$\+:
\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=350pt]{classmlpack_1_1metric_1_1IPMetric__inherit__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{DoxyCompactItemize}
\item 
\textbf{ I\+P\+Metric} ()
\begin{DoxyCompactList}\small\item\em Create the \doxyref{I\+P\+Metric}{p.}{classmlpack_1_1metric_1_1IPMetric} without an instantiated kernel. \end{DoxyCompactList}\item 
\textbf{ I\+P\+Metric} (Kernel\+Type \&kernel)
\begin{DoxyCompactList}\small\item\em Create the \doxyref{I\+P\+Metric}{p.}{classmlpack_1_1metric_1_1IPMetric} with an instantiated kernel. \end{DoxyCompactList}\item 
\textbf{ I\+P\+Metric} (const \textbf{ I\+P\+Metric} \&other)
\begin{DoxyCompactList}\small\item\em Copy the parameters of the given metric. \end{DoxyCompactList}\item 
\textbf{ $\sim$\+I\+P\+Metric} ()
\begin{DoxyCompactList}\small\item\em Destroy the \doxyref{I\+P\+Metric}{p.}{classmlpack_1_1metric_1_1IPMetric} object. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Vec\+TypeA , typename Vec\+TypeB $>$ }\\Vec\+Type\+A\+::elem\+\_\+type \textbf{ Evaluate} (const Vec\+TypeA \&a, const Vec\+TypeB \&b)
\begin{DoxyCompactList}\small\item\em Evaluate the metric. \end{DoxyCompactList}\item 
const Kernel\+Type \& \textbf{ Kernel} () const
\begin{DoxyCompactList}\small\item\em Get the kernel. \end{DoxyCompactList}\item 
Kernel\+Type \& \textbf{ Kernel} ()
\begin{DoxyCompactList}\small\item\em Modify the kernel. \end{DoxyCompactList}\item 
\textbf{ I\+P\+Metric} \& \textbf{ operator=} (const \textbf{ I\+P\+Metric} \&other)
\begin{DoxyCompactList}\small\item\em Assign this metric to be a copy of the given metric. \end{DoxyCompactList}\item 
{\footnotesize template$<$typename Archive $>$ }\\void \textbf{ serialize} (Archive \&ar, const unsigned int version)
\begin{DoxyCompactList}\small\item\em Serialize the metric. \end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}
\subsubsection*{template$<$typename Kernel\+Type$>$\newline
class mlpack\+::metric\+::\+I\+P\+Metric$<$ Kernel\+Type $>$}

The inner product metric, \doxyref{I\+P\+Metric}{p.}{classmlpack_1_1metric_1_1IPMetric}, takes a given Mercer kernel (Kernel\+Type), and when \doxyref{Evaluate()}{p.}{classmlpack_1_1metric_1_1IPMetric_a55e03560fb8c7923de4a43df9a265437} is called, returns the distance between the two points in kernel space\+: 

\[ d(x, y) = \sqrt{ K(x, x) + K(y, y) - 2K(x, y) }. \]


\begin{DoxyTemplParams}{Template Parameters}
{\em Kernel\+Type} & Type of Kernel to use. This must be a Mercer kernel (positive definite), otherwise the metric may not be valid. \\
\hline
\end{DoxyTemplParams}


Definition at line 32 of file ip\+\_\+metric.\+hpp.



\subsection{Constructor \& Destructor Documentation}
\mbox{\label{classmlpack_1_1metric_1_1IPMetric_a0774938d01373c8d5aaeebfc930c4e3d}} 
\index{mlpack\+::metric\+::\+I\+P\+Metric@{mlpack\+::metric\+::\+I\+P\+Metric}!I\+P\+Metric@{I\+P\+Metric}}
\index{I\+P\+Metric@{I\+P\+Metric}!mlpack\+::metric\+::\+I\+P\+Metric@{mlpack\+::metric\+::\+I\+P\+Metric}}
\subsubsection{I\+P\+Metric()\hspace{0.1cm}{\footnotesize\ttfamily [1/3]}}
{\footnotesize\ttfamily \textbf{ I\+P\+Metric} (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Create the \doxyref{I\+P\+Metric}{p.}{classmlpack_1_1metric_1_1IPMetric} without an instantiated kernel. 

\mbox{\label{classmlpack_1_1metric_1_1IPMetric_a83bc1993b4d2626112ba0169e8fdd5b9}} 
\index{mlpack\+::metric\+::\+I\+P\+Metric@{mlpack\+::metric\+::\+I\+P\+Metric}!I\+P\+Metric@{I\+P\+Metric}}
\index{I\+P\+Metric@{I\+P\+Metric}!mlpack\+::metric\+::\+I\+P\+Metric@{mlpack\+::metric\+::\+I\+P\+Metric}}
\subsubsection{I\+P\+Metric()\hspace{0.1cm}{\footnotesize\ttfamily [2/3]}}
{\footnotesize\ttfamily \textbf{ I\+P\+Metric} (\begin{DoxyParamCaption}\item[{Kernel\+Type \&}]{kernel }\end{DoxyParamCaption})}



Create the \doxyref{I\+P\+Metric}{p.}{classmlpack_1_1metric_1_1IPMetric} with an instantiated kernel. 

\mbox{\label{classmlpack_1_1metric_1_1IPMetric_acb6ac7e7c6b1cdeffaccfa96b5573c99}} 
\index{mlpack\+::metric\+::\+I\+P\+Metric@{mlpack\+::metric\+::\+I\+P\+Metric}!````~I\+P\+Metric@{$\sim$\+I\+P\+Metric}}
\index{````~I\+P\+Metric@{$\sim$\+I\+P\+Metric}!mlpack\+::metric\+::\+I\+P\+Metric@{mlpack\+::metric\+::\+I\+P\+Metric}}
\subsubsection{$\sim$\+I\+P\+Metric()}
{\footnotesize\ttfamily $\sim$\textbf{ I\+P\+Metric} (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})}



Destroy the \doxyref{I\+P\+Metric}{p.}{classmlpack_1_1metric_1_1IPMetric} object. 

\mbox{\label{classmlpack_1_1metric_1_1IPMetric_a068775d03b4fe6ccf17bd833c152bf86}} 
\index{mlpack\+::metric\+::\+I\+P\+Metric@{mlpack\+::metric\+::\+I\+P\+Metric}!I\+P\+Metric@{I\+P\+Metric}}
\index{I\+P\+Metric@{I\+P\+Metric}!mlpack\+::metric\+::\+I\+P\+Metric@{mlpack\+::metric\+::\+I\+P\+Metric}}
\subsubsection{I\+P\+Metric()\hspace{0.1cm}{\footnotesize\ttfamily [3/3]}}
{\footnotesize\ttfamily \textbf{ I\+P\+Metric} (\begin{DoxyParamCaption}\item[{const \textbf{ I\+P\+Metric}$<$ Kernel\+Type $>$ \&}]{other }\end{DoxyParamCaption})}



Copy the parameters of the given metric. 



\subsection{Member Function Documentation}
\mbox{\label{classmlpack_1_1metric_1_1IPMetric_a55e03560fb8c7923de4a43df9a265437}} 
\index{mlpack\+::metric\+::\+I\+P\+Metric@{mlpack\+::metric\+::\+I\+P\+Metric}!Evaluate@{Evaluate}}
\index{Evaluate@{Evaluate}!mlpack\+::metric\+::\+I\+P\+Metric@{mlpack\+::metric\+::\+I\+P\+Metric}}
\subsubsection{Evaluate()}
{\footnotesize\ttfamily Vec\+Type\+A\+::elem\+\_\+type Evaluate (\begin{DoxyParamCaption}\item[{const Vec\+TypeA \&}]{a,  }\item[{const Vec\+TypeB \&}]{b }\end{DoxyParamCaption})}



Evaluate the metric. 


\begin{DoxyTemplParams}{Template Parameters}
{\em Vec\+TypeA} & Type of first vector. \\
\hline
{\em Vec\+TypeB} & Type of second vector. \\
\hline
\end{DoxyTemplParams}

\begin{DoxyParams}{Parameters}
{\em a} & First vector. \\
\hline
{\em b} & Second vector. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Distance between the two points in kernel space. 
\end{DoxyReturn}
\mbox{\label{classmlpack_1_1metric_1_1IPMetric_a917492b75cc17298bc58c3d28e2944fb}} 
\index{mlpack\+::metric\+::\+I\+P\+Metric@{mlpack\+::metric\+::\+I\+P\+Metric}!Kernel@{Kernel}}
\index{Kernel@{Kernel}!mlpack\+::metric\+::\+I\+P\+Metric@{mlpack\+::metric\+::\+I\+P\+Metric}}
\subsubsection{Kernel()\hspace{0.1cm}{\footnotesize\ttfamily [1/2]}}
{\footnotesize\ttfamily const Kernel\+Type\& Kernel (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption}) const\hspace{0.3cm}{\ttfamily [inline]}}



Get the kernel. 



Definition at line 63 of file ip\+\_\+metric.\+hpp.

\mbox{\label{classmlpack_1_1metric_1_1IPMetric_ab8d1bedeac8344d80e50d819790a117a}} 
\index{mlpack\+::metric\+::\+I\+P\+Metric@{mlpack\+::metric\+::\+I\+P\+Metric}!Kernel@{Kernel}}
\index{Kernel@{Kernel}!mlpack\+::metric\+::\+I\+P\+Metric@{mlpack\+::metric\+::\+I\+P\+Metric}}
\subsubsection{Kernel()\hspace{0.1cm}{\footnotesize\ttfamily [2/2]}}
{\footnotesize\ttfamily Kernel\+Type\& Kernel (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [inline]}}



Modify the kernel. 



Definition at line 65 of file ip\+\_\+metric.\+hpp.

\mbox{\label{classmlpack_1_1metric_1_1IPMetric_af19fbcb2dbe02750f2815fb015ab52ef}} 
\index{mlpack\+::metric\+::\+I\+P\+Metric@{mlpack\+::metric\+::\+I\+P\+Metric}!operator=@{operator=}}
\index{operator=@{operator=}!mlpack\+::metric\+::\+I\+P\+Metric@{mlpack\+::metric\+::\+I\+P\+Metric}}
\subsubsection{operator=()}
{\footnotesize\ttfamily \textbf{ I\+P\+Metric}\& operator= (\begin{DoxyParamCaption}\item[{const \textbf{ I\+P\+Metric}$<$ Kernel\+Type $>$ \&}]{other }\end{DoxyParamCaption})}



Assign this metric to be a copy of the given metric. 

\mbox{\label{classmlpack_1_1metric_1_1IPMetric_a68e832cb064e3b7ca978d8e5911cf700}} 
\index{mlpack\+::metric\+::\+I\+P\+Metric@{mlpack\+::metric\+::\+I\+P\+Metric}!serialize@{serialize}}
\index{serialize@{serialize}!mlpack\+::metric\+::\+I\+P\+Metric@{mlpack\+::metric\+::\+I\+P\+Metric}}
\subsubsection{serialize()}
{\footnotesize\ttfamily void serialize (\begin{DoxyParamCaption}\item[{Archive \&}]{ar,  }\item[{const unsigned int}]{version }\end{DoxyParamCaption})}



Serialize the metric. 



Referenced by I\+P\+Metric$<$ mlpack\+::kernel\+::\+Cosine\+Distance $>$\+::\+Kernel().



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.\+0/src/mlpack/core/metrics/\textbf{ ip\+\_\+metric.\+hpp}\end{DoxyCompactItemize}
