\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_632cd7e0bcd149c0dc85042063364f6b}{
double \hyperlink{classmerger_632cd7e0bcd149c0dc85042063364f6b}{evallog} (const vec \&dt) const }
\label{classmerger_632cd7e0bcd149c0dc85042063364f6b}

\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_598e5a3b91cfc724b39eef62946a47c2}{
mat \textbf{covariance} () const }
\label{classmerger_598e5a3b91cfc724b39eef62946a47c2}

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

\begin{CompactList}\small\item\em return expected variance (not covariance!) \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{classmerger_6e430acd4eb7eea6078df0eb0a429821}{
\hyperlink{classMixEF}{MixEF} \& \hyperlink{classmerger_6e430acd4eb7eea6078df0eb0a429821}{\_\-Mix} ()}
\label{classmerger_6e430acd4eb7eea6078df0eb0a429821}

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

\begin{CompactList}\small\item\em Access function. \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{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_2495a04bbacb9b55fe5a3a59b78affca}{
virtual vec \hyperlink{classepdf_2495a04bbacb9b55fe5a3a59b78affca}{evallog\_\-m} (const mat \&Val) const }
\label{classepdf_2495a04bbacb9b55fe5a3a59b78affca}

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

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

\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_01e222f5df660e1b25c712e82da8df8f}{
Array$<$ \hyperlink{classdatalink__m2e}{datalink\_\-m2e} $\ast$ $>$ \hyperlink{classmerger_01e222f5df660e1b25c712e82da8df8f}{dls}}
\label{classmerger_01e222f5df660e1b25c712e82da8df8f}

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

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

\begin{CompactList}\small\item\em Data Links of rv0 mpdfs - these will be conditioned the (rv,rvc) of mpdfs. \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{classmerger_b13c9e8921e6bc6b8dd7bbafb54fa801}{
\hyperlink{classeEmp}{eEmp} \hyperlink{classmerger_b13c9e8921e6bc6b8dd7bbafb54fa801}{eSmp}}
\label{classmerger_b13c9e8921e6bc6b8dd7bbafb54fa801}

\begin{CompactList}\small\item\em Projection to empirical density. \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{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}
