\hypertarget{classmerger}{
\section{merger Class Reference}
\label{classmerger}\index{merger@{merger}}
}
Function for general combination of pdfs.  


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

Inheritance diagram for merger:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=89pt]{classmerger__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for merger:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[height=400pt]{classmerger__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
\hypertarget{classmerger_3f9a955329eab65026e8322e9027d469}{
\hyperlink{classmerger_3f9a955329eab65026e8322e9027d469}{merger} (const Array$<$ \hyperlink{classmpdf}{mpdf} $\ast$ $>$ \&S)}
\label{classmerger_3f9a955329eab65026e8322e9027d469}

\begin{CompactList}\small\item\em Default constructor. \item\end{CompactList}\item 
\hypertarget{classmerger_79420e251308df4502c834171d518ad9}{
void \hyperlink{classmerger_79420e251308df4502c834171d518ad9}{set\_\-parameters} (double beta0, int Ns0, int Nc0)}
\label{classmerger_79420e251308df4502c834171d518ad9}

\begin{CompactList}\small\item\em Set internal parameters used in approximation. \item\end{CompactList}\item 
\hypertarget{classmerger_02d2a445e44a87f37ee3a2b9b40cffd1}{
void \hyperlink{classmerger_02d2a445e44a87f37ee3a2b9b40cffd1}{init} ()}
\label{classmerger_02d2a445e44a87f37ee3a2b9b40cffd1}

\begin{CompactList}\small\item\em Initialize the proposal density. This function must be called before \hyperlink{classmerger_bc23accc77ec766bce7202934e2c180c}{merge()}! \item\end{CompactList}\item 
\hypertarget{classmerger_e56ad4a2bc9be2ddfc051626adf27715}{
void \hyperlink{classmerger_e56ad4a2bc9be2ddfc051626adf27715}{merge} (const \hyperlink{classepdf}{epdf} $\ast$g0)}
\label{classmerger_e56ad4a2bc9be2ddfc051626adf27715}

\begin{CompactList}\small\item\em Create a mixture density using known proposal. \item\end{CompactList}\item 
\hypertarget{classmerger_bc23accc77ec766bce7202934e2c180c}{
void \hyperlink{classmerger_bc23accc77ec766bce7202934e2c180c}{merge} ()}
\label{classmerger_bc23accc77ec766bce7202934e2c180c}

\begin{CompactList}\small\item\em Create a mixture density, make sure to call \hyperlink{classmerger_02d2a445e44a87f37ee3a2b9b40cffd1}{init()} before the first call. \item\end{CompactList}\item 
\hypertarget{classmerger_217c65f335c603033fa09a2ecc64bc05}{
vec \hyperlink{classmerger_217c65f335c603033fa09a2ecc64bc05}{lognorm\_\-merge} (mat \&lW)}
\label{classmerger_217c65f335c603033fa09a2ecc64bc05}

\begin{CompactList}\small\item\em Merge log-likelihood values. \item\end{CompactList}\item 
vec \hyperlink{classmerger_379198c3d2063bfa63f5d1245a2511ba}{sample} () const 
\item 
\hypertarget{classmerger_8c37688902b1a1e9fa32edc5709e5a00}{
double \hyperlink{classmerger_8c37688902b1a1e9fa32edc5709e5a00}{evalpdflog} (const vec \&dt) const }
\label{classmerger_8c37688902b1a1e9fa32edc5709e5a00}

\begin{CompactList}\small\item\em Compute log-probability of argument {\tt val}. \item\end{CompactList}\item 
\hypertarget{classmerger_3a46999cd77047d5d4ac6c1cb735a83e}{
vec \hyperlink{classmerger_3a46999cd77047d5d4ac6c1cb735a83e}{mean} () const }
\label{classmerger_3a46999cd77047d5d4ac6c1cb735a83e}

\begin{CompactList}\small\item\em return expected value \item\end{CompactList}\item 
\hypertarget{classmerger_51e425ee1dd46d73353526e6a1c24ca3}{
virtual \hyperlink{classmerger_51e425ee1dd46d73353526e6a1c24ca3}{$\sim$merger} ()}
\label{classmerger_51e425ee1dd46d73353526e6a1c24ca3}

\begin{CompactList}\small\item\em for future use \item\end{CompactList}\item 
\hyperlink{classRV}{RV} \hyperlink{classcompositepdf_635d219fb3e32852400d6f98aa4bdc93}{getrv} (bool checkoverlap=false)
\begin{CompactList}\small\item\em find common rv, flag \item\end{CompactList}\item 
\hypertarget{classcompositepdf_5a4479785c1fdb2cc351fbea07b899ac}{
void \hyperlink{classcompositepdf_5a4479785c1fdb2cc351fbea07b899ac}{setrvc} (const \hyperlink{classRV}{RV} \&\hyperlink{classepdf_74da992e3f5d598da8850b646b79b9d9}{rv}, \hyperlink{classRV}{RV} \&rvc)}
\label{classcompositepdf_5a4479785c1fdb2cc351fbea07b899ac}

\begin{CompactList}\small\item\em common rvc of all mpdfs is written to rvc \item\end{CompactList}\item 
\hypertarget{classcompositepdf_08958c8f76d65de94ecc37b8d90bc77a}{
void \hyperlink{classcompositepdf_08958c8f76d65de94ecc37b8d90bc77a}{setindices} (const \hyperlink{classRV}{RV} \&\hyperlink{classepdf_74da992e3f5d598da8850b646b79b9d9}{rv})}
\label{classcompositepdf_08958c8f76d65de94ecc37b8d90bc77a}

\begin{CompactList}\small\item\em fill all rv$\ast$inrv$\ast$ according to \item\end{CompactList}\item 
\hypertarget{classcompositepdf_3bd4ada95f381ea6c4cff2dc86e957c4}{
void \hyperlink{classcompositepdf_3bd4ada95f381ea6c4cff2dc86e957c4}{setrvcinrv} (const \hyperlink{classRV}{RV} \&rvc, Array$<$ ivec $>$ \&rvcind)}
\label{classcompositepdf_3bd4ada95f381ea6c4cff2dc86e957c4}

\begin{CompactList}\small\item\em Function fills Array by indeces of mpdfs inside given rv. \item\end{CompactList}\item 
\hypertarget{classepdf_54d7dd53a641b618771cd9bee135181f}{
virtual mat \hyperlink{classepdf_54d7dd53a641b618771cd9bee135181f}{sampleN} (int N) const }
\label{classepdf_54d7dd53a641b618771cd9bee135181f}

\begin{CompactList}\small\item\em Returns N samples from density $epdf(rv)$. \item\end{CompactList}\item 
\hypertarget{classepdf_3ea597362e11a0040fe7c990269d072c}{
virtual double \hyperlink{classepdf_3ea597362e11a0040fe7c990269d072c}{eval} (const vec \&val) const }
\label{classepdf_3ea597362e11a0040fe7c990269d072c}

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

\begin{CompactList}\small\item\em Compute log-probability of multiple values argument {\tt val}. \item\end{CompactList}\item 
\hypertarget{classepdf_3ba08c0e788deff22134c049b9269666}{
\hyperlink{classmpdf}{mpdf} $\ast$ \hyperlink{classepdf_3ba08c0e788deff22134c049b9269666}{condition} (const \hyperlink{classRV}{RV} \&\hyperlink{classepdf_74da992e3f5d598da8850b646b79b9d9}{rv})}
\label{classepdf_3ba08c0e788deff22134c049b9269666}

\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{classepdf_bc0c171b6dafacd78d26263913b1d0c0}{
\hyperlink{classepdf}{epdf} $\ast$ \hyperlink{classepdf_bc0c171b6dafacd78d26263913b1d0c0}{marginal} (const \hyperlink{classRV}{RV} \&\hyperlink{classepdf_74da992e3f5d598da8850b646b79b9d9}{rv})}
\label{classepdf_bc0c171b6dafacd78d26263913b1d0c0}

\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{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{classmerger_021d1522cea70db8545d708afd32ec2f}{
\hyperlink{classMixEF}{MixEF} \hyperlink{classmerger_021d1522cea70db8545d708afd32ec2f}{Mix}}
\label{classmerger_021d1522cea70db8545d708afd32ec2f}

\begin{CompactList}\small\item\em Internal mixture of EF models. \item\end{CompactList}\item 
\hypertarget{classmerger_ce84de1824875b4262eefb640e8c6d69}{
int \hyperlink{classmerger_ce84de1824875b4262eefb640e8c6d69}{Ns}}
\label{classmerger_ce84de1824875b4262eefb640e8c6d69}

\begin{CompactList}\small\item\em Number of samples used in approximation. \item\end{CompactList}\item 
\hypertarget{classmerger_6acf33e1c64aaaee20689725e8110f65}{
int \hyperlink{classmerger_6acf33e1c64aaaee20689725e8110f65}{Nc}}
\label{classmerger_6acf33e1c64aaaee20689725e8110f65}

\begin{CompactList}\small\item\em Number of components in a mixture. \item\end{CompactList}\item 
\hypertarget{classmerger_e68a72e2740007ae68545e378c7701ad}{
double \hyperlink{classmerger_e68a72e2740007ae68545e378c7701ad}{beta}}
\label{classmerger_e68a72e2740007ae68545e378c7701ad}

\begin{CompactList}\small\item\em Prior on the log-normal merging model. \item\end{CompactList}\item 
\hypertarget{classcompositepdf_c1646fe41ff5934d010e54ccaa46133f}{
int \hyperlink{classcompositepdf_c1646fe41ff5934d010e54ccaa46133f}{n}}
\label{classcompositepdf_c1646fe41ff5934d010e54ccaa46133f}

\begin{CompactList}\small\item\em Number of mpdfs in the composite. \item\end{CompactList}\item 
\hypertarget{classcompositepdf_637877061b917a16a0421bb5c4cd480d}{
Array$<$ \hyperlink{classmpdf}{mpdf} $\ast$ $>$ \hyperlink{classcompositepdf_637877061b917a16a0421bb5c4cd480d}{mpdfs}}
\label{classcompositepdf_637877061b917a16a0421bb5c4cd480d}

\begin{CompactList}\small\item\em Elements of composition. \item\end{CompactList}\item 
\hypertarget{classcompositepdf_4d4a8269f9faefeca8cdc251a5a29a7f}{
Array$<$ ivec $>$ \hyperlink{classcompositepdf_4d4a8269f9faefeca8cdc251a5a29a7f}{rvsinrv}}
\label{classcompositepdf_4d4a8269f9faefeca8cdc251a5a29a7f}

\begin{CompactList}\small\item\em Indeces of rvs in common rv. \item\end{CompactList}\item 
\hypertarget{classcompositepdf_3df07bb5e3ed36a3119b145043296676}{
Array$<$ ivec $>$ \hyperlink{classcompositepdf_3df07bb5e3ed36a3119b145043296676}{rvcsinrv}}
\label{classcompositepdf_3df07bb5e3ed36a3119b145043296676}

\begin{CompactList}\small\item\em Indeces of rvc in common rv. \item\end{CompactList}\item 
\hypertarget{classcompositepdf_de3bd289a26d5549dcf1ed19e5b13569}{
Array$<$ ivec $>$ \hyperlink{classcompositepdf_de3bd289a26d5549dcf1ed19e5b13569}{rvinrvcs}}
\label{classcompositepdf_de3bd289a26d5549dcf1ed19e5b13569}

\begin{CompactList}\small\item\em Indeces of common rv in rvc. \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}
Function for general combination of pdfs. 

Mixtures of Gaussian densities are used internally. Switching to other densities should be trivial. 

\subsection{Member Function Documentation}
\hypertarget{classmerger_379198c3d2063bfa63f5d1245a2511ba}{
\index{merger@{merger}!sample@{sample}}
\index{sample@{sample}!merger@{merger}}
\subsubsection[sample]{\setlength{\rightskip}{0pt plus 5cm}vec merger::sample () const\hspace{0.3cm}{\tt  \mbox{[}inline, virtual\mbox{]}}}}
\label{classmerger_379198c3d2063bfa63f5d1245a2511ba}


sample from merged density weight w is a 

Implements \hyperlink{classepdf_8019654e494bf5e458f6fb947e11b262}{epdf}.

References MixEF::\_\-epdf(), Mix, and epdf::sample().\hypertarget{classcompositepdf_635d219fb3e32852400d6f98aa4bdc93}{
\index{merger@{merger}!getrv@{getrv}}
\index{getrv@{getrv}!merger@{merger}}
\subsubsection[getrv]{\setlength{\rightskip}{0pt plus 5cm}{\bf RV} compositepdf::getrv (bool {\em checkoverlap} = {\tt false})\hspace{0.3cm}{\tt  \mbox{[}inherited\mbox{]}}}}
\label{classcompositepdf_635d219fb3e32852400d6f98aa4bdc93}


find common rv, flag 

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em checkoverlap}]modifies whether overlaps are acceptable \end{description}
\end{Desc}


References RV::add(), compositepdf::mpdfs, and compositepdf::n.

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