\hypertarget{classmratio}{
\section{mratio Class Reference}
\label{classmratio}\index{mratio@{mratio}}
}
Class representing ratio of two densities which arise e.g. by applying the Bayes rule. It represents density in the form: \[ f(rv|rvc) = \frac{f(rv,rvc)}{f(rvc)} \] where $ f(rvc) = \int f(rv,rvc) d\ rv $.  


{\tt \#include $<$emix.h$>$}

Inheritance diagram for mratio:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=46pt]{classmratio__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for mratio:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=120pt]{classmratio__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
\hyperlink{classmratio_c2452f4fc3046cfe8f2453deb343b3ac}{mratio} (const \hyperlink{classepdf}{epdf} $\ast$nom0, const \hyperlink{classRV}{RV} \&\hyperlink{classmpdf_f6687c07ff07d47812dd565368ca59eb}{rv}, bool copy=false)
\item 
\hypertarget{classmratio_9fb0df09a2e975e8b9f7ce41ecd65a09}{
double \hyperlink{classmratio_9fb0df09a2e975e8b9f7ce41ecd65a09}{evallogcond} (const vec \&val, const vec \&cond)}
\label{classmratio_9fb0df09a2e975e8b9f7ce41ecd65a09}

\begin{CompactList}\small\item\em Shortcut for conditioning and evaluation of the internal \hyperlink{classepdf}{epdf}. In some cases, this operation can be implemented efficiently. \item\end{CompactList}\item 
\hypertarget{classmratio_41d6d8f4245f67c732299ba7167aacb9}{
void \hyperlink{classmratio_41d6d8f4245f67c732299ba7167aacb9}{ownnom} ()}
\label{classmratio_41d6d8f4245f67c732299ba7167aacb9}

\begin{CompactList}\small\item\em Object takes ownership of nom and will destroy it. \item\end{CompactList}\item 
\hypertarget{classmratio_e62904f18041e73228d8db671e517280}{
\hyperlink{classmratio_e62904f18041e73228d8db671e517280}{$\sim$mratio} ()}
\label{classmratio_e62904f18041e73228d8db671e517280}

\begin{CompactList}\small\item\em Default destructor. \item\end{CompactList}\item 
virtual vec \hyperlink{classmpdf_3f172b79ec4a5ebc87898a5381141f1b}{samplecond} (const vec \&cond, double \&ll)
\begin{CompactList}\small\item\em Returns a sample from the density conditioned on {\tt cond}, $x \sim epdf(rv|cond)$. \item\end{CompactList}\item 
virtual mat \hyperlink{classmpdf_b1dae6171ee39a6a05976c7b1007a3c5}{samplecond\_\-m} (const vec \&cond, vec \&ll, int N)
\begin{CompactList}\small\item\em Returns. \item\end{CompactList}\item 
\hypertarget{classmpdf_0f95a0cc6ab40611f46804682446ed83}{
virtual void \hyperlink{classmpdf_0f95a0cc6ab40611f46804682446ed83}{condition} (const vec \&cond)}
\label{classmpdf_0f95a0cc6ab40611f46804682446ed83}

\begin{CompactList}\small\item\em Update {\tt ep} so that it represents this \hyperlink{classmpdf}{mpdf} conditioned on {\tt rvc} = cond. \item\end{CompactList}\item 
\hypertarget{classmpdf_95fcff214848f66f1b489459370573fa}{
virtual vec \hyperlink{classmpdf_95fcff214848f66f1b489459370573fa}{evallogcond\_\-m} (const mat \&Dt, const vec \&cond)}
\label{classmpdf_95fcff214848f66f1b489459370573fa}

\begin{CompactList}\small\item\em Matrix version of evallogcond. \item\end{CompactList}\item 
\hypertarget{classmpdf_15ef062183b1ccdf794732d5fa0b77cd}{
\hyperlink{classRV}{RV} \hyperlink{classmpdf_15ef062183b1ccdf794732d5fa0b77cd}{\_\-rvc} () const }
\label{classmpdf_15ef062183b1ccdf794732d5fa0b77cd}

\begin{CompactList}\small\item\em access function \item\end{CompactList}\item 
\hypertarget{classmpdf_71256ffb5fbd08f41d650e606a5bd585}{
\hyperlink{classRV}{RV} \hyperlink{classmpdf_71256ffb5fbd08f41d650e606a5bd585}{\_\-rv} () const }
\label{classmpdf_71256ffb5fbd08f41d650e606a5bd585}

\begin{CompactList}\small\item\em access function \item\end{CompactList}\item 
\hypertarget{classmpdf_e17780ee5b2cfe05922a6c56af1462f8}{
\hyperlink{classepdf}{epdf} \& \hyperlink{classmpdf_e17780ee5b2cfe05922a6c56af1462f8}{\_\-epdf} ()}
\label{classmpdf_e17780ee5b2cfe05922a6c56af1462f8}

\begin{CompactList}\small\item\em access function \item\end{CompactList}\item 
\hypertarget{classmpdf_75ded3b0f657cd7da6590691a810963c}{
\hyperlink{classepdf}{epdf} $\ast$ \hyperlink{classmpdf_75ded3b0f657cd7da6590691a810963c}{\_\-e} ()}
\label{classmpdf_75ded3b0f657cd7da6590691a810963c}

\begin{CompactList}\small\item\em access function \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
\hypertarget{classmratio_8a3e60f5a532237e4450cd06039a28db}{
const \hyperlink{classepdf}{epdf} $\ast$ \hyperlink{classmratio_8a3e60f5a532237e4450cd06039a28db}{nom}}
\label{classmratio_8a3e60f5a532237e4450cd06039a28db}

\begin{CompactList}\small\item\em Nominator in the form of \hyperlink{classmpdf}{mpdf}. \item\end{CompactList}\item 
\hypertarget{classmratio_d34916f6403460fbcac71902f32aa791}{
\hyperlink{classepdf}{epdf} $\ast$ \hyperlink{classmratio_d34916f6403460fbcac71902f32aa791}{den}}
\label{classmratio_d34916f6403460fbcac71902f32aa791}

\begin{CompactList}\small\item\em Denominator in the form of \hyperlink{classepdf}{epdf}. \item\end{CompactList}\item 
\hypertarget{classmratio_f8ea9dd72239dc24b1d83ae034424285}{
bool \hyperlink{classmratio_f8ea9dd72239dc24b1d83ae034424285}{destroynom}}
\label{classmratio_f8ea9dd72239dc24b1d83ae034424285}

\begin{CompactList}\small\item\em flag for destructor \item\end{CompactList}\item 
\hypertarget{classmratio_aa50f2cca2b959391f449241ef89012d}{
\hyperlink{classdatalink__m2e}{datalink\_\-m2e} \hyperlink{classmratio_aa50f2cca2b959391f449241ef89012d}{dl}}
\label{classmratio_aa50f2cca2b959391f449241ef89012d}

\begin{CompactList}\small\item\em datalink between conditional and nom \item\end{CompactList}\item 
\hypertarget{classmpdf_f6687c07ff07d47812dd565368ca59eb}{
\hyperlink{classRV}{RV} \hyperlink{classmpdf_f6687c07ff07d47812dd565368ca59eb}{rv}}
\label{classmpdf_f6687c07ff07d47812dd565368ca59eb}

\begin{CompactList}\small\item\em modeled random variable \item\end{CompactList}\item 
\hypertarget{classmpdf_acb7dda792b3cd5576f39fa3129abbab}{
\hyperlink{classRV}{RV} \hyperlink{classmpdf_acb7dda792b3cd5576f39fa3129abbab}{rvc}}
\label{classmpdf_acb7dda792b3cd5576f39fa3129abbab}

\begin{CompactList}\small\item\em random variable in condition \item\end{CompactList}\item 
\hypertarget{classmpdf_7aa894208a32f3487827df6d5054424c}{
\hyperlink{classepdf}{epdf} $\ast$ \hyperlink{classmpdf_7aa894208a32f3487827df6d5054424c}{ep}}
\label{classmpdf_7aa894208a32f3487827df6d5054424c}

\begin{CompactList}\small\item\em pointer to internal \hyperlink{classepdf}{epdf} \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Class representing ratio of two densities which arise e.g. by applying the Bayes rule. It represents density in the form: \[ f(rv|rvc) = \frac{f(rv,rvc)}{f(rvc)} \] where $ f(rvc) = \int f(rv,rvc) d\ rv $. 

In particular this type of arise by conditioning of a mixture model.

At present the only supported operation is \hyperlink{classmratio_9fb0df09a2e975e8b9f7ce41ecd65a09}{evallogcond()}. 

\subsection{Constructor \& Destructor Documentation}
\hypertarget{classmratio_c2452f4fc3046cfe8f2453deb343b3ac}{
\index{mratio@{mratio}!mratio@{mratio}}
\index{mratio@{mratio}!mratio@{mratio}}
\subsubsection[mratio]{\setlength{\rightskip}{0pt plus 5cm}mratio::mratio (const {\bf epdf} $\ast$ {\em nom0}, \/  const {\bf RV} \& {\em rv}, \/  bool {\em copy} = {\tt false})\hspace{0.3cm}{\tt  \mbox{[}inline\mbox{]}}}}
\label{classmratio_c2452f4fc3046cfe8f2453deb343b3ac}


Default constructor. By default, the given \hyperlink{classepdf}{epdf} is not copied! It is assumed that this function will be used only temporarily. 

References den, destroynom, RV::length(), epdf::marginal(), nom, and mpdf::rvc.

\subsection{Member Function Documentation}
\hypertarget{classmpdf_3f172b79ec4a5ebc87898a5381141f1b}{
\index{mratio@{mratio}!samplecond@{samplecond}}
\index{samplecond@{samplecond}!mratio@{mratio}}
\subsubsection[samplecond]{\setlength{\rightskip}{0pt plus 5cm}virtual vec mpdf::samplecond (const vec \& {\em cond}, \/  double \& {\em ll})\hspace{0.3cm}{\tt  \mbox{[}inline, virtual, inherited\mbox{]}}}}
\label{classmpdf_3f172b79ec4a5ebc87898a5381141f1b}


Returns a sample from the density conditioned on {\tt cond}, $x \sim epdf(rv|cond)$. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em cond}]is numeric value of {\tt rv} \item[{\em ll}]is a return value of log-likelihood of the sample. \end{description}
\end{Desc}


