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

Inheritance diagram for bdm::merger:\nopagebreak
\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=122pt]{classbdm_1_1merger__inherit__graph}
\end{center}
\end{figure}


\subsection{Detailed Description}
Function for general combination of pdfs. 

Mixtures of Gaussian densities are used internally. Switching to other densities should be trivial. \subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
\hypertarget{classbdm_1_1merger_30ae0fa8a88737185f598bf63fec0569}{
\hyperlink{classbdm_1_1merger_30ae0fa8a88737185f598bf63fec0569}{merger} (const Array$<$ \hyperlink{classbdm_1_1mpdf}{mpdf} $\ast$ $>$ \&S)}
\label{classbdm_1_1merger_30ae0fa8a88737185f598bf63fec0569}

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

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

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

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

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

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

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

\begin{CompactList}\small\item\em return expected value \item\end{CompactList}\item 
\hypertarget{classbdm_1_1merger_88e75fe2b9d7c1247b20ea7760c061f1}{
mat \textbf{covariance} () const }
\label{classbdm_1_1merger_88e75fe2b9d7c1247b20ea7760c061f1}

\item 
\hypertarget{classbdm_1_1merger_bcef70ece256b1ab1fa7a3a354eb1cc4}{
vec \hyperlink{classbdm_1_1merger_bcef70ece256b1ab1fa7a3a354eb1cc4}{variance} () const }
\label{classbdm_1_1merger_bcef70ece256b1ab1fa7a3a354eb1cc4}

\begin{CompactList}\small\item\em return expected variance (not covariance!) \item\end{CompactList}\item 
\hypertarget{classbdm_1_1merger_febef179bb5e074ae6e34d15b4596273}{
virtual \hyperlink{classbdm_1_1merger_febef179bb5e074ae6e34d15b4596273}{$\sim$merger} ()}
\label{classbdm_1_1merger_febef179bb5e074ae6e34d15b4596273}

\begin{CompactList}\small\item\em for future use \item\end{CompactList}\item 
\hypertarget{classbdm_1_1merger_13f8534f626a37bed91a6d9db54d6d2f}{
\hyperlink{classbdm_1_1MixEF}{MixEF} \& \hyperlink{classbdm_1_1merger_13f8534f626a37bed91a6d9db54d6d2f}{\_\-Mix} ()}
\label{classbdm_1_1merger_13f8534f626a37bed91a6d9db54d6d2f}

\begin{CompactList}\small\item\em Access function. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1merger_23f5f8b80df579b05681006fbcfe3699}{
\hyperlink{classbdm_1_1eEmp}{eEmp} \& \hyperlink{classbdm_1_1merger_23f5f8b80df579b05681006fbcfe3699}{\_\-Smp} ()}
\label{classbdm_1_1merger_23f5f8b80df579b05681006fbcfe3699}

\begin{CompactList}\small\item\em Access function. \item\end{CompactList}\item 
\hyperlink{classbdm_1_1RV}{RV} \hyperlink{classbdm_1_1compositepdf_c73d39acc4378eee6a63155c3517d3c9}{getrv} (bool checkoverlap=false)
\begin{CompactList}\small\item\em find common rv, flag \item\end{CompactList}\item 
\hypertarget{classbdm_1_1compositepdf_c71fc2c51f49d797e61f479f543c75ce}{
void \hyperlink{classbdm_1_1compositepdf_c71fc2c51f49d797e61f479f543c75ce}{setrvc} (const \hyperlink{classbdm_1_1RV}{RV} \&\hyperlink{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}{rv}, \hyperlink{classbdm_1_1RV}{RV} \&rvc)}
\label{classbdm_1_1compositepdf_c71fc2c51f49d797e61f479f543c75ce}

\begin{CompactList}\small\item\em common rvc of all mpdfs is written to rvc \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}\item 
\hypertarget{classbdm_1_1epdf_34956d4dd3176eeb5937cf48a1546b62}{
virtual vec \hyperlink{classbdm_1_1epdf_34956d4dd3176eeb5937cf48a1546b62}{evallog\_\-m} (const mat \&Val) const }
\label{classbdm_1_1epdf_34956d4dd3176eeb5937cf48a1546b62}

\begin{CompactList}\small\item\em Compute log-probability of multiple values argument {\tt val}. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1epdf_e584eac5579c1b6384947ecf66166c77}{
virtual \hyperlink{classbdm_1_1mpdf}{mpdf} $\ast$ \hyperlink{classbdm_1_1epdf_e584eac5579c1b6384947ecf66166c77}{condition} (const \hyperlink{classbdm_1_1RV}{RV} \&\hyperlink{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}{rv}) const }
\label{classbdm_1_1epdf_e584eac5579c1b6384947ecf66166c77}

