\hypertarget{classbdm_1_1emix}{
\section{bdm::emix Class Reference}
\label{classbdm_1_1emix}\index{bdm::emix@{bdm::emix}}
}
{\tt \#include $<$emix.h$>$}

Inheritance diagram for bdm::emix:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=64pt]{classbdm_1_1emix__inherit__graph}
\end{center}
\end{figure}


\subsection{Detailed Description}
Mixture of epdfs. 

Density function: \[ f(x) = \sum_{i=1}^{n} w_{i} f_i(x), \quad \sum_{i=1}^n w_i = 1. \] where $f_i(x)$ is any density on random variable $x$, called {\em component\/}, \subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
\hypertarget{classbdm_1_1emix_4838f3a376ee0bd3c658bfb8f4ea4a3d}{
\hyperlink{classbdm_1_1emix_4838f3a376ee0bd3c658bfb8f4ea4a3d}{emix} ()}
\label{classbdm_1_1emix_4838f3a376ee0bd3c658bfb8f4ea4a3d}

\begin{CompactList}\small\item\em Default constructor. \item\end{CompactList}\item 
void \hyperlink{classbdm_1_1emix_d8c1aefba8302759836b5f26999ce840}{set\_\-parameters} (const vec \&\hyperlink{classbdm_1_1emix_bb7270345c76da627cd77ddf020bcf46}{w}, const Array$<$ \hyperlink{classbdm_1_1epdf}{epdf} $\ast$ $>$ \&\hyperlink{classbdm_1_1emix_e2966a6a44b250e22e55bc9fb6af5c3e}{Coms}, bool copy=true)
\item 
\hypertarget{classbdm_1_1emix_e8839dbbb0d1276a8dbe957a67cfe0dc}{
vec \hyperlink{classbdm_1_1emix_e8839dbbb0d1276a8dbe957a67cfe0dc}{sample} () const }
\label{classbdm_1_1emix_e8839dbbb0d1276a8dbe957a67cfe0dc}

\begin{CompactList}\small\item\em Returns a sample, $ x $ from density $ f_x()$. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1emix_a3a5390bc56e81ef3b0debc0f185fa8a}{
vec \hyperlink{classbdm_1_1emix_a3a5390bc56e81ef3b0debc0f185fa8a}{mean} () const }
\label{classbdm_1_1emix_a3a5390bc56e81ef3b0debc0f185fa8a}

\begin{CompactList}\small\item\em return expected value \item\end{CompactList}\item 
\hypertarget{classbdm_1_1emix_e9a627023cdf90c9ffd8eef726595c86}{
vec \hyperlink{classbdm_1_1emix_e9a627023cdf90c9ffd8eef726595c86}{variance} () const }
\label{classbdm_1_1emix_e9a627023cdf90c9ffd8eef726595c86}

\begin{CompactList}\small\item\em return expected variance (not covariance!) \item\end{CompactList}\item 
\hypertarget{classbdm_1_1emix_0f3db99f730bde6b7953931594537e8e}{
double \hyperlink{classbdm_1_1emix_0f3db99f730bde6b7953931594537e8e}{evallog} (const vec \&val) const }
\label{classbdm_1_1emix_0f3db99f730bde6b7953931594537e8e}

\begin{CompactList}\small\item\em Compute log-probability of argument {\tt val}. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1emix_23af1986e2afcbc8c7e1c30f610e703b}{
vec \hyperlink{classbdm_1_1emix_23af1986e2afcbc8c7e1c30f610e703b}{evallog\_\-m} (const mat \&Val) const }
\label{classbdm_1_1emix_23af1986e2afcbc8c7e1c30f610e703b}

\begin{CompactList}\small\item\em Compute log-probability of multiple values argument {\tt val}. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1emix_e64c1d5a73f541e469792e23d4677af2}{
mat \hyperlink{classbdm_1_1emix_e64c1d5a73f541e469792e23d4677af2}{evallog\_\-M} (const mat \&Val) const }
\label{classbdm_1_1emix_e64c1d5a73f541e469792e23d4677af2}

\begin{CompactList}\small\item\em Auxiliary function that returns pdflog for each component. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1emix_f7165371cc4f7be9292024b9f5431646}{
\hyperlink{classbdm_1_1emix}{emix} $\ast$ \hyperlink{classbdm_1_1emix_f7165371cc4f7be9292024b9f5431646}{marginal} (const \hyperlink{classbdm_1_1RV}{RV} \&\hyperlink{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}{rv}) const }
\label{classbdm_1_1emix_f7165371cc4f7be9292024b9f5431646}