Reimplemented in \hyperlink{classmprod_a48887eb8738a9e5550bfc38eb8e9d68}{mprod}.

References mpdf::condition(), mpdf::ep, epdf::evallog(), and epdf::sample().

Referenced by MPF$<$ BM\_\-T $>$::bayes(), and PF::bayes().\hypertarget{classmpdf_b1dae6171ee39a6a05976c7b1007a3c5}{
\index{mratio@{mratio}!samplecond\_\-m@{samplecond\_\-m}}
\index{samplecond\_\-m@{samplecond\_\-m}!mratio@{mratio}}
\subsubsection[samplecond\_\-m]{\setlength{\rightskip}{0pt plus 5cm}virtual mat mpdf::samplecond\_\-m (const vec \& {\em cond}, \/  vec \& {\em ll}, \/  int {\em N})\hspace{0.3cm}{\tt  \mbox{[}inline, virtual, inherited\mbox{]}}}}
\label{classmpdf_b1dae6171ee39a6a05976c7b1007a3c5}


Returns. 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em N}]samples from the density conditioned on {\tt cond}, $x \sim epdf(rv|cond)$. \item[{\em cond}]is numeric value of {\tt rv} \item[{\em ll}]is a return value of log-likelihood of the sample. \end{description}
\end{Desc}


References mpdf::condition(), RV::count(), mpdf::ep, epdf::evallog(), mpdf::rv, and epdf::sample().

The documentation for this class was generated from the following file:\begin{CompactItemize}
\item 
work/git/mixpp/bdm/stat/\hyperlink{emix_8h}{emix.h}\end{CompactItemize}