\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_1epdf_3fb2ece54f720b62ad325e61214fa0a1}{
virtual \hyperlink{classbdm_1_1epdf}{epdf} $\ast$ \hyperlink{classbdm_1_1epdf_3fb2ece54f720b62ad325e61214fa0a1}{marginal} (const \hyperlink{classbdm_1_1RV}{RV} \&\hyperlink{classbdm_1_1epdf_62c5b8ff71d9ebe6cd58d3c342eb1dc8}{rv}) const }
\label{classbdm_1_1epdf_3fb2ece54f720b62ad325e61214fa0a1}

\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}\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_1merger_67ae71cbf0686d7c7bf116fa5db86d81}{
\hyperlink{classbdm_1_1MixEF}{MixEF} \hyperlink{classbdm_1_1merger_67ae71cbf0686d7c7bf116fa5db86d81}{Mix}}
\label{classbdm_1_1merger_67ae71cbf0686d7c7bf116fa5db86d81}

\begin{CompactList}\small\item\em Internal mixture of EF models. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1merger_ea3c9f4739f857877fd5285b3973289c}{
Array$<$ \hyperlink{classbdm_1_1datalink__m2e}{datalink\_\-m2e} $\ast$ $>$ \hyperlink{classbdm_1_1merger_ea3c9f4739f857877fd5285b3973289c}{dls}}
\label{classbdm_1_1merger_ea3c9f4739f857877fd5285b3973289c}

\begin{CompactList}\small\item\em Data link for each \hyperlink{classbdm_1_1mpdf}{mpdf} in mpdfs. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1merger_135b938f841cb88ad00a8bbded818703}{
Array$<$ \hyperlink{classbdm_1_1RV}{RV} $>$ \hyperlink{classbdm_1_1merger_135b938f841cb88ad00a8bbded818703}{rvzs}}
\label{classbdm_1_1merger_135b938f841cb88ad00a8bbded818703}

\begin{CompactList}\small\item\em Array of rvs that are not modelled by mpdfs at all (aux). \item\end{CompactList}\item 
\hypertarget{classbdm_1_1merger_6c48bf36ec1f3f7b52e3159cf428a193}{
Array$<$ \hyperlink{classbdm_1_1datalink__m2e}{datalink\_\-m2e} $\ast$ $>$ \hyperlink{classbdm_1_1merger_6c48bf36ec1f3f7b52e3159cf428a193}{zdls}}
\label{classbdm_1_1merger_6c48bf36ec1f3f7b52e3159cf428a193}

\begin{CompactList}\small\item\em Data Links of rv0 mpdfs - these will be conditioned the (rv,rvc) of mpdfs. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1merger_e91b83e6d9076848c71ae27664072109}{
int \hyperlink{classbdm_1_1merger_e91b83e6d9076848c71ae27664072109}{Ns}}
\label{classbdm_1_1merger_e91b83e6d9076848c71ae27664072109}

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

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

\begin{CompactList}\small\item\em Prior on the log-normal merging model. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1merger_522d43f7aa13fe6701e93fba174dec94}{
\hyperlink{classbdm_1_1eEmp}{eEmp} \hyperlink{classbdm_1_1merger_522d43f7aa13fe6701e93fba174dec94}{eSmp}}
\label{classbdm_1_1merger_522d43f7aa13fe6701e93fba174dec94}

\begin{CompactList}\small\item\em Projection to empirical density. \item\end{CompactList}\item 
\hypertarget{classbdm_1_1compositepdf_7ca3cd8ed92a7154f5b9ff13b1e9d52a}{
int \hyperlink{classbdm_1_1compositepdf_7ca3cd8ed92a7154f5b9ff13b1e9d52a}{n}}
\label{classbdm_1_1compositepdf_7ca3cd8ed92a7154f5b9ff13b1e9d52a}

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

\begin{CompactList}\small\item\em Elements of composition. \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_1merger_0ef73e76eeee44c8e3896e3a271ad974}{
\index{bdm::merger@{bdm::merger}!sample@{sample}}
\index{sample@{sample}!bdm::merger@{bdm::merger}}
\subsubsection[sample]{\setlength{\rightskip}{0pt plus 5cm}vec bdm::merger::sample () const\hspace{0.3cm}{\tt  \mbox{[}inline, virtual\mbox{]}}}}
\label{classbdm_1_1merger_0ef73e76eeee44c8e3896e3a271ad974}


sample from merged density weight w is a 

Implements \hyperlink{classbdm_1_1epdf_09721eb148bc49d6ec2f1956039f3a10}{bdm::epdf}.

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


find common rv, flag 

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


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

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