\begin{CompactList}\small\item\em Return marginal density on the given \hyperlink{classbdm_1_1RV}{RV}, the remainig rvs are intergrated out. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1emix_fc7772a2972959cf19ba26882feacecf}{
\hyperlink{classbdm_1_1mratio}{mratio} $\ast$ \hyperlink{classbdm_1_1emix_fc7772a2972959cf19ba26882feacecf}{condition} (const \hyperlink{classbdm_1_1RV}{RV} \&\hyperlink{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}{rv}) const }
\label{classbdm_1_1emix_fc7772a2972959cf19ba26882feacecf}

\begin{CompactList}\small\item\em Return conditional density on the given \hyperlink{classbdm_1_1RV}{RV}, the remaining rvs will be in conditioning. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1emix_d9b584cb5b2471a4250fb127757f28be}{
vec \& \hyperlink{classbdm_1_1emix_d9b584cb5b2471a4250fb127757f28be}{\_\-w} ()}
\label{classbdm_1_1emix_d9b584cb5b2471a4250fb127757f28be}

\begin{CompactList}\small\item\em returns a pointer to the internal mean value. Use with Care! \item\end{CompactList}\item 
\hypertarget{classbdm_1_1emix_965fb16669250a3d28bc62cf76276d8e}{
void \hyperlink{classbdm_1_1emix_965fb16669250a3d28bc62cf76276d8e}{ownComs} ()}
\label{classbdm_1_1emix_965fb16669250a3d28bc62cf76276d8e}

\begin{CompactList}\small\item\em Auxiliary function for taking ownership of the \hyperlink{classbdm_1_1emix_e2966a6a44b250e22e55bc9fb6af5c3e}{Coms()}. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1emix_578616445243674438257be99ba71612}{
\hyperlink{classbdm_1_1epdf}{epdf} $\ast$ \hyperlink{classbdm_1_1emix_578616445243674438257be99ba71612}{\_\-Coms} (int i)}
\label{classbdm_1_1emix_578616445243674438257be99ba71612}

\begin{CompactList}\small\item\em access function \item\end{CompactList}\end{CompactItemize}
\begin{Indent}{\bf Matematical Operations}\par
\begin{CompactItemize}
\item 
\hypertarget{classbdm_1_1epdf_b4cf45fd83cc7573ede9fe1215256058}{
virtual mat \hyperlink{classbdm_1_1epdf_b4cf45fd83cc7573ede9fe1215256058}{sample\_\-m} (int N) const }
\label{classbdm_1_1epdf_b4cf45fd83cc7573ede9fe1215256058}

\begin{CompactList}\small\item\em Returns N samples, $ [x_1 , x_2 , \ldots \ $ from density $ f_x(rv)$. \item\end{CompactList}\end{CompactItemize}
\end{Indent}
\begin{Indent}{\bf Connection to other classes}\par
{\em Description of the random quantity via attribute {\tt rv} is optional. For operations such as sampling {\tt rv} does not need to be set. However, for {\tt marginalization} and {\tt conditioning} {\tt rv} has to be set. NB: }\begin{CompactItemize}
\item 
\hypertarget{classbdm_1_1epdf_f423e28448dbb69ef4905295ec8de8ff}{
void \hyperlink{classbdm_1_1epdf_f423e28448dbb69ef4905295ec8de8ff}{set\_\-rv} (const \hyperlink{classbdm_1_1RV}{RV} \&rv0)}
\label{classbdm_1_1epdf_f423e28448dbb69ef4905295ec8de8ff}

\begin{CompactList}\small\item\em Name its rv. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1epdf_c4b863ff84c7a4882fb3ad18556027f9}{
bool \hyperlink{classbdm_1_1epdf_c4b863ff84c7a4882fb3ad18556027f9}{isnamed} () const }
\label{classbdm_1_1epdf_c4b863ff84c7a4882fb3ad18556027f9}

