\hypertarget{classemix}{
\section{emix Class Reference}
\label{classemix}\index{emix@{emix}}
}
Mixture of epdfs.  


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

Inheritance diagram for emix:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=40pt]{classemix__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for emix:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=40pt]{classemix__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
\hypertarget{classemix_62194619791d5f1da88cad01cfc9339d}{
\hyperlink{classemix_62194619791d5f1da88cad01cfc9339d}{emix} (const \hyperlink{classRV}{RV} \&\hyperlink{classepdf_74da992e3f5d598da8850b646b79b9d9}{rv})}
\label{classemix_62194619791d5f1da88cad01cfc9339d}

\begin{CompactList}\small\item\em Default constructor. \item\end{CompactList}\item 
void \hyperlink{classemix_d3789d50a3327a6de552db077af5e4c5}{set\_\-parameters} (const vec \&\hyperlink{classemix_cdc8f4e2a5e43595ac5450d8a7f9d1ab}{w}, const Array$<$ \hyperlink{classepdf}{epdf} $\ast$ $>$ \&\hyperlink{classemix_7155d827417b53fb6aa5cff1459e6eb4}{Coms}, bool copy=true)
\item 
\hypertarget{classemix_0650601f24e633e0ab09aa1e46c14483}{
vec \hyperlink{classemix_0650601f24e633e0ab09aa1e46c14483}{sample} () const }
\label{classemix_0650601f24e633e0ab09aa1e46c14483}

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

\begin{CompactList}\small\item\em return expected value \item\end{CompactList}\item 
\hypertarget{classemix_469e910479b3402589104ef3bb1b5741}{
double \hyperlink{classemix_469e910479b3402589104ef3bb1b5741}{evalpdflog} (const vec \&val) const }
\label{classemix_469e910479b3402589104ef3bb1b5741}

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

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

\item 
\hypertarget{classemix_33afde698093d458ce71875f7ee7384a}{
\hyperlink{classemix}{emix} $\ast$ \hyperlink{classemix_33afde698093d458ce71875f7ee7384a}{marginal} (const \hyperlink{classRV}{RV} \&\hyperlink{classepdf_74da992e3f5d598da8850b646b79b9d9}{rv}) const }
\label{classemix_33afde698093d458ce71875f7ee7384a}

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

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

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

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

\begin{CompactList}\small\item\em access function \item\end{CompactList}\item 
\hypertarget{classepdf_76608914c3b19e150292d5c56e93e508}{
virtual mat \hyperlink{classepdf_76608914c3b19e150292d5c56e93e508}{sample\_\-m} (int N) const }
\label{classepdf_76608914c3b19e150292d5c56e93e508}

\begin{CompactList}\small\item\em Returns N samples from density $epdf(rv)$. \item\end{CompactList}\item 
\hypertarget{classepdf_ca0d32aabb4cbba347e0c37fe8607562}{
const \hyperlink{classRV}{RV} \& \hyperlink{classepdf_ca0d32aabb4cbba347e0c37fe8607562}{\_\-rv} () const }
\label{classepdf_ca0d32aabb4cbba347e0c37fe8607562}

\begin{CompactList}\small\item\em access function, possibly dangerous! \item\end{CompactList}\item 
\hypertarget{classepdf_7fb94ce90d1ac7077d29f7d6a6c3e0a5}{
void \hyperlink{classepdf_7fb94ce90d1ac7077d29f7d6a6c3e0a5}{\_\-renewrv} (const \hyperlink{classRV}{RV} \&in\_\-rv)}
\label{classepdf_7fb94ce90d1ac7077d29f7d6a6c3e0a5}

\begin{CompactList}\small\item\em modifier function - useful when copying epdfs \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Attributes}
\begin{CompactItemize}
\item 
\hypertarget{classemix_cdc8f4e2a5e43595ac5450d8a7f9d1ab}{
vec \hyperlink{classemix_cdc8f4e2a5e43595ac5450d8a7f9d1ab}{w}}
\label{classemix_cdc8f4e2a5e43595ac5450d8a7f9d1ab}

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

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

\begin{CompactList}\small\item\em Flag if owning Coms. \item\end{CompactList}\item 
\hypertarget{classepdf_74da992e3f5d598da8850b646b79b9d9}{
\hyperlink{classRV}{RV} \hyperlink{classepdf_74da992e3f5d598da8850b646b79b9d9}{rv}}
\label{classepdf_74da992e3f5d598da8850b646b79b9d9}

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


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


Set weights {\tt w} and components {\tt Coms} By default Coms are copied inside. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em copy}]can be set to false if Coms live externally. Use method \hyperlink{classemix_4d7baeb2a9e3fca1d8fd32a107df291d}{ownComs()} if Coms should be destroyed by the destructor. \end{description}
\end{Desc}


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

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

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