/*!
\page userguide_merg BDM Use - Merging of probability distributions

Merging is an operation which combines information from many \c source pdfs into one, the \c merger.

The very basic merger requires that the sources are defined on the same variables.

\section ug_mer_mat Matlab class mexMerger

All mergers in Matlab are derived from a class mexMerger which has only the list of \c sources, their \c weights, the resulting pdf, the \c merger, and operations merge() and validate().

\code
classdef mexMerger
    properties
        %> weights of the merged densities
        weights
        %> source pdfs to be merged
	    sources
        %> merged density - any pdf understood by epdf_* functions
        merger
    end

    methods
        function obj=validate(obj)
            % e.g. check if all sources are compatible
        end
        %> Merge sources into the merger 
        function obj=merge(obj)
            % transform old estimate into new estimate
        end
     end
  end
\endcode
Validate has the same meaning as in previous chapters, i.e. it is called before any use of the class to check that all elements has been set-up correctly.

Except form that, only few technical functions are needed for integration with C++ classes in BDM, see mexMerger.

mexMErger is an abstract class, which has no operation defined. In order to achieve some functionality an offspring need to be defined. 
An example of one possible offspring is in class mexGaussMergerArit which implements Arithmetic merging of source pdfs which are converted into Gaussians using moment matching.

The offspring only redefines methods validate and merge.

An example how to use this class is in bdmtoolbox/tutorial/merging/merge_mex.m
\code
clear all
pdfs

% merger 
M=mexGaussMergerArit;
M.weights = [0.5, 0.5];
M.sources = {N1a,Ga};
M=M.validate();

M=M.merge();

figure(1);
h=epdf_1dplot(N1a);
set(h,'LineStyle','--');
hold on
h=epdf_1dplot(Ga);
set(h,'LineStyle','--');


epdf_1dplot(M.merger);
\endcode


For list of all Matlab mergers, see <a href="annotated.html"> list </a>.

\section ug_mer_c Mergers from BDM

More advanced mergers allowing to merge pdfs on partially overlapping variables are available in BDM, specifically, classes bdm::MergerBase and bdm::merger_mix.

Their use is demonstrated in examples: bdmtoolbox/tutorial/merging/merge_grid.m and merge_mix.m, respectively.
*/
