\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 
\hypertarget{classcompositepdf_635d219fb3e32852400d6f98aa4bdc93}{
\hyperlink{classRV}{RV} \textbf{getrv} (bool checkoverlap=false)}
\label{classcompositepdf_635d219fb3e32852400d6f98aa4bdc93}

\item 
\hypertarget{classcompositepdf_5a4479785c1fdb2cc351fbea07b899ac}{
void \textbf{setrvc} (const \hyperlink{classRV}{RV} \&\hyperlink{classepdf_74da992e3f5d598da8850b646b79b9d9}{rv}, \hyperlink{classRV}{RV} \&rvc)}
\label{classcompositepdf_5a4479785c1fdb2cc351fbea07b899ac}

\item 
\hypertarget{classcompositepdf_08958c8f76d65de94ecc37b8d90bc77a}{
void \textbf{setindices} (const \hyperlink{classRV}{RV} \&\hyperlink{classepdf_74da992e3f5d598da8850b646b79b9d9}{rv})}
\label{classcompositepdf_08958c8f76d65de94ecc37b8d90bc77a}

\item 
\hypertarget{classcompositepdf_3bd4ada95f381ea6c4cff2dc86e957c4}{
void \textbf{setrvcinrv} (const \hyperlink{classRV}{RV} \&rvc, Array$<$ ivec $>$ \&rvcind)}
\label{classcompositepdf_3bd4ada95f381ea6c4cff2dc86e957c4}

\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_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{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().

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}