\begin{CompactList}\small\item\em True if rv is assigned. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1epdf_a4ab378d5e004c3ff3e2d4e64f7bba21}{
const \hyperlink{classbdm_1_1RV}{RV} \& \hyperlink{classbdm_1_1epdf_a4ab378d5e004c3ff3e2d4e64f7bba21}{\_\-rv} () const }
\label{classbdm_1_1epdf_a4ab378d5e004c3ff3e2d4e64f7bba21}

\begin{CompactList}\small\item\em Return name (fails when isnamed is false). \item\end{CompactList}\end{CompactItemize}
\end{Indent}
\begin{Indent}{\bf Access to attributes}\par
\begin{CompactItemize}
\item 
\hypertarget{classbdm_1_1epdf_46dfe100cd621716ee5c7ee25a20f24b}{
bool \hyperlink{classbdm_1_1epdf_46dfe100cd621716ee5c7ee25a20f24b}{dimension} () const }
\label{classbdm_1_1epdf_46dfe100cd621716ee5c7ee25a20f24b}

\begin{CompactList}\small\item\em Size of the random variable. \item\end{CompactList}\end{CompactItemize}
\end{Indent}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
\hypertarget{classbdm_1_1emix_bb7270345c76da627cd77ddf020bcf46}{
vec \hyperlink{classbdm_1_1emix_bb7270345c76da627cd77ddf020bcf46}{w}}
\label{classbdm_1_1emix_bb7270345c76da627cd77ddf020bcf46}

\begin{CompactList}\small\item\em weights of the components \item\end{CompactList}\item 
\hypertarget{classbdm_1_1emix_e2966a6a44b250e22e55bc9fb6af5c3e}{
Array$<$ \hyperlink{classbdm_1_1epdf}{epdf} $\ast$ $>$ \hyperlink{classbdm_1_1emix_e2966a6a44b250e22e55bc9fb6af5c3e}{Coms}}
\label{classbdm_1_1emix_e2966a6a44b250e22e55bc9fb6af5c3e}

\begin{CompactList}\small\item\em Component (epdfs). \item\end{CompactList}\item 
\hypertarget{classbdm_1_1emix_47189df41a4616c2fed5972f015743f4}{
bool \hyperlink{classbdm_1_1emix_47189df41a4616c2fed5972f015743f4}{destroyComs}}
\label{classbdm_1_1emix_47189df41a4616c2fed5972f015743f4}

\begin{CompactList}\small\item\em Flag if owning Coms. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1epdf_16adac20ec7fe07e1ea0b27d917788ce}{
int \hyperlink{classbdm_1_1epdf_16adac20ec7fe07e1ea0b27d917788ce}{dim}}
\label{classbdm_1_1epdf_16adac20ec7fe07e1ea0b27d917788ce}

\begin{CompactList}\small\item\em dimension of the random variable \item\end{CompactList}\item 
\hypertarget{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}{
\hyperlink{classbdm_1_1RV}{RV} \hyperlink{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}{rv}}
\label{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}

\begin{CompactList}\small\item\em Description of the random variable. \item\end{CompactList}\end{CompactItemize}


\subsection{Member Function Documentation}
\hypertarget{classbdm_1_1emix_d8c1aefba8302759836b5f26999ce840}{
\index{bdm::emix@{bdm::emix}!set\_\-parameters@{set\_\-parameters}}
\index{set\_\-parameters@{set\_\-parameters}!bdm::emix@{bdm::emix}}
\subsubsection[set\_\-parameters]{\setlength{\rightskip}{0pt plus 5cm}void bdm::emix::set\_\-parameters (const vec \& {\em w}, \/  const Array$<$ {\bf epdf} $\ast$ $>$ \& {\em Coms}, \/  bool {\em copy} = {\tt true})}}
\label{classbdm_1_1emix_d8c1aefba8302759836b5f26999ce840}


Set weights {\tt w} and components {\tt Coms} By default Coms are copied inside. Parameter {\tt copy} can be set to false if Coms live externally. Use method \hyperlink{classbdm_1_1emix_965fb16669250a3d28bc62cf76276d8e}{ownComs()} if Coms should be destroyed by the destructor. 

References bdm::epdf::\_\-rv(), Coms, destroyComs, bdm::epdf::dim, bdm::RV::equal(), bdm::epdf::rv, and w.

Referenced by bdm::MixEF::epredictor(), marginal(), and bdm::mmix::set\_\-parameters().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
\hyperlink{emix_8h}{emix.h}\item 
emix.cpp\end{CompactItemize}
