Index: library/doc/html/emix_8h-source.html
===================================================================
--- library/doc/html/emix_8h-source.html (revision 385)
+++ library/doc/html/emix_8h-source.html (revision 397)
@@ -64,319 +64,344 @@
   </div>
 <h1>emix.h</h1><a href="emix_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
-<a name="l00013"></a>00013 <span class="preprocessor">#ifndef MX_H</span>
-<a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#define MX_H</span>
+<a name="l00013"></a>00013 <span class="preprocessor">#ifndef EMIX_H</span>
+<a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#define EMIX_H</span>
 <a name="l00015"></a>00015 <span class="preprocessor"></span>
 <a name="l00016"></a>00016 <span class="preprocessor">#define LOG2  0.69314718055995  </span>
 <a name="l00017"></a>00017 <span class="preprocessor"></span>
-<a name="l00018"></a>00018 <span class="preprocessor">#include "<a class="code" href="libEF_8h.html" title="Probability distributions for Exponential Family models.">libEF.h</a>"</span>
-<a name="l00019"></a>00019 <span class="comment">//#include &lt;std&gt;</span>
-<a name="l00020"></a>00020 
-<a name="l00021"></a>00021 <span class="keyword">namespace </span>bdm {
-<a name="l00022"></a>00022 
-<a name="l00023"></a>00023 <span class="comment">//this comes first because it is used inside emix!</span>
-<a name="l00024"></a>00024 
-<a name="l00037"></a><a class="code" href="classbdm_1_1mratio.html">00037</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1mratio.html" title="Class representing ratio of two densities which arise e.g. by applying the Bayes...">mratio</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> {
-<a name="l00038"></a>00038 <span class="keyword">protected</span>:
-<a name="l00040"></a><a class="code" href="classbdm_1_1mratio.html#f31caba90a2aa10fbf7631832404fe54">00040</a>         <span class="keyword">const</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1mratio.html#f31caba90a2aa10fbf7631832404fe54" title="Nominator in the form of mpdf.">nom</a>;
-<a name="l00042"></a><a class="code" href="classbdm_1_1mratio.html#7daa5d02d3a3be9d15fd4156d886ed88">00042</a>         <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1mratio.html#7daa5d02d3a3be9d15fd4156d886ed88" title="Denominator in the form of epdf.">den</a>;
-<a name="l00044"></a><a class="code" href="classbdm_1_1mratio.html#51bfe6675e724f7fbeaaeacce5a9f9b8">00044</a>         <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1mratio.html#51bfe6675e724f7fbeaaeacce5a9f9b8" title="flag for destructor">destroynom</a>;
-<a name="l00046"></a><a class="code" href="classbdm_1_1mratio.html#cda5bd23ba60146d69e1f804ff7710c7">00046</a>         <a class="code" href="classbdm_1_1datalink__m2e.html" title="data link between">datalink_m2e</a> <a class="code" href="classbdm_1_1mratio.html#cda5bd23ba60146d69e1f804ff7710c7" title="datalink between conditional and nom">dl</a>;
-<a name="l00047"></a>00047 <span class="keyword">public</span>:
-<a name="l00050"></a><a class="code" href="classbdm_1_1mratio.html#0ff56d13f9515d7e5f23b7a4cc5529b4">00050</a>         <a class="code" href="classbdm_1_1mratio.html#0ff56d13f9515d7e5f23b7a4cc5529b4">mratio</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* nom0, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv, <span class="keywordtype">bool</span> copy=<span class="keyword">false</span> ) :<a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> ( ), <a class="code" href="classbdm_1_1mratio.html#cda5bd23ba60146d69e1f804ff7710c7" title="datalink between conditional and nom">dl</a> ( ) {
-<a name="l00051"></a>00051                 <span class="comment">// adjust rv and rvc</span>
-<a name="l00052"></a>00052                 <a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a> = nom0-&gt;<a class="code" href="classbdm_1_1epdf.html#a4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>().<a class="code" href="classbdm_1_1RV.html#aec44dabdf0a6d90fbae95e1356eda39" title="Subtract another variable from the current one.">subt</a> ( rv );
-<a name="l00053"></a>00053                 <a class="code" href="classbdm_1_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a> = <a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>();
-<a name="l00054"></a>00054                 <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a> = <span class="keyword">new</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>;
-<a name="l00055"></a>00055                 <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-&gt;<a class="code" href="classbdm_1_1epdf.html#840de94aa33cf4f2ebd2427f45a165d8">set_parameters</a>(rv.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>());
-<a name="l00056"></a>00056                 <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-&gt;<a class="code" href="classbdm_1_1epdf.html#f423e28448dbb69ef4905295ec8de8ff" title="Name its rv.">set_rv</a>(rv);
-<a name="l00057"></a>00057                 
-<a name="l00058"></a>00058                 <span class="comment">//prepare data structures</span>
-<a name="l00059"></a>00059                 <span class="keywordflow">if</span> ( copy ) {it_error ( <span class="stringliteral">"todo"</span> ); <a class="code" href="classbdm_1_1mratio.html#51bfe6675e724f7fbeaaeacce5a9f9b8" title="flag for destructor">destroynom</a>=<span class="keyword">true</span>; }
-<a name="l00060"></a>00060                 <span class="keywordflow">else</span> { <a class="code" href="classbdm_1_1mratio.html#f31caba90a2aa10fbf7631832404fe54" title="Nominator in the form of mpdf.">nom</a> = nom0; <a class="code" href="classbdm_1_1mratio.html#51bfe6675e724f7fbeaaeacce5a9f9b8" title="flag for destructor">destroynom</a> = <span class="keyword">false</span>; }
-<a name="l00061"></a>00061                 it_assert_debug ( <a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>.<a class="code" href="classbdm_1_1RV.html#e9ec8c3e756651ff352ab5e3d3acda4b">length</a>() &gt;0,<span class="stringliteral">"Makes no sense to use this object!"</span> );               
-<a name="l00062"></a>00062                 
-<a name="l00063"></a>00063                 <span class="comment">// build denominator</span>
-<a name="l00064"></a>00064                 <a class="code" href="classbdm_1_1mratio.html#7daa5d02d3a3be9d15fd4156d886ed88" title="Denominator in the form of epdf.">den</a> = <a class="code" href="classbdm_1_1mratio.html#f31caba90a2aa10fbf7631832404fe54" title="Nominator in the form of mpdf.">nom</a>-&gt;<a class="code" href="classbdm_1_1epdf.html#3fb2ece54f720b62ad325e61214fa0a1" title="Return marginal density on the given RV, the remainig rvs are intergrated out.">marginal</a> ( <a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a> );
-<a name="l00065"></a>00065                 <a class="code" href="classbdm_1_1mratio.html#cda5bd23ba60146d69e1f804ff7710c7" title="datalink between conditional and nom">dl</a>.<a class="code" href="classbdm_1_1datalink__m2e.html#add918bf877c48714cff51ee4ad989b0" title="Constructor.">set_connection</a>(rv,<a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>,nom0-&gt;<a class="code" href="classbdm_1_1epdf.html#a4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>());
-<a name="l00066"></a>00066         };
-<a name="l00067"></a><a class="code" href="classbdm_1_1mratio.html#3a2cbce8c61ca9f592d9c2220f7c1204">00067</a>         <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1mratio.html#3a2cbce8c61ca9f592d9c2220f7c1204" title="Shortcut for conditioning and evaluation of the internal epdf. In some cases, this...">evallogcond</a> ( <span class="keyword">const</span> vec &amp;val, <span class="keyword">const</span> vec &amp;cond ) {
-<a name="l00068"></a>00068                 <span class="keywordtype">double</span> tmp;
-<a name="l00069"></a>00069                 vec nom_val ( <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-&gt;<a class="code" href="classbdm_1_1epdf.html#7083a65f7b7a0d0d13b2c516bd2ec29c" title="Size of the random variable.">dimension</a>() + <a class="code" href="classbdm_1_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a> );
-<a name="l00070"></a>00070                 <a class="code" href="classbdm_1_1mratio.html#cda5bd23ba60146d69e1f804ff7710c7" title="datalink between conditional and nom">dl</a>.<a class="code" href="classbdm_1_1datalink__m2e.html#b29bc3c7bf2a1d87e77ccaa793d097d5">pushup_cond</a> ( nom_val,val,cond );
-<a name="l00071"></a>00071                 tmp = exp ( <a class="code" href="classbdm_1_1mratio.html#f31caba90a2aa10fbf7631832404fe54" title="Nominator in the form of mpdf.">nom</a>-&gt;<a class="code" href="classbdm_1_1epdf.html#deab266d63c236c277538867d5c3f249" title="Compute log-probability of argument val.">evallog</a> ( nom_val ) - <a class="code" href="classbdm_1_1mratio.html#7daa5d02d3a3be9d15fd4156d886ed88" title="Denominator in the form of epdf.">den</a>-&gt;<a class="code" href="classbdm_1_1epdf.html#deab266d63c236c277538867d5c3f249" title="Compute log-probability of argument val.">evallog</a> ( cond ) );
-<a name="l00072"></a>00072                 it_assert_debug ( std::isfinite ( tmp ),<span class="stringliteral">"Infinite value"</span> );
-<a name="l00073"></a>00073                 <span class="keywordflow">return</span> tmp;
-<a name="l00074"></a>00074         }
-<a name="l00076"></a><a class="code" href="classbdm_1_1mratio.html#c8b39fea586d4258bb3c881406edaf15">00076</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mratio.html#c8b39fea586d4258bb3c881406edaf15" title="Object takes ownership of nom and will destroy it.">ownnom</a>() {<a class="code" href="classbdm_1_1mratio.html#51bfe6675e724f7fbeaaeacce5a9f9b8" title="flag for destructor">destroynom</a>=<span class="keyword">true</span>;}
-<a name="l00078"></a><a class="code" href="classbdm_1_1mratio.html#c0cc0b25dbdc54751466616655454c5c">00078</a>         <a class="code" href="classbdm_1_1mratio.html#c0cc0b25dbdc54751466616655454c5c" title="Default destructor.">~mratio</a>() {<span class="keyword">delete</span> <a class="code" href="classbdm_1_1mratio.html#7daa5d02d3a3be9d15fd4156d886ed88" title="Denominator in the form of epdf.">den</a>; <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1mratio.html#51bfe6675e724f7fbeaaeacce5a9f9b8" title="flag for destructor">destroynom</a> ) {<span class="keyword">delete</span> <a class="code" href="classbdm_1_1mratio.html#f31caba90a2aa10fbf7631832404fe54" title="Nominator in the form of mpdf.">nom</a>;}}
-<a name="l00079"></a>00079 };
-<a name="l00080"></a>00080 
-<a name="l00091"></a><a class="code" href="classbdm_1_1emix.html">00091</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1emix.html" title="Mixture of epdfs.">emix</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> {
-<a name="l00092"></a>00092 <span class="keyword">protected</span>:
-<a name="l00094"></a><a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46">00094</a>         vec <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a>;
-<a name="l00096"></a><a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e">00096</a>         Array&lt;epdf*&gt; <a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a>;
-<a name="l00098"></a><a class="code" href="classbdm_1_1emix.html#47189df41a4616c2fed5972f015743f4">00098</a>         <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1emix.html#47189df41a4616c2fed5972f015743f4" title="Flag if owning Coms.">destroyComs</a>;
-<a name="l00099"></a>00099 <span class="keyword">public</span>:
-<a name="l00101"></a><a class="code" href="classbdm_1_1emix.html#4838f3a376ee0bd3c658bfb8f4ea4a3d">00101</a>         <a class="code" href="classbdm_1_1emix.html#4838f3a376ee0bd3c658bfb8f4ea4a3d" title="Default constructor.">emix</a> ( ) : <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> ( ) {};
-<a name="l00104"></a>00104         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1emix.html#3a107a6b808a081389ef17af951c234a">set_parameters</a> ( <span class="keyword">const</span> vec &amp;<a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a>, <span class="keyword">const</span> Array&lt;epdf*&gt; &amp;<a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a>, <span class="keywordtype">bool</span> copy=<span class="keyword">false</span> );
-<a name="l00105"></a>00105 
-<a name="l00106"></a>00106         vec <a class="code" href="classbdm_1_1emix.html#e8839dbbb0d1276a8dbe957a67cfe0dc" title="Returns a sample,  from density .">sample</a>() <span class="keyword">const</span>;
-<a name="l00107"></a><a class="code" href="classbdm_1_1emix.html#a3a5390bc56e81ef3b0debc0f185fa8a">00107</a>         vec <a class="code" href="classbdm_1_1emix.html#a3a5390bc56e81ef3b0debc0f185fa8a" title="return expected value">mean</a>()<span class="keyword"> const </span>{
-<a name="l00108"></a>00108                 <span class="keywordtype">int</span> i; vec mu = zeros ( <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> );
-<a name="l00109"></a>00109                 <span class="keywordflow">for</span> ( i = 0;i &lt; <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a>.length();i++ ) {mu += <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a> ( i ) * <a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a> ( i )-&gt;mean(); }
-<a name="l00110"></a>00110                 <span class="keywordflow">return</span> mu;
-<a name="l00111"></a>00111         }
-<a name="l00112"></a><a class="code" href="classbdm_1_1emix.html#e9a627023cdf90c9ffd8eef726595c86">00112</a>         vec <a class="code" href="classbdm_1_1emix.html#e9a627023cdf90c9ffd8eef726595c86" title="return expected variance (not covariance!)">variance</a>()<span class="keyword"> const </span>{
-<a name="l00113"></a>00113                 <span class="comment">//non-central moment</span>
-<a name="l00114"></a>00114                 vec mom2 = zeros ( <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> );
-<a name="l00115"></a>00115                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0;i &lt; <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a>.length();i++ ) {mom2 += <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a> ( i ) * (<a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a>(i)-&gt;variance() + pow ( <a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a> ( i )-&gt;<a class="code" href="classbdm_1_1emix.html#a3a5390bc56e81ef3b0debc0f185fa8a" title="return expected value">mean</a>(),2 )); }
-<a name="l00116"></a>00116                 <span class="comment">//central moment</span>
-<a name="l00117"></a>00117                 <span class="keywordflow">return</span> mom2-pow ( <a class="code" href="classbdm_1_1emix.html#a3a5390bc56e81ef3b0debc0f185fa8a" title="return expected value">mean</a>(),2 );
-<a name="l00118"></a>00118         }
-<a name="l00119"></a><a class="code" href="classbdm_1_1emix.html#0f3db99f730bde6b7953931594537e8e">00119</a>         <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1emix.html#0f3db99f730bde6b7953931594537e8e" title="Compute log-probability of argument val.">evallog</a> ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const </span>{
-<a name="l00120"></a>00120                 <span class="keywordtype">int</span> i;
-<a name="l00121"></a>00121                 <span class="keywordtype">double</span> sum = 0.0;
-<a name="l00122"></a>00122                 <span class="keywordflow">for</span> ( i = 0;i &lt; <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a>.length();i++ ) {sum += <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a> ( i ) * exp ( <a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a> ( i )-&gt;<a class="code" href="classbdm_1_1emix.html#0f3db99f730bde6b7953931594537e8e" title="Compute log-probability of argument val.">evallog</a> ( val ) );}
-<a name="l00123"></a>00123                 <span class="keywordflow">if</span> ( sum==0.0 ) {sum=std::numeric_limits&lt;double&gt;::epsilon();}
-<a name="l00124"></a>00124                 <span class="keywordtype">double</span> tmp=log ( sum );
-<a name="l00125"></a>00125                 it_assert_debug ( std::isfinite ( tmp ),<span class="stringliteral">"Infinite"</span> );
-<a name="l00126"></a>00126                 <span class="keywordflow">return</span> tmp;
-<a name="l00127"></a>00127         };
-<a name="l00128"></a><a class="code" href="classbdm_1_1emix.html#23af1986e2afcbc8c7e1c30f610e703b">00128</a>         vec <a class="code" href="classbdm_1_1emix.html#23af1986e2afcbc8c7e1c30f610e703b" title="Compute log-probability of multiple values argument val.">evallog_m</a> ( <span class="keyword">const</span> mat &amp;Val )<span class="keyword"> const </span>{
-<a name="l00129"></a>00129                 vec x=zeros ( Val.cols() );
-<a name="l00130"></a>00130                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a>.length(); i++ ) {
-<a name="l00131"></a>00131                         x+= <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a> ( i ) *exp ( <a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a> ( i )-&gt;<a class="code" href="classbdm_1_1emix.html#23af1986e2afcbc8c7e1c30f610e703b" title="Compute log-probability of multiple values argument val.">evallog_m</a> ( Val ) );
-<a name="l00132"></a>00132                 }
-<a name="l00133"></a>00133                 <span class="keywordflow">return</span> log ( x );
-<a name="l00134"></a>00134         };
-<a name="l00136"></a><a class="code" href="classbdm_1_1emix.html#e64c1d5a73f541e469792e23d4677af2">00136</a>         mat <a class="code" href="classbdm_1_1emix.html#e64c1d5a73f541e469792e23d4677af2" title="Auxiliary function that returns pdflog for each component.">evallog_M</a> ( <span class="keyword">const</span> mat &amp;Val )<span class="keyword"> const </span>{
-<a name="l00137"></a>00137                 mat X ( <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a>.length(), Val.cols() );
-<a name="l00138"></a>00138                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a>.length(); i++ ) {
-<a name="l00139"></a>00139                         X.set_row ( i, <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a> ( i ) *exp ( <a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a> ( i )-&gt;<a class="code" href="classbdm_1_1emix.html#23af1986e2afcbc8c7e1c30f610e703b" title="Compute log-probability of multiple values argument val.">evallog_m</a> ( Val ) ) );
-<a name="l00140"></a>00140                 }
-<a name="l00141"></a>00141                 <span class="keywordflow">return</span> X;
-<a name="l00142"></a>00142         };
-<a name="l00143"></a>00143 
-<a name="l00144"></a>00144         <a class="code" href="classbdm_1_1emix.html" title="Mixture of epdfs.">emix</a>* <a class="code" href="classbdm_1_1emix.html#f7165371cc4f7be9292024b9f5431646" title="Return marginal density on the given RV, the remainig rvs are intergrated out.">marginal</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a> ) <span class="keyword">const</span>;
-<a name="l00145"></a>00145         <a class="code" href="classbdm_1_1mratio.html" title="Class representing ratio of two densities which arise e.g. by applying the Bayes...">mratio</a>* <a class="code" href="classbdm_1_1emix.html#fc7772a2972959cf19ba26882feacecf" title="Return conditional density on the given RV, the remaining rvs will be in conditioning...">condition</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a> ) <span class="keyword">const</span>; <span class="comment">//why not mratio!!</span>
-<a name="l00146"></a>00146 
-<a name="l00147"></a>00147 <span class="comment">//Access methods</span>
-<a name="l00149"></a><a class="code" href="classbdm_1_1emix.html#d9b584cb5b2471a4250fb127757f28be">00149</a> <span class="comment"></span>        vec&amp; <a class="code" href="classbdm_1_1emix.html#d9b584cb5b2471a4250fb127757f28be" title="returns a pointer to the internal mean value. Use with Care!">_w</a>() {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a>;}
-<a name="l00150"></a>00150         <span class="keyword">virtual</span> ~<a class="code" href="classbdm_1_1emix.html" title="Mixture of epdfs.">emix</a>() {<span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1emix.html#47189df41a4616c2fed5972f015743f4" title="Flag if owning Coms.">destroyComs</a> ) {<span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a>.length();i++ ) {<span class="keyword">delete</span> <a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a> ( i );}}}
-<a name="l00152"></a><a class="code" href="classbdm_1_1emix.html#965fb16669250a3d28bc62cf76276d8e">00152</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1emix.html#965fb16669250a3d28bc62cf76276d8e" title="Auxiliary function for taking ownership of the Coms().">ownComs</a>() {<a class="code" href="classbdm_1_1emix.html#47189df41a4616c2fed5972f015743f4" title="Flag if owning Coms.">destroyComs</a>=<span class="keyword">true</span>;}
-<a name="l00153"></a>00153 
-<a name="l00155"></a><a class="code" href="classbdm_1_1emix.html#578616445243674438257be99ba71612">00155</a>         <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1emix.html#578616445243674438257be99ba71612" title="access function">_Coms</a> ( <span class="keywordtype">int</span> i ) {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a> ( i );}
-<a name="l00156"></a><a class="code" href="classbdm_1_1emix.html#04a8632cfa9299ae937228eb732fd61e">00156</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1emix.html#04a8632cfa9299ae937228eb732fd61e" title="Name its rv.">set_rv</a>(<span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>){
-<a name="l00157"></a>00157                 <a class="code" href="classbdm_1_1emix.html#04a8632cfa9299ae937228eb732fd61e" title="Name its rv.">epdf::set_rv</a>(rv);
-<a name="l00158"></a>00158                 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a>.length();i++){<a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a>(i)-&gt;set_rv(rv);}
-<a name="l00159"></a>00159         }
-<a name="l00160"></a>00160 };
+<a name="l00018"></a>00018 <span class="preprocessor">#include "<a class="code" href="exp__family_8h.html" title="Probability distributions for Exponential Family models.">exp_family.h</a>"</span>
+<a name="l00019"></a>00019 
+<a name="l00020"></a>00020 <span class="keyword">namespace </span>bdm {
+<a name="l00021"></a>00021 
+<a name="l00022"></a>00022 <span class="comment">//this comes first because it is used inside emix!</span>
+<a name="l00023"></a>00023 
+<a name="l00036"></a><a class="code" href="classbdm_1_1mratio.html">00036</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1mratio.html" title="Class representing ratio of two densities which arise e.g. by applying the Bayes...">mratio</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> {
+<a name="l00037"></a>00037 <span class="keyword">protected</span>:
+<a name="l00039"></a><a class="code" href="classbdm_1_1mratio.html#f31caba90a2aa10fbf7631832404fe54">00039</a>         <span class="keyword">const</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1mratio.html#f31caba90a2aa10fbf7631832404fe54" title="Nominator in the form of mpdf.">nom</a>;
+<a name="l00041"></a><a class="code" href="classbdm_1_1mratio.html#7daa5d02d3a3be9d15fd4156d886ed88">00041</a>         <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1mratio.html#7daa5d02d3a3be9d15fd4156d886ed88" title="Denominator in the form of epdf.">den</a>;
+<a name="l00043"></a><a class="code" href="classbdm_1_1mratio.html#51bfe6675e724f7fbeaaeacce5a9f9b8">00043</a>         <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1mratio.html#51bfe6675e724f7fbeaaeacce5a9f9b8" title="flag for destructor">destroynom</a>;
+<a name="l00045"></a><a class="code" href="classbdm_1_1mratio.html#cda5bd23ba60146d69e1f804ff7710c7">00045</a>         <a class="code" href="classbdm_1_1datalink__m2e.html" title="data link between">datalink_m2e</a> <a class="code" href="classbdm_1_1mratio.html#cda5bd23ba60146d69e1f804ff7710c7" title="datalink between conditional and nom">dl</a>;
+<a name="l00046"></a>00046 <span class="keyword">public</span>:
+<a name="l00049"></a><a class="code" href="classbdm_1_1mratio.html#0ff56d13f9515d7e5f23b7a4cc5529b4">00049</a>         <a class="code" href="classbdm_1_1mratio.html#0ff56d13f9515d7e5f23b7a4cc5529b4">mratio</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* nom0, <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv, <span class="keywordtype">bool</span> copy=<span class="keyword">false</span> ) :<a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> ( ), <a class="code" href="classbdm_1_1mratio.html#cda5bd23ba60146d69e1f804ff7710c7" title="datalink between conditional and nom">dl</a> ( ) {
+<a name="l00050"></a>00050                 <span class="comment">// adjust rv and rvc</span>
+<a name="l00051"></a>00051                 <a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a> = nom0-&gt;<a class="code" href="classbdm_1_1epdf.html#a4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>().<a class="code" href="classbdm_1_1RV.html#aec44dabdf0a6d90fbae95e1356eda39" title="Subtract another variable from the current one.">subt</a> ( rv );
+<a name="l00052"></a>00052                 <a class="code" href="classbdm_1_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a> = <a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>();
+<a name="l00053"></a>00053                 <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a> = <span class="keyword">new</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>;
+<a name="l00054"></a>00054                 <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-&gt;<a class="code" href="classbdm_1_1epdf.html#840de94aa33cf4f2ebd2427f45a165d8">set_parameters</a>(rv.<a class="code" href="classbdm_1_1RV.html#de30156104f61d86c94f758861418089">_dsize</a>());
+<a name="l00055"></a>00055                 <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-&gt;<a class="code" href="classbdm_1_1epdf.html#f423e28448dbb69ef4905295ec8de8ff" title="Name its rv.">set_rv</a>(rv);
+<a name="l00056"></a>00056                 
+<a name="l00057"></a>00057                 <span class="comment">//prepare data structures</span>
+<a name="l00058"></a>00058                 <span class="keywordflow">if</span> ( copy ) {it_error ( <span class="stringliteral">"todo"</span> ); <a class="code" href="classbdm_1_1mratio.html#51bfe6675e724f7fbeaaeacce5a9f9b8" title="flag for destructor">destroynom</a>=<span class="keyword">true</span>; }
+<a name="l00059"></a>00059                 <span class="keywordflow">else</span> { <a class="code" href="classbdm_1_1mratio.html#f31caba90a2aa10fbf7631832404fe54" title="Nominator in the form of mpdf.">nom</a> = nom0; <a class="code" href="classbdm_1_1mratio.html#51bfe6675e724f7fbeaaeacce5a9f9b8" title="flag for destructor">destroynom</a> = <span class="keyword">false</span>; }
+<a name="l00060"></a>00060                 it_assert_debug ( <a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>.<a class="code" href="classbdm_1_1RV.html#e9ec8c3e756651ff352ab5e3d3acda4b">length</a>() &gt;0,<span class="stringliteral">"Makes no sense to use this object!"</span> );               
+<a name="l00061"></a>00061                 
+<a name="l00062"></a>00062                 <span class="comment">// build denominator</span>
+<a name="l00063"></a>00063                 <a class="code" href="classbdm_1_1mratio.html#7daa5d02d3a3be9d15fd4156d886ed88" title="Denominator in the form of epdf.">den</a> = <a class="code" href="classbdm_1_1mratio.html#f31caba90a2aa10fbf7631832404fe54" title="Nominator in the form of mpdf.">nom</a>-&gt;<a class="code" href="classbdm_1_1epdf.html#3fb2ece54f720b62ad325e61214fa0a1" title="Return marginal density on the given RV, the remainig rvs are intergrated out.">marginal</a> ( <a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a> );
+<a name="l00064"></a>00064                 <a class="code" href="classbdm_1_1mratio.html#cda5bd23ba60146d69e1f804ff7710c7" title="datalink between conditional and nom">dl</a>.<a class="code" href="classbdm_1_1datalink__m2e.html#add918bf877c48714cff51ee4ad989b0" title="Constructor.">set_connection</a>(rv,<a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a>,nom0-&gt;<a class="code" href="classbdm_1_1epdf.html#a4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>());
+<a name="l00065"></a>00065         };
+<a name="l00066"></a><a class="code" href="classbdm_1_1mratio.html#3a2cbce8c61ca9f592d9c2220f7c1204">00066</a>         <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1mratio.html#3a2cbce8c61ca9f592d9c2220f7c1204" title="Shortcut for conditioning and evaluation of the internal epdf. In some cases, this...">evallogcond</a> ( <span class="keyword">const</span> vec &amp;val, <span class="keyword">const</span> vec &amp;cond ) {
+<a name="l00067"></a>00067                 <span class="keywordtype">double</span> tmp;
+<a name="l00068"></a>00068                 vec nom_val ( <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-&gt;<a class="code" href="classbdm_1_1epdf.html#7083a65f7b7a0d0d13b2c516bd2ec29c" title="Size of the random variable.">dimension</a>() + <a class="code" href="classbdm_1_1mpdf.html#7c1900976ff13dbc09c9729b3bbff9e6" title="dimension of the condition">dimc</a> );
+<a name="l00069"></a>00069                 <a class="code" href="classbdm_1_1mratio.html#cda5bd23ba60146d69e1f804ff7710c7" title="datalink between conditional and nom">dl</a>.<a class="code" href="classbdm_1_1datalink__m2e.html#b29bc3c7bf2a1d87e77ccaa793d097d5">pushup_cond</a> ( nom_val,val,cond );
+<a name="l00070"></a>00070                 tmp = exp ( <a class="code" href="classbdm_1_1mratio.html#f31caba90a2aa10fbf7631832404fe54" title="Nominator in the form of mpdf.">nom</a>-&gt;<a class="code" href="classbdm_1_1epdf.html#deab266d63c236c277538867d5c3f249" title="Compute log-probability of argument val.">evallog</a> ( nom_val ) - <a class="code" href="classbdm_1_1mratio.html#7daa5d02d3a3be9d15fd4156d886ed88" title="Denominator in the form of epdf.">den</a>-&gt;<a class="code" href="classbdm_1_1epdf.html#deab266d63c236c277538867d5c3f249" title="Compute log-probability of argument val.">evallog</a> ( cond ) );
+<a name="l00071"></a>00071                 it_assert_debug ( std::isfinite ( tmp ),<span class="stringliteral">"Infinite value"</span> );
+<a name="l00072"></a>00072                 <span class="keywordflow">return</span> tmp;
+<a name="l00073"></a>00073         }
+<a name="l00075"></a><a class="code" href="classbdm_1_1mratio.html#c8b39fea586d4258bb3c881406edaf15">00075</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mratio.html#c8b39fea586d4258bb3c881406edaf15" title="Object takes ownership of nom and will destroy it.">ownnom</a>() {<a class="code" href="classbdm_1_1mratio.html#51bfe6675e724f7fbeaaeacce5a9f9b8" title="flag for destructor">destroynom</a>=<span class="keyword">true</span>;}
+<a name="l00077"></a><a class="code" href="classbdm_1_1mratio.html#c0cc0b25dbdc54751466616655454c5c">00077</a>         <a class="code" href="classbdm_1_1mratio.html#c0cc0b25dbdc54751466616655454c5c" title="Default destructor.">~mratio</a>() {<span class="keyword">delete</span> <a class="code" href="classbdm_1_1mratio.html#7daa5d02d3a3be9d15fd4156d886ed88" title="Denominator in the form of epdf.">den</a>; <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1mratio.html#51bfe6675e724f7fbeaaeacce5a9f9b8" title="flag for destructor">destroynom</a> ) {<span class="keyword">delete</span> <a class="code" href="classbdm_1_1mratio.html#f31caba90a2aa10fbf7631832404fe54" title="Nominator in the form of mpdf.">nom</a>;}}
+<a name="l00078"></a>00078 };
+<a name="l00079"></a>00079 
+<a name="l00090"></a><a class="code" href="classbdm_1_1emix.html">00090</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1emix.html" title="Mixture of epdfs.">emix</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> {
+<a name="l00091"></a>00091 <span class="keyword">protected</span>:
+<a name="l00093"></a><a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46">00093</a>         vec <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a>;
+<a name="l00095"></a><a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e">00095</a>         Array&lt;epdf*&gt; <a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a>;
+<a name="l00097"></a><a class="code" href="classbdm_1_1emix.html#47189df41a4616c2fed5972f015743f4">00097</a>         <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1emix.html#47189df41a4616c2fed5972f015743f4" title="Flag if owning Coms.">destroyComs</a>;
+<a name="l00098"></a>00098 <span class="keyword">public</span>:
+<a name="l00100"></a><a class="code" href="classbdm_1_1emix.html#4838f3a376ee0bd3c658bfb8f4ea4a3d">00100</a>         <a class="code" href="classbdm_1_1emix.html#4838f3a376ee0bd3c658bfb8f4ea4a3d" title="Default constructor.">emix</a> ( ) : <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> ( ) {};
+<a name="l00103"></a>00103         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1emix.html#3a107a6b808a081389ef17af951c234a">set_parameters</a> ( <span class="keyword">const</span> vec &amp;<a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a>, <span class="keyword">const</span> Array&lt;epdf*&gt; &amp;<a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a>, <span class="keywordtype">bool</span> copy=<span class="keyword">false</span> );
+<a name="l00104"></a>00104 
+<a name="l00105"></a>00105         vec <a class="code" href="classbdm_1_1emix.html#e8839dbbb0d1276a8dbe957a67cfe0dc" title="Returns a sample,  from density .">sample</a>() <span class="keyword">const</span>;
+<a name="l00106"></a><a class="code" href="classbdm_1_1emix.html#a3a5390bc56e81ef3b0debc0f185fa8a">00106</a>         vec <a class="code" href="classbdm_1_1emix.html#a3a5390bc56e81ef3b0debc0f185fa8a" title="return expected value">mean</a>()<span class="keyword"> const </span>{
+<a name="l00107"></a>00107                 <span class="keywordtype">int</span> i; vec mu = zeros ( <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> );
+<a name="l00108"></a>00108                 <span class="keywordflow">for</span> ( i = 0;i &lt; <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a>.length();i++ ) {mu += <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a> ( i ) * <a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a> ( i )-&gt;mean(); }
+<a name="l00109"></a>00109                 <span class="keywordflow">return</span> mu;
+<a name="l00110"></a>00110         }
+<a name="l00111"></a><a class="code" href="classbdm_1_1emix.html#e9a627023cdf90c9ffd8eef726595c86">00111</a>         vec <a class="code" href="classbdm_1_1emix.html#e9a627023cdf90c9ffd8eef726595c86" title="return expected variance (not covariance!)">variance</a>()<span class="keyword"> const </span>{
+<a name="l00112"></a>00112                 <span class="comment">//non-central moment</span>
+<a name="l00113"></a>00113                 vec mom2 = zeros ( <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> );
+<a name="l00114"></a>00114                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0;i &lt; <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a>.length();i++ ) {mom2 += <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a> ( i ) * (<a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a>(i)-&gt;variance() + pow ( <a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a> ( i )-&gt;<a class="code" href="classbdm_1_1emix.html#a3a5390bc56e81ef3b0debc0f185fa8a" title="return expected value">mean</a>(),2 )); }
+<a name="l00115"></a>00115                 <span class="comment">//central moment</span>
+<a name="l00116"></a>00116                 <span class="keywordflow">return</span> mom2-pow ( <a class="code" href="classbdm_1_1emix.html#a3a5390bc56e81ef3b0debc0f185fa8a" title="return expected value">mean</a>(),2 );
+<a name="l00117"></a>00117         }
+<a name="l00118"></a><a class="code" href="classbdm_1_1emix.html#0f3db99f730bde6b7953931594537e8e">00118</a>         <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1emix.html#0f3db99f730bde6b7953931594537e8e" title="Compute log-probability of argument val.">evallog</a> ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const </span>{
+<a name="l00119"></a>00119                 <span class="keywordtype">int</span> i;
+<a name="l00120"></a>00120                 <span class="keywordtype">double</span> sum = 0.0;
+<a name="l00121"></a>00121                 <span class="keywordflow">for</span> ( i = 0;i &lt; <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a>.length();i++ ) {sum += <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a> ( i ) * exp ( <a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a> ( i )-&gt;<a class="code" href="classbdm_1_1emix.html#0f3db99f730bde6b7953931594537e8e" title="Compute log-probability of argument val.">evallog</a> ( val ) );}
+<a name="l00122"></a>00122                 <span class="keywordflow">if</span> ( sum==0.0 ) {sum=std::numeric_limits&lt;double&gt;::epsilon();}
+<a name="l00123"></a>00123                 <span class="keywordtype">double</span> tmp=log ( sum );
+<a name="l00124"></a>00124                 it_assert_debug ( std::isfinite ( tmp ),<span class="stringliteral">"Infinite"</span> );
+<a name="l00125"></a>00125                 <span class="keywordflow">return</span> tmp;
+<a name="l00126"></a>00126         };
+<a name="l00127"></a><a class="code" href="classbdm_1_1emix.html#23af1986e2afcbc8c7e1c30f610e703b">00127</a>         vec <a class="code" href="classbdm_1_1emix.html#23af1986e2afcbc8c7e1c30f610e703b" title="Compute log-probability of multiple values argument val.">evallog_m</a> ( <span class="keyword">const</span> mat &amp;Val )<span class="keyword"> const </span>{
+<a name="l00128"></a>00128                 vec x=zeros ( Val.cols() );
+<a name="l00129"></a>00129                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a>.length(); i++ ) {
+<a name="l00130"></a>00130                         x+= <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a> ( i ) *exp ( <a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a> ( i )-&gt;<a class="code" href="classbdm_1_1emix.html#23af1986e2afcbc8c7e1c30f610e703b" title="Compute log-probability of multiple values argument val.">evallog_m</a> ( Val ) );
+<a name="l00131"></a>00131                 }
+<a name="l00132"></a>00132                 <span class="keywordflow">return</span> log ( x );
+<a name="l00133"></a>00133         };
+<a name="l00135"></a><a class="code" href="classbdm_1_1emix.html#e64c1d5a73f541e469792e23d4677af2">00135</a>         mat <a class="code" href="classbdm_1_1emix.html#e64c1d5a73f541e469792e23d4677af2" title="Auxiliary function that returns pdflog for each component.">evallog_M</a> ( <span class="keyword">const</span> mat &amp;Val )<span class="keyword"> const </span>{
+<a name="l00136"></a>00136                 mat X ( <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a>.length(), Val.cols() );
+<a name="l00137"></a>00137                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i &lt; <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a>.length(); i++ ) {
+<a name="l00138"></a>00138                         X.set_row ( i, <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a> ( i ) *exp ( <a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a> ( i )-&gt;<a class="code" href="classbdm_1_1emix.html#23af1986e2afcbc8c7e1c30f610e703b" title="Compute log-probability of multiple values argument val.">evallog_m</a> ( Val ) ) );
+<a name="l00139"></a>00139                 }
+<a name="l00140"></a>00140                 <span class="keywordflow">return</span> X;
+<a name="l00141"></a>00141         };
+<a name="l00142"></a>00142 
+<a name="l00143"></a>00143         <a class="code" href="classbdm_1_1emix.html" title="Mixture of epdfs.">emix</a>* <a class="code" href="classbdm_1_1emix.html#f7165371cc4f7be9292024b9f5431646" title="Return marginal density on the given RV, the remainig rvs are intergrated out.">marginal</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a> ) <span class="keyword">const</span>;
+<a name="l00144"></a>00144         <a class="code" href="classbdm_1_1mratio.html" title="Class representing ratio of two densities which arise e.g. by applying the Bayes...">mratio</a>* <a class="code" href="classbdm_1_1emix.html#fc7772a2972959cf19ba26882feacecf" title="Return conditional density on the given RV, the remaining rvs will be in conditioning...">condition</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a> ) <span class="keyword">const</span>; <span class="comment">//why not mratio!!</span>
+<a name="l00145"></a>00145 
+<a name="l00146"></a>00146 <span class="comment">//Access methods</span>
+<a name="l00148"></a><a class="code" href="classbdm_1_1emix.html#d9b584cb5b2471a4250fb127757f28be">00148</a> <span class="comment"></span>        vec&amp; <a class="code" href="classbdm_1_1emix.html#d9b584cb5b2471a4250fb127757f28be" title="returns a pointer to the internal mean value. Use with Care!">_w</a>() {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1emix.html#bb7270345c76da627cd77ddf020bcf46" title="weights of the components">w</a>;}
+<a name="l00149"></a>00149         <span class="keyword">virtual</span> ~<a class="code" href="classbdm_1_1emix.html" title="Mixture of epdfs.">emix</a>() {<span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1emix.html#47189df41a4616c2fed5972f015743f4" title="Flag if owning Coms.">destroyComs</a> ) {<span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a>.length();i++ ) {<span class="keyword">delete</span> <a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a> ( i );}}}
+<a name="l00151"></a><a class="code" href="classbdm_1_1emix.html#965fb16669250a3d28bc62cf76276d8e">00151</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1emix.html#965fb16669250a3d28bc62cf76276d8e" title="Auxiliary function for taking ownership of the Coms().">ownComs</a>() {<a class="code" href="classbdm_1_1emix.html#47189df41a4616c2fed5972f015743f4" title="Flag if owning Coms.">destroyComs</a>=<span class="keyword">true</span>;}
+<a name="l00152"></a>00152 
+<a name="l00154"></a><a class="code" href="classbdm_1_1emix.html#578616445243674438257be99ba71612">00154</a>         <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1emix.html#578616445243674438257be99ba71612" title="access function">_Coms</a> ( <span class="keywordtype">int</span> i ) {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a> ( i );}
+<a name="l00155"></a><a class="code" href="classbdm_1_1emix.html#04a8632cfa9299ae937228eb732fd61e">00155</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1emix.html#04a8632cfa9299ae937228eb732fd61e" title="Name its rv.">set_rv</a>(<span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>){
+<a name="l00156"></a>00156                 <a class="code" href="classbdm_1_1emix.html#04a8632cfa9299ae937228eb732fd61e" title="Name its rv.">epdf::set_rv</a>(rv);
+<a name="l00157"></a>00157                 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a>.length();i++){<a class="code" href="classbdm_1_1emix.html#e2966a6a44b250e22e55bc9fb6af5c3e" title="Component (epdfs).">Coms</a>(i)-&gt;set_rv(rv);}
+<a name="l00158"></a>00158         }
+<a name="l00159"></a>00159 };
+<a name="l00160"></a>00160 
 <a name="l00161"></a>00161 
-<a name="l00162"></a>00162 
-<a name="l00167"></a><a class="code" href="classbdm_1_1egiwmix.html">00167</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1egiwmix.html" title="Mixture of egiws.">egiwmix</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1egiw.html" title="Gauss-inverse-Wishart density stored in LD form.">egiw</a> {
-<a name="l00168"></a>00168 <span class="keyword">protected</span>:
-<a name="l00170"></a><a class="code" href="classbdm_1_1egiwmix.html#2deb6d7cd689949b92450227de98afa4">00170</a>         vec <a class="code" href="classbdm_1_1egiwmix.html#2deb6d7cd689949b92450227de98afa4" title="weights of the components">w</a>;
-<a name="l00172"></a><a class="code" href="classbdm_1_1egiwmix.html#8d0a3acd6ced68349b8f9950f4658280">00172</a>         Array&lt;egiw*&gt; <a class="code" href="classbdm_1_1egiwmix.html#8d0a3acd6ced68349b8f9950f4658280" title="Component (epdfs).">Coms</a>;
-<a name="l00174"></a><a class="code" href="classbdm_1_1egiwmix.html#2a363169e5aa6c7cad1f4d7647fe9eec">00174</a>         <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1egiwmix.html#2a363169e5aa6c7cad1f4d7647fe9eec" title="Flag if owning Coms.">destroyComs</a>;
-<a name="l00175"></a>00175 <span class="keyword">public</span>:
-<a name="l00177"></a><a class="code" href="classbdm_1_1egiwmix.html#41f4cf7baf554e0a70bf495457179dbb">00177</a>         <a class="code" href="classbdm_1_1egiwmix.html#41f4cf7baf554e0a70bf495457179dbb" title="Default constructor.">egiwmix</a> ( ) : <a class="code" href="classbdm_1_1egiw.html" title="Gauss-inverse-Wishart density stored in LD form.">egiw</a> ( ) {};
-<a name="l00178"></a>00178 
-<a name="l00181"></a>00181         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1egiwmix.html#c4627222e22df6e14f8f1496e13c4975">set_parameters</a> ( <span class="keyword">const</span> vec &amp;<a class="code" href="classbdm_1_1egiwmix.html#2deb6d7cd689949b92450227de98afa4" title="weights of the components">w</a>, <span class="keyword">const</span> Array&lt;egiw*&gt; &amp;<a class="code" href="classbdm_1_1egiwmix.html#8d0a3acd6ced68349b8f9950f4658280" title="Component (epdfs).">Coms</a>, <span class="keywordtype">bool</span> copy=<span class="keyword">false</span> );
-<a name="l00182"></a>00182 
-<a name="l00184"></a>00184         vec <a class="code" href="classbdm_1_1egiwmix.html#74e7c77bd89a454a7fd984945c58df1c" title="return expected value">mean</a>() <span class="keyword">const</span>;
-<a name="l00185"></a>00185 
-<a name="l00187"></a>00187         vec <a class="code" href="classbdm_1_1egiwmix.html#8bd92fb4c94a46220e84d9a39ddd2e28" title="return a sample from the density">sample</a>() <span class="keyword">const</span>;
-<a name="l00188"></a>00188 
-<a name="l00190"></a>00190         vec <a class="code" href="classbdm_1_1egiwmix.html#96e1cfb7157b87f04e2957ca4d883425" title="return the expected variance">variance</a>() <span class="keyword">const</span>;
-<a name="l00191"></a>00191 
-<a name="l00192"></a>00192         <span class="comment">// TODO!!! Defined to follow ANSI and/or for future development</span>
-<a name="l00193"></a>00193         <span class="keywordtype">void</span> mean_mat ( mat &amp;M, mat&amp;R )<span class="keyword"> const </span>{};
-<a name="l00194"></a><a class="code" href="classbdm_1_1egiwmix.html#5713da45d66410382d6eca4e1b05a132">00194</a>         <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1egiwmix.html#5713da45d66410382d6eca4e1b05a132" title="In this instance, val= [theta, r]. For multivariate instances, it is stored columnwise...">evallog_nn</a> ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const </span>{<span class="keywordflow">return</span> 0;};
-<a name="l00195"></a><a class="code" href="classbdm_1_1egiwmix.html#7c9bc72ecea861dd2416f852905bf023">00195</a>         <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1egiwmix.html#7c9bc72ecea861dd2416f852905bf023" title="logarithm of the normalizing constant, ">lognc</a> ()<span class="keyword"> const </span>{<span class="keywordflow">return</span> 0;};
-<a name="l00196"></a>00196         <a class="code" href="classbdm_1_1emix.html" title="Mixture of epdfs.">emix</a>* <a class="code" href="classbdm_1_1egiwmix.html#93d5e0abb98256a2cf7b557098f3f8ec" title="Return marginal density on the given RV, the remainig rvs are intergrated out.">marginal</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a> ) <span class="keyword">const</span>;
-<a name="l00197"></a>00197 
-<a name="l00198"></a>00198 <span class="comment">//Access methods</span>
-<a name="l00200"></a><a class="code" href="classbdm_1_1egiwmix.html#884d203ca3994b9fba4c8bd440f355ea">00200</a> <span class="comment"></span>        vec&amp; <a class="code" href="classbdm_1_1egiwmix.html#884d203ca3994b9fba4c8bd440f355ea" title="returns a pointer to the internal mean value. Use with Care!">_w</a>() {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1egiwmix.html#2deb6d7cd689949b92450227de98afa4" title="weights of the components">w</a>;}
-<a name="l00201"></a>00201         <span class="keyword">virtual</span> ~<a class="code" href="classbdm_1_1egiwmix.html" title="Mixture of egiws.">egiwmix</a>() {<span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1egiwmix.html#2a363169e5aa6c7cad1f4d7647fe9eec" title="Flag if owning Coms.">destroyComs</a> ) {<span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1egiwmix.html#8d0a3acd6ced68349b8f9950f4658280" title="Component (epdfs).">Coms</a>.length();i++ ) {<span class="keyword">delete</span> <a class="code" href="classbdm_1_1egiwmix.html#8d0a3acd6ced68349b8f9950f4658280" title="Component (epdfs).">Coms</a> ( i );}}}
-<a name="l00203"></a><a class="code" href="classbdm_1_1egiwmix.html#adc550fe74df25524c20867e89b5b096">00203</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1egiwmix.html#adc550fe74df25524c20867e89b5b096" title="Auxiliary function for taking ownership of the Coms().">ownComs</a>() {<a class="code" href="classbdm_1_1egiwmix.html#2a363169e5aa6c7cad1f4d7647fe9eec" title="Flag if owning Coms.">destroyComs</a>=<span class="keyword">true</span>;}
-<a name="l00204"></a>00204 
-<a name="l00206"></a><a class="code" href="classbdm_1_1egiwmix.html#d20a56a7b129c1ea9f71725e15f8ad8c">00206</a>         <a class="code" href="classbdm_1_1egiw.html" title="Gauss-inverse-Wishart density stored in LD form.">egiw</a>* <a class="code" href="classbdm_1_1egiwmix.html#d20a56a7b129c1ea9f71725e15f8ad8c" title="access function">_Coms</a> ( <span class="keywordtype">int</span> i ) {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1egiwmix.html#8d0a3acd6ced68349b8f9950f4658280" title="Component (epdfs).">Coms</a> ( i );}
-<a name="l00207"></a>00207 
-<a name="l00208"></a><a class="code" href="classbdm_1_1egiwmix.html#dc999c5c1402c450200f22128db688b2">00208</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1egiwmix.html#dc999c5c1402c450200f22128db688b2" title="Name its rv.">set_rv</a>(<span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>){
-<a name="l00209"></a>00209                 <a class="code" href="classbdm_1_1egiwmix.html#dc999c5c1402c450200f22128db688b2" title="Name its rv.">egiw::set_rv</a>(rv);
-<a name="l00210"></a>00210                 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1egiwmix.html#8d0a3acd6ced68349b8f9950f4658280" title="Component (epdfs).">Coms</a>.length();i++){<a class="code" href="classbdm_1_1egiwmix.html#8d0a3acd6ced68349b8f9950f4658280" title="Component (epdfs).">Coms</a>(i)-&gt;set_rv(rv);}
-<a name="l00211"></a>00211         }
-<a name="l00212"></a>00212 
-<a name="l00214"></a>00214         <a class="code" href="classbdm_1_1egiw.html" title="Gauss-inverse-Wishart density stored in LD form.">egiw</a>* <a class="code" href="classbdm_1_1egiwmix.html#10894d50e82130cc5b93d3cbc30b2e4d" title="Approximation of a GiW mix by a single GiW pdf.">approx</a>();
-<a name="l00215"></a>00215 };
-<a name="l00216"></a>00216 
-<a name="l00225"></a><a class="code" href="classbdm_1_1mprod.html">00225</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1mprod.html" title="Chain rule decomposition of epdf.">mprod</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1compositepdf.html" title="Chain rule of pdfs - abstract part common for mprod and merger. this abstract class...">compositepdf</a>, <span class="keyword">public</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> {
-<a name="l00226"></a>00226 <span class="keyword">protected</span>:
-<a name="l00228"></a><a class="code" href="classbdm_1_1mprod.html#eca722ed1b219727c6c0f8cbc6bf1e51">00228</a>         Array&lt;epdf*&gt; <a class="code" href="classbdm_1_1mprod.html#eca722ed1b219727c6c0f8cbc6bf1e51" title="pointers to epdfs - shortcut to mpdfs().posterior()">epdfs</a>;
-<a name="l00230"></a><a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f">00230</a>         Array&lt;datalink_m2m*&gt; <a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f" title="Data link for each mpdfs.">dls</a>;
-<a name="l00232"></a><a class="code" href="classbdm_1_1mprod.html#e3fe66c257e5eca9de1031ef44907677">00232</a>         <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> <a class="code" href="classbdm_1_1mprod.html#e3fe66c257e5eca9de1031ef44907677" title="dummy ep">dummy</a>;
-<a name="l00233"></a>00233 <span class="keyword">public</span>:
-<a name="l00236"></a><a class="code" href="classbdm_1_1mprod.html#fed864cdd0e724d9133e6c6bfcacf94b">00236</a>         <a class="code" href="classbdm_1_1mprod.html#fed864cdd0e724d9133e6c6bfcacf94b" title="Constructor from list of mFacs,.">mprod</a> (){};
-<a name="l00237"></a>00237         <a class="code" href="classbdm_1_1mprod.html#fed864cdd0e724d9133e6c6bfcacf94b" title="Constructor from list of mFacs,.">mprod</a> (Array&lt;mpdf*&gt; mFacs ){set_elements( mFacs );};
-<a name="l00238"></a>00238         <span class="keywordtype">void</span> set_elements(Array&lt;mpdf*&gt; mFacs ) {
-<a name="l00239"></a>00239                 
-<a name="l00240"></a>00240                 set_elements(mFacs);
-<a name="l00241"></a>00241                 
-<a name="l00242"></a>00242                 <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>=&amp;<a class="code" href="classbdm_1_1mprod.html#e3fe66c257e5eca9de1031ef44907677" title="dummy ep">dummy</a>;
-<a name="l00243"></a>00243                 RV rv=<a class="code" href="classbdm_1_1compositepdf.html#c73d39acc4378eee6a63155c3517d3c9" title="find common rv, flag">getrv</a> ( <span class="keyword">true</span> );
-<a name="l00244"></a>00244                 set_rv ( rv );<a class="code" href="classbdm_1_1mprod.html#e3fe66c257e5eca9de1031ef44907677" title="dummy ep">dummy</a>.set_parameters ( rv._dsize() );
-<a name="l00245"></a>00245                 <a class="code" href="classbdm_1_1compositepdf.html#c71fc2c51f49d797e61f479f543c75ce" title="common rvc of all mpdfs is written to rvc">setrvc</a> ( <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-&gt;_rv(),<a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a> );
-<a name="l00246"></a>00246                 <span class="comment">// rv and rvc established = &gt; we can link them with mpdfs</span>
-<a name="l00247"></a>00247                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0;i &lt; <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a>.length(); i++ ) {
-<a name="l00248"></a>00248                         <a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f" title="Data link for each mpdfs.">dls</a> ( i ) = <span class="keyword">new</span> datalink_m2m;
-<a name="l00249"></a>00249                         <a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f" title="Data link for each mpdfs.">dls</a>(i)-&gt;set_connection( <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a> ( i )-&gt;_rv(), <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a> ( i )-&gt;_rvc(), _rv(), _rvc() );
-<a name="l00250"></a>00250                 }
-<a name="l00251"></a>00251 
-<a name="l00252"></a>00252                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0; i&lt;<a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a>.length(); i++ ) {
-<a name="l00253"></a>00253                         <a class="code" href="classbdm_1_1mprod.html#eca722ed1b219727c6c0f8cbc6bf1e51" title="pointers to epdfs - shortcut to mpdfs().posterior()">epdfs</a> ( i ) =&amp; ( <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a> ( i )-&gt;_epdf() );
-<a name="l00254"></a>00254                 }
-<a name="l00255"></a>00255         };
-<a name="l00256"></a>00256 
-<a name="l00257"></a><a class="code" href="classbdm_1_1mprod.html#800f21d94c919137608a2fd5c88719e2">00257</a>         <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1mprod.html#800f21d94c919137608a2fd5c88719e2" title="Shortcut for conditioning and evaluation of the internal epdf. In some cases, this...">evallogcond</a> ( <span class="keyword">const</span> vec &amp;val, <span class="keyword">const</span> vec &amp;cond ) {
-<a name="l00258"></a>00258                 <span class="keywordtype">int</span> i;
-<a name="l00259"></a>00259                 <span class="keywordtype">double</span> res = 0.0;
-<a name="l00260"></a>00260                 <span class="keywordflow">for</span> ( i = <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a>.length() - 1;i &gt;= 0;i-- ) {
-<a name="l00261"></a>00261                         <span class="comment">/*                      if ( mpdfs(i)-&gt;_rvc().count() &gt;0) {</span>
-<a name="l00262"></a>00262 <span class="comment">                                                        mpdfs ( i )-&gt;condition ( dls ( i )-&gt;get_cond ( val,cond ) );</span>
-<a name="l00263"></a>00263 <span class="comment">                                                }</span>
-<a name="l00264"></a>00264 <span class="comment">                                                // add logarithms</span>
-<a name="l00265"></a>00265 <span class="comment">                                                res += epdfs ( i )-&gt;evallog ( dls ( i )-&gt;pushdown ( val ) );*/</span>
-<a name="l00266"></a>00266                         res += <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a> ( i )-&gt;evallogcond (
-<a name="l00267"></a>00267                                    <a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f" title="Data link for each mpdfs.">dls</a> ( i )-&gt;pushdown ( val ),
-<a name="l00268"></a>00268                                    <a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f" title="Data link for each mpdfs.">dls</a> ( i )-&gt;get_cond ( val, cond )
-<a name="l00269"></a>00269                                );
-<a name="l00270"></a>00270                 }
-<a name="l00271"></a>00271                 <span class="keywordflow">return</span> res;
-<a name="l00272"></a>00272         }
-<a name="l00273"></a>00273         <span class="comment">//TODO smarter...</span>
-<a name="l00274"></a><a class="code" href="classbdm_1_1mprod.html#ee715a8013acf9892f6cb489db595555">00274</a>         vec <a class="code" href="classbdm_1_1mprod.html#ee715a8013acf9892f6cb489db595555" title="Returns a sample from the density conditioned on cond, .">samplecond</a> ( <span class="keyword">const</span> vec &amp;cond ) {
-<a name="l00276"></a>00276                 vec smp= std::numeric_limits&lt;double&gt;::infinity() * ones ( <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-&gt;<a class="code" href="classbdm_1_1epdf.html#7083a65f7b7a0d0d13b2c516bd2ec29c" title="Size of the random variable.">dimension</a>() );
-<a name="l00277"></a>00277                 vec smpi;
-<a name="l00278"></a>00278                 <span class="comment">// Hard assumption here!!! We are going backwards, to assure that samples that are needed from smp are already generated!</span>
-<a name="l00279"></a>00279                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = ( <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a>.length() - 1 );i &gt;= 0;i-- ) {
-<a name="l00280"></a>00280                         <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a> ( i )-&gt;dimensionc() ) {
-<a name="l00281"></a>00281                                 <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a> ( i )-&gt;condition ( <a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f" title="Data link for each mpdfs.">dls</a> ( i )-&gt;get_cond ( smp ,cond ) ); <span class="comment">// smp is val here!!</span>
-<a name="l00282"></a>00282                         }
-<a name="l00283"></a>00283                         smpi = <a class="code" href="classbdm_1_1mprod.html#eca722ed1b219727c6c0f8cbc6bf1e51" title="pointers to epdfs - shortcut to mpdfs().posterior()">epdfs</a> ( i )-&gt;sample();
-<a name="l00284"></a>00284                         <span class="comment">// copy contribution of this pdf into smp</span>
-<a name="l00285"></a>00285                         <a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f" title="Data link for each mpdfs.">dls</a> ( i )-&gt;pushup ( smp, smpi );
-<a name="l00286"></a>00286                         <span class="comment">// add ith likelihood contribution</span>
-<a name="l00287"></a>00287                 }
-<a name="l00288"></a>00288                 <span class="keywordflow">return</span> smp;
-<a name="l00289"></a>00289         }
-<a name="l00290"></a>00290         mat <a class="code" href="classbdm_1_1mprod.html#ee715a8013acf9892f6cb489db595555" title="Returns a sample from the density conditioned on cond, .">samplecond</a> ( <span class="keyword">const</span> vec &amp;cond,  <span class="keywordtype">int</span> N ) {
-<a name="l00291"></a>00291                 mat Smp ( dimension(),N );
-<a name="l00292"></a>00292                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;N;i++ ) {Smp.set_col ( i,<a class="code" href="classbdm_1_1mprod.html#ee715a8013acf9892f6cb489db595555" title="Returns a sample from the density conditioned on cond, .">samplecond</a> ( cond ) );}
-<a name="l00293"></a>00293                 <span class="keywordflow">return</span> Smp;
-<a name="l00294"></a>00294         }
-<a name="l00295"></a>00295 
-<a name="l00296"></a>00296         ~<a class="code" href="classbdm_1_1mprod.html#fed864cdd0e724d9133e6c6bfcacf94b" title="Constructor from list of mFacs,.">mprod</a>() {};
-<a name="l00297"></a>00297 };
-<a name="l00298"></a>00298 
-<a name="l00300"></a><a class="code" href="classbdm_1_1eprod.html">00300</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1eprod.html" title="Product of independent epdfs. For dependent pdfs, use mprod.">eprod</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> {
-<a name="l00301"></a>00301 <span class="keyword">protected</span>:
-<a name="l00303"></a><a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391">00303</a>         Array&lt;const epdf*&gt; <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>;
-<a name="l00305"></a><a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43">00305</a>         Array&lt;datalink*&gt; <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a>;
-<a name="l00306"></a>00306 <span class="keyword">public</span>:
-<a name="l00307"></a>00307         <a class="code" href="classbdm_1_1eprod.html" title="Product of independent epdfs. For dependent pdfs, use mprod.">eprod</a> () : <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( 0 ),<a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( 0 ) {};
-<a name="l00308"></a>00308         <span class="keywordtype">void</span> set_parameters ( <span class="keyword">const</span> Array&lt;const epdf*&gt; &amp;epdfs0, <span class="keywordtype">bool</span> named=<span class="keyword">true</span> ) {
-<a name="l00309"></a>00309                 <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>=epdfs0;<span class="comment">//.set_length ( epdfs0.length() );</span>
-<a name="l00310"></a>00310                 <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a>.set_length ( <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length() );
-<a name="l00311"></a>00311 
-<a name="l00312"></a>00312                 <span class="keywordtype">bool</span> independent=<span class="keyword">true</span>;
-<a name="l00313"></a>00313                 <span class="keywordflow">if</span> ( named ) {
-<a name="l00314"></a>00314                         <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length();i++ ) {
-<a name="l00315"></a>00315                                 independent=rv.add ( <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;<a class="code" href="classbdm_1_1epdf.html#a4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>() );
-<a name="l00316"></a>00316                                 it_assert_debug ( independent==<span class="keyword">true</span>, <span class="stringliteral">"eprod:: given components are not independent."</span> );
-<a name="l00317"></a>00317                         }
-<a name="l00318"></a>00318                         <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>=rv._dsize();
-<a name="l00319"></a>00319                 }
-<a name="l00320"></a>00320                 <span class="keywordflow">else</span> {
-<a name="l00321"></a>00321                         <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> =0; <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length();i++ ) {
-<a name="l00322"></a>00322                                 <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>+=<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;dimension();
-<a name="l00323"></a>00323                         }
-<a name="l00324"></a>00324                 }
-<a name="l00325"></a>00325                 <span class="comment">//</span>
-<a name="l00326"></a>00326                 <span class="keywordtype">int</span> cumdim=0;
-<a name="l00327"></a>00327                 <span class="keywordtype">int</span> dimi=0;
-<a name="l00328"></a>00328                 <span class="keywordtype">int</span> i;
-<a name="l00329"></a>00329                 <span class="keywordflow">for</span> ( i=0;i&lt;<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length();i++ ) {
-<a name="l00330"></a>00330                         <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i ) = <span class="keyword">new</span> datalink;
-<a name="l00331"></a>00331                         <span class="keywordflow">if</span> ( named ) {<a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i )-&gt;set_connection ( <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;<a class="code" href="classbdm_1_1epdf.html#a4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>() , rv );}
-<a name="l00332"></a>00332                         <span class="keywordflow">else</span> {
-<a name="l00333"></a>00333                                 dimi = <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;dimension();
-<a name="l00334"></a>00334                                 <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i )-&gt;set_connection ( dimi, <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>, linspace ( cumdim,cumdim+dimi-1 ) );
-<a name="l00335"></a>00335                                 cumdim+=dimi;
-<a name="l00336"></a>00336                         }
-<a name="l00337"></a>00337                 }
-<a name="l00338"></a>00338         }
-<a name="l00339"></a>00339 
-<a name="l00340"></a><a class="code" href="classbdm_1_1eprod.html#1d494351e7e385ad3382387c96915d24">00340</a>         vec <a class="code" href="classbdm_1_1eprod.html#1d494351e7e385ad3382387c96915d24" title="return expected value">mean</a>()<span class="keyword"> const </span>{
-<a name="l00341"></a>00341                 vec tmp ( <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> );
-<a name="l00342"></a>00342                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length();i++ ) {
-<a name="l00343"></a>00343                         vec pom = <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;mean();
-<a name="l00344"></a>00344                         <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i )-&gt;pushup ( tmp, pom );
-<a name="l00345"></a>00345                 }
-<a name="l00346"></a>00346                 <span class="keywordflow">return</span> tmp;
-<a name="l00347"></a>00347         }
-<a name="l00348"></a><a class="code" href="classbdm_1_1eprod.html#cc53a151f5ac5dfba68d425acc3a5615">00348</a>         vec <a class="code" href="classbdm_1_1eprod.html#cc53a151f5ac5dfba68d425acc3a5615" title="return expected variance (not covariance!)">variance</a>()<span class="keyword"> const </span>{
-<a name="l00349"></a>00349                 vec tmp ( <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> ); <span class="comment">//second moment</span>
-<a name="l00350"></a>00350                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length();i++ ) {
-<a name="l00351"></a>00351                         vec pom = <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;mean();
-<a name="l00352"></a>00352                         <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i )-&gt;pushup ( tmp, pow ( pom,2 ) );
-<a name="l00353"></a>00353                 }
-<a name="l00354"></a>00354                 <span class="keywordflow">return</span> tmp-pow ( <a class="code" href="classbdm_1_1eprod.html#1d494351e7e385ad3382387c96915d24" title="return expected value">mean</a>(),2 );
-<a name="l00355"></a>00355         }
-<a name="l00356"></a><a class="code" href="classbdm_1_1eprod.html#af48debea25d3473bcb71b6a77fac741">00356</a>         vec <a class="code" href="classbdm_1_1eprod.html#af48debea25d3473bcb71b6a77fac741" title="Returns a sample,  from density .">sample</a>()<span class="keyword"> const </span>{
-<a name="l00357"></a>00357                 vec tmp ( <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> );
-<a name="l00358"></a>00358                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length();i++ ) {
-<a name="l00359"></a>00359                         vec pom = <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;sample();
-<a name="l00360"></a>00360                         <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i )-&gt;pushup ( tmp, pom );
-<a name="l00361"></a>00361                 }
-<a name="l00362"></a>00362                 <span class="keywordflow">return</span> tmp;
-<a name="l00363"></a>00363         }
-<a name="l00364"></a><a class="code" href="classbdm_1_1eprod.html#a5a91e67d2f74ff2b0b8eecde2fa42e2">00364</a>         <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1eprod.html#a5a91e67d2f74ff2b0b8eecde2fa42e2" title="Compute log-probability of argument val.">evallog</a> ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const </span>{
-<a name="l00365"></a>00365                 <span class="keywordtype">double</span> tmp=0;
-<a name="l00366"></a>00366                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length();i++ ) {
-<a name="l00367"></a>00367                         tmp+=<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;evallog ( <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i )-&gt;pushdown ( val ) );
-<a name="l00368"></a>00368                 }
-<a name="l00369"></a>00369                 it_assert_debug ( std::isfinite ( tmp ),<span class="stringliteral">"Infinite"</span> );
-<a name="l00370"></a>00370                 <span class="keywordflow">return</span> tmp;
-<a name="l00371"></a>00371         }
-<a name="l00373"></a><a class="code" href="classbdm_1_1eprod.html#5194b47dd05a5886e0745250b6704953">00373</a>         <span class="keyword">const</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1eprod.html#5194b47dd05a5886e0745250b6704953" title="access function">operator () </a>( <span class="keywordtype">int</span> i )<span class="keyword"> const </span>{it_assert_debug ( i&lt;<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length(),<span class="stringliteral">"wrong index"</span> );<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i );}
-<a name="l00374"></a>00374 
-<a name="l00376"></a><a class="code" href="classbdm_1_1eprod.html#708b37971aab3667f20e325c358632cf">00376</a>         <a class="code" href="classbdm_1_1eprod.html#708b37971aab3667f20e325c358632cf" title="Destructor.">~eprod</a>() {<span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length();i++ ) {<span class="keyword">delete</span> <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i );}}
-<a name="l00377"></a>00377 };
-<a name="l00378"></a>00378 
-<a name="l00379"></a>00379 
-<a name="l00383"></a><a class="code" href="classbdm_1_1mmix.html">00383</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1mmix.html" title="Mixture of mpdfs with constant weights, all mpdfs are of equal type.">mmix</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> {
-<a name="l00384"></a>00384 <span class="keyword">protected</span>:
-<a name="l00386"></a><a class="code" href="classbdm_1_1mmix.html#52e0bcc70d5b26babeba08097579da9c">00386</a>         Array&lt;mpdf*&gt; <a class="code" href="classbdm_1_1mmix.html#52e0bcc70d5b26babeba08097579da9c" title="Component (epdfs).">Coms</a>;
-<a name="l00388"></a><a class="code" href="classbdm_1_1mmix.html#0c4dd6ca6556ddd8ae3c5f3257c04b60">00388</a>         <a class="code" href="classbdm_1_1emix.html" title="Mixture of epdfs.">emix</a> <a class="code" href="classbdm_1_1mmix.html#0c4dd6ca6556ddd8ae3c5f3257c04b60" title="Internal epdf.">Epdf</a>;
-<a name="l00389"></a>00389 <span class="keyword">public</span>:
-<a name="l00391"></a><a class="code" href="classbdm_1_1mmix.html#a0cf51b7daeb6751103e94e6b96213fb">00391</a>         <a class="code" href="classbdm_1_1mmix.html#a0cf51b7daeb6751103e94e6b96213fb" title="Default constructor.">mmix</a> ( ) : <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> ( ), <a class="code" href="classbdm_1_1mmix.html#0c4dd6ca6556ddd8ae3c5f3257c04b60" title="Internal epdf.">Epdf</a> () {<a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a> = &amp;<a class="code" href="classbdm_1_1mmix.html#0c4dd6ca6556ddd8ae3c5f3257c04b60" title="Internal epdf.">Epdf</a>;};
-<a name="l00393"></a><a class="code" href="classbdm_1_1mmix.html#ad8d9df36cb0ca093a29af0eca12da32">00393</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mmix.html#ad8d9df36cb0ca093a29af0eca12da32" title="Set weights w and components R.">set_parameters</a> ( <span class="keyword">const</span> vec &amp;w, <span class="keyword">const</span> Array&lt;mpdf*&gt; &amp;<a class="code" href="classbdm_1_1mmix.html#52e0bcc70d5b26babeba08097579da9c" title="Component (epdfs).">Coms</a> ) {
-<a name="l00394"></a>00394                 Array&lt;epdf*&gt; Eps ( Coms.length() );
-<a name="l00395"></a>00395 
-<a name="l00396"></a>00396                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0;i &lt; Coms.length();i++ ) {
-<a name="l00397"></a>00397                         Eps ( i ) = &amp; ( <a class="code" href="classbdm_1_1mmix.html#52e0bcc70d5b26babeba08097579da9c" title="Component (epdfs).">Coms</a> ( i )-&gt;_epdf() );
-<a name="l00398"></a>00398                 }
-<a name="l00399"></a>00399                 <a class="code" href="classbdm_1_1mmix.html#0c4dd6ca6556ddd8ae3c5f3257c04b60" title="Internal epdf.">Epdf</a>.<a class="code" href="classbdm_1_1emix.html#3a107a6b808a081389ef17af951c234a">set_parameters</a> ( w, Eps );
-<a name="l00400"></a>00400         };
-<a name="l00401"></a>00401 
-<a name="l00402"></a><a class="code" href="classbdm_1_1mmix.html#0a5241ecc9911e816b00b92d5c7c8df0">00402</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mmix.html#0a5241ecc9911e816b00b92d5c7c8df0" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( <span class="keyword">const</span> vec &amp;cond ) {
-<a name="l00403"></a>00403                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0;i &lt; <a class="code" href="classbdm_1_1mmix.html#52e0bcc70d5b26babeba08097579da9c" title="Component (epdfs).">Coms</a>.length();i++ ) {<a class="code" href="classbdm_1_1mmix.html#52e0bcc70d5b26babeba08097579da9c" title="Component (epdfs).">Coms</a> ( i )-&gt;condition ( cond );}
-<a name="l00404"></a>00404         };
-<a name="l00405"></a>00405 };
+<a name="l00166"></a><a class="code" href="classbdm_1_1egiwmix.html">00166</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1egiwmix.html" title="Mixture of egiws.">egiwmix</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1egiw.html" title="Gauss-inverse-Wishart density stored in LD form.">egiw</a> {
+<a name="l00167"></a>00167 <span class="keyword">protected</span>:
+<a name="l00169"></a><a class="code" href="classbdm_1_1egiwmix.html#2deb6d7cd689949b92450227de98afa4">00169</a>         vec <a class="code" href="classbdm_1_1egiwmix.html#2deb6d7cd689949b92450227de98afa4" title="weights of the components">w</a>;
+<a name="l00171"></a><a class="code" href="classbdm_1_1egiwmix.html#8d0a3acd6ced68349b8f9950f4658280">00171</a>         Array&lt;egiw*&gt; <a class="code" href="classbdm_1_1egiwmix.html#8d0a3acd6ced68349b8f9950f4658280" title="Component (epdfs).">Coms</a>;
+<a name="l00173"></a><a class="code" href="classbdm_1_1egiwmix.html#2a363169e5aa6c7cad1f4d7647fe9eec">00173</a>         <span class="keywordtype">bool</span> <a class="code" href="classbdm_1_1egiwmix.html#2a363169e5aa6c7cad1f4d7647fe9eec" title="Flag if owning Coms.">destroyComs</a>;
+<a name="l00174"></a>00174 <span class="keyword">public</span>:
+<a name="l00176"></a><a class="code" href="classbdm_1_1egiwmix.html#41f4cf7baf554e0a70bf495457179dbb">00176</a>         <a class="code" href="classbdm_1_1egiwmix.html#41f4cf7baf554e0a70bf495457179dbb" title="Default constructor.">egiwmix</a> ( ) : <a class="code" href="classbdm_1_1egiw.html" title="Gauss-inverse-Wishart density stored in LD form.">egiw</a> ( ) {};
+<a name="l00177"></a>00177 
+<a name="l00180"></a>00180         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1egiwmix.html#c4627222e22df6e14f8f1496e13c4975">set_parameters</a> ( <span class="keyword">const</span> vec &amp;<a class="code" href="classbdm_1_1egiwmix.html#2deb6d7cd689949b92450227de98afa4" title="weights of the components">w</a>, <span class="keyword">const</span> Array&lt;egiw*&gt; &amp;<a class="code" href="classbdm_1_1egiwmix.html#8d0a3acd6ced68349b8f9950f4658280" title="Component (epdfs).">Coms</a>, <span class="keywordtype">bool</span> copy=<span class="keyword">false</span> );
+<a name="l00181"></a>00181 
+<a name="l00183"></a>00183         vec <a class="code" href="classbdm_1_1egiwmix.html#74e7c77bd89a454a7fd984945c58df1c" title="return expected value">mean</a>() <span class="keyword">const</span>;
+<a name="l00184"></a>00184 
+<a name="l00186"></a>00186         vec <a class="code" href="classbdm_1_1egiwmix.html#8bd92fb4c94a46220e84d9a39ddd2e28" title="return a sample from the density">sample</a>() <span class="keyword">const</span>;
+<a name="l00187"></a>00187 
+<a name="l00189"></a>00189         vec <a class="code" href="classbdm_1_1egiwmix.html#96e1cfb7157b87f04e2957ca4d883425" title="return the expected variance">variance</a>() <span class="keyword">const</span>;
+<a name="l00190"></a>00190 
+<a name="l00191"></a>00191         <span class="comment">// TODO!!! Defined to follow ANSI and/or for future development</span>
+<a name="l00192"></a>00192         <span class="keywordtype">void</span> mean_mat ( mat &amp;M, mat&amp;R )<span class="keyword"> const </span>{};
+<a name="l00193"></a><a class="code" href="classbdm_1_1egiwmix.html#5713da45d66410382d6eca4e1b05a132">00193</a>         <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1egiwmix.html#5713da45d66410382d6eca4e1b05a132" title="In this instance, val= [theta, r]. For multivariate instances, it is stored columnwise...">evallog_nn</a> ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const </span>{<span class="keywordflow">return</span> 0;};
+<a name="l00194"></a><a class="code" href="classbdm_1_1egiwmix.html#7c9bc72ecea861dd2416f852905bf023">00194</a>         <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1egiwmix.html#7c9bc72ecea861dd2416f852905bf023" title="logarithm of the normalizing constant, ">lognc</a> ()<span class="keyword"> const </span>{<span class="keywordflow">return</span> 0;};
+<a name="l00195"></a>00195         <a class="code" href="classbdm_1_1emix.html" title="Mixture of epdfs.">emix</a>* <a class="code" href="classbdm_1_1egiwmix.html#93d5e0abb98256a2cf7b557098f3f8ec" title="Return marginal density on the given RV, the remainig rvs are intergrated out.">marginal</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a> ) <span class="keyword">const</span>;
+<a name="l00196"></a>00196 
+<a name="l00197"></a>00197 <span class="comment">//Access methods</span>
+<a name="l00199"></a><a class="code" href="classbdm_1_1egiwmix.html#884d203ca3994b9fba4c8bd440f355ea">00199</a> <span class="comment"></span>        vec&amp; <a class="code" href="classbdm_1_1egiwmix.html#884d203ca3994b9fba4c8bd440f355ea" title="returns a pointer to the internal mean value. Use with Care!">_w</a>() {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1egiwmix.html#2deb6d7cd689949b92450227de98afa4" title="weights of the components">w</a>;}
+<a name="l00200"></a>00200         <span class="keyword">virtual</span> ~<a class="code" href="classbdm_1_1egiwmix.html" title="Mixture of egiws.">egiwmix</a>() {<span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1egiwmix.html#2a363169e5aa6c7cad1f4d7647fe9eec" title="Flag if owning Coms.">destroyComs</a> ) {<span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1egiwmix.html#8d0a3acd6ced68349b8f9950f4658280" title="Component (epdfs).">Coms</a>.length();i++ ) {<span class="keyword">delete</span> <a class="code" href="classbdm_1_1egiwmix.html#8d0a3acd6ced68349b8f9950f4658280" title="Component (epdfs).">Coms</a> ( i );}}}
+<a name="l00202"></a><a class="code" href="classbdm_1_1egiwmix.html#adc550fe74df25524c20867e89b5b096">00202</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1egiwmix.html#adc550fe74df25524c20867e89b5b096" title="Auxiliary function for taking ownership of the Coms().">ownComs</a>() {<a class="code" href="classbdm_1_1egiwmix.html#2a363169e5aa6c7cad1f4d7647fe9eec" title="Flag if owning Coms.">destroyComs</a>=<span class="keyword">true</span>;}
+<a name="l00203"></a>00203 
+<a name="l00205"></a><a class="code" href="classbdm_1_1egiwmix.html#d20a56a7b129c1ea9f71725e15f8ad8c">00205</a>         <a class="code" href="classbdm_1_1egiw.html" title="Gauss-inverse-Wishart density stored in LD form.">egiw</a>* <a class="code" href="classbdm_1_1egiwmix.html#d20a56a7b129c1ea9f71725e15f8ad8c" title="access function">_Coms</a> ( <span class="keywordtype">int</span> i ) {<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1egiwmix.html#8d0a3acd6ced68349b8f9950f4658280" title="Component (epdfs).">Coms</a> ( i );}
+<a name="l00206"></a>00206 
+<a name="l00207"></a><a class="code" href="classbdm_1_1egiwmix.html#dc999c5c1402c450200f22128db688b2">00207</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1egiwmix.html#dc999c5c1402c450200f22128db688b2" title="Name its rv.">set_rv</a>(<span class="keyword">const</span> <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>){
+<a name="l00208"></a>00208                 <a class="code" href="classbdm_1_1egiwmix.html#dc999c5c1402c450200f22128db688b2" title="Name its rv.">egiw::set_rv</a>(rv);
+<a name="l00209"></a>00209                 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1egiwmix.html#8d0a3acd6ced68349b8f9950f4658280" title="Component (epdfs).">Coms</a>.length();i++){<a class="code" href="classbdm_1_1egiwmix.html#8d0a3acd6ced68349b8f9950f4658280" title="Component (epdfs).">Coms</a>(i)-&gt;set_rv(rv);}
+<a name="l00210"></a>00210         }
+<a name="l00211"></a>00211 
+<a name="l00213"></a>00213         <a class="code" href="classbdm_1_1egiw.html" title="Gauss-inverse-Wishart density stored in LD form.">egiw</a>* <a class="code" href="classbdm_1_1egiwmix.html#10894d50e82130cc5b93d3cbc30b2e4d" title="Approximation of a GiW mix by a single GiW pdf.">approx</a>();
+<a name="l00214"></a>00214 };
+<a name="l00215"></a>00215 
+<a name="l00224"></a><a class="code" href="classbdm_1_1mprod.html">00224</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1mprod.html" title="Chain rule decomposition of epdf.">mprod</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1compositepdf.html" title="Chain rule of pdfs - abstract part common for mprod and merger. this abstract class...">compositepdf</a>, <span class="keyword">public</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> {
+<a name="l00225"></a>00225 <span class="keyword">protected</span>:
+<a name="l00227"></a><a class="code" href="classbdm_1_1mprod.html#eca722ed1b219727c6c0f8cbc6bf1e51">00227</a>         Array&lt;epdf*&gt; <a class="code" href="classbdm_1_1mprod.html#eca722ed1b219727c6c0f8cbc6bf1e51" title="pointers to epdfs - shortcut to mpdfs().posterior()">epdfs</a>;
+<a name="l00229"></a><a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f">00229</a>         Array&lt;datalink_m2m*&gt; <a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f" title="Data link for each mpdfs.">dls</a>;
+<a name="l00231"></a><a class="code" href="classbdm_1_1mprod.html#e3fe66c257e5eca9de1031ef44907677">00231</a>         <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> <a class="code" href="classbdm_1_1mprod.html#e3fe66c257e5eca9de1031ef44907677" title="dummy ep">dummy</a>;
+<a name="l00232"></a>00232 <span class="keyword">public</span>:
+<a name="l00235"></a><a class="code" href="classbdm_1_1mprod.html#fed864cdd0e724d9133e6c6bfcacf94b">00235</a>         <a class="code" href="classbdm_1_1mprod.html#fed864cdd0e724d9133e6c6bfcacf94b" title="Constructor from list of mFacs,.">mprod</a> (){};
+<a name="l00236"></a>00236         <a class="code" href="classbdm_1_1mprod.html#fed864cdd0e724d9133e6c6bfcacf94b" title="Constructor from list of mFacs,.">mprod</a> (Array&lt;mpdf*&gt; mFacs ){set_elements( mFacs );};
+<a name="l00237"></a>00237         <span class="keywordtype">void</span> set_elements(Array&lt;mpdf*&gt; mFacs , <span class="keywordtype">bool</span> own=<span class="keyword">false</span>) {
+<a name="l00238"></a>00238                 
+<a name="l00239"></a>00239                 compositepdf::set_elements(mFacs,own);
+<a name="l00240"></a>00240                 <a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f" title="Data link for each mpdfs.">dls</a>.set_size(mFacs.length());
+<a name="l00241"></a>00241                 <a class="code" href="classbdm_1_1mprod.html#eca722ed1b219727c6c0f8cbc6bf1e51" title="pointers to epdfs - shortcut to mpdfs().posterior()">epdfs</a>.set_size(mFacs.length());
+<a name="l00242"></a>00242                                 
+<a name="l00243"></a>00243                 <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>=&amp;<a class="code" href="classbdm_1_1mprod.html#e3fe66c257e5eca9de1031ef44907677" title="dummy ep">dummy</a>;
+<a name="l00244"></a>00244                 RV rv=<a class="code" href="classbdm_1_1compositepdf.html#c73d39acc4378eee6a63155c3517d3c9" title="find common rv, flag">getrv</a> ( <span class="keyword">true</span> );
+<a name="l00245"></a>00245                 set_rv ( rv );
+<a name="l00246"></a>00246                 <a class="code" href="classbdm_1_1mprod.html#e3fe66c257e5eca9de1031ef44907677" title="dummy ep">dummy</a>.set_parameters ( rv._dsize() );
+<a name="l00247"></a>00247                 <a class="code" href="classbdm_1_1compositepdf.html#c71fc2c51f49d797e61f479f543c75ce" title="common rvc of all mpdfs is written to rvc">setrvc</a> ( <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-&gt;_rv(),<a class="code" href="classbdm_1_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a> );
+<a name="l00248"></a>00248                 <span class="comment">// rv and rvc established = &gt; we can link them with mpdfs</span>
+<a name="l00249"></a>00249                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0;i &lt; <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a>.length(); i++ ) {
+<a name="l00250"></a>00250                         <a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f" title="Data link for each mpdfs.">dls</a> ( i ) = <span class="keyword">new</span> datalink_m2m;
+<a name="l00251"></a>00251                         <a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f" title="Data link for each mpdfs.">dls</a>(i)-&gt;set_connection( <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a> ( i )-&gt;_rv(), <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a> ( i )-&gt;_rvc(), _rv(), _rvc() );
+<a name="l00252"></a>00252                 }
+<a name="l00253"></a>00253 
+<a name="l00254"></a>00254                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0; i&lt;<a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a>.length(); i++ ) {
+<a name="l00255"></a>00255                         <a class="code" href="classbdm_1_1mprod.html#eca722ed1b219727c6c0f8cbc6bf1e51" title="pointers to epdfs - shortcut to mpdfs().posterior()">epdfs</a> ( i ) =&amp; ( <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a> ( i )-&gt;_epdf() );
+<a name="l00256"></a>00256                 }
+<a name="l00257"></a>00257         };
+<a name="l00258"></a>00258 
+<a name="l00259"></a><a class="code" href="classbdm_1_1mprod.html#800f21d94c919137608a2fd5c88719e2">00259</a>         <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1mprod.html#800f21d94c919137608a2fd5c88719e2" title="Shortcut for conditioning and evaluation of the internal epdf. In some cases, this...">evallogcond</a> ( <span class="keyword">const</span> vec &amp;val, <span class="keyword">const</span> vec &amp;cond ) {
+<a name="l00260"></a>00260                 <span class="keywordtype">int</span> i;
+<a name="l00261"></a>00261                 <span class="keywordtype">double</span> res = 0.0;
+<a name="l00262"></a>00262                 <span class="keywordflow">for</span> ( i = <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a>.length() - 1;i &gt;= 0;i-- ) {
+<a name="l00263"></a>00263                         <span class="comment">/*                      if ( mpdfs(i)-&gt;_rvc().count() &gt;0) {</span>
+<a name="l00264"></a>00264 <span class="comment">                                                        mpdfs ( i )-&gt;condition ( dls ( i )-&gt;get_cond ( val,cond ) );</span>
+<a name="l00265"></a>00265 <span class="comment">                                                }</span>
+<a name="l00266"></a>00266 <span class="comment">                                                // add logarithms</span>
+<a name="l00267"></a>00267 <span class="comment">                                                res += epdfs ( i )-&gt;evallog ( dls ( i )-&gt;pushdown ( val ) );*/</span>
+<a name="l00268"></a>00268                         res += <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a> ( i )-&gt;evallogcond (
+<a name="l00269"></a>00269                                    <a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f" title="Data link for each mpdfs.">dls</a> ( i )-&gt;pushdown ( val ),
+<a name="l00270"></a>00270                                    <a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f" title="Data link for each mpdfs.">dls</a> ( i )-&gt;get_cond ( val, cond )
+<a name="l00271"></a>00271                                );
+<a name="l00272"></a>00272                 }
+<a name="l00273"></a>00273                 <span class="keywordflow">return</span> res;
+<a name="l00274"></a>00274         }
+<a name="l00275"></a><a class="code" href="classbdm_1_1mprod.html#e27b359d2572abfa4cc7d8f947848dab">00275</a>         vec <a class="code" href="classbdm_1_1mprod.html#e27b359d2572abfa4cc7d8f947848dab" title="Matrix version of evallogcond.">evallogcond_m</a>(<span class="keyword">const</span> mat &amp;Dt, <span class="keyword">const</span> vec &amp;cond) {
+<a name="l00276"></a>00276                 vec tmp(Dt.cols());
+<a name="l00277"></a>00277                 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;Dt.cols(); i++){
+<a name="l00278"></a>00278                         tmp(i) = <a class="code" href="classbdm_1_1mprod.html#800f21d94c919137608a2fd5c88719e2" title="Shortcut for conditioning and evaluation of the internal epdf. In some cases, this...">evallogcond</a>(Dt.get_col(i),cond);
+<a name="l00279"></a>00279                 }
+<a name="l00280"></a>00280                 <span class="keywordflow">return</span> tmp;
+<a name="l00281"></a>00281         };
+<a name="l00282"></a><a class="code" href="classbdm_1_1mprod.html#e8cdde6056fe20551be1fa460841f5e2">00282</a>         vec <a class="code" href="classbdm_1_1mprod.html#e8cdde6056fe20551be1fa460841f5e2" title="Array&amp;lt;vec&amp;gt; version of evallogcond.">evallogcond_m</a>(<span class="keyword">const</span> Array&lt;vec&gt; &amp;Dt, <span class="keyword">const</span> vec &amp;cond) {
+<a name="l00283"></a>00283                 vec tmp(Dt.length());
+<a name="l00284"></a>00284                 <span class="keywordflow">for</span>(<span class="keywordtype">int</span> i=0;i&lt;Dt.length(); i++){
+<a name="l00285"></a>00285                         tmp(i) = <a class="code" href="classbdm_1_1mprod.html#800f21d94c919137608a2fd5c88719e2" title="Shortcut for conditioning and evaluation of the internal epdf. In some cases, this...">evallogcond</a>(Dt(i),cond);
+<a name="l00286"></a>00286                 }
+<a name="l00287"></a>00287                 <span class="keywordflow">return</span> tmp;             
+<a name="l00288"></a>00288         };
+<a name="l00289"></a>00289 
+<a name="l00290"></a>00290 
+<a name="l00291"></a>00291         <span class="comment">//TODO smarter...</span>
+<a name="l00292"></a><a class="code" href="classbdm_1_1mprod.html#ee715a8013acf9892f6cb489db595555">00292</a>         vec <a class="code" href="classbdm_1_1mprod.html#ee715a8013acf9892f6cb489db595555" title="Returns a sample from the density conditioned on cond, .">samplecond</a> ( <span class="keyword">const</span> vec &amp;cond ) {
+<a name="l00294"></a>00294                 vec smp= std::numeric_limits&lt;double&gt;::infinity() * ones ( <a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a>-&gt;<a class="code" href="classbdm_1_1epdf.html#7083a65f7b7a0d0d13b2c516bd2ec29c" title="Size of the random variable.">dimension</a>() );
+<a name="l00295"></a>00295                 vec smpi;
+<a name="l00296"></a>00296                 <span class="comment">// Hard assumption here!!! We are going backwards, to assure that samples that are needed from smp are already generated!</span>
+<a name="l00297"></a>00297                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = ( <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a>.length() - 1 );i &gt;= 0;i-- ) {
+<a name="l00298"></a>00298                         <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a> ( i )-&gt;dimensionc() ) {
+<a name="l00299"></a>00299                                 <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a> ( i )-&gt;condition ( <a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f" title="Data link for each mpdfs.">dls</a> ( i )-&gt;get_cond ( smp ,cond ) ); <span class="comment">// smp is val here!!</span>
+<a name="l00300"></a>00300                         }
+<a name="l00301"></a>00301                         smpi = <a class="code" href="classbdm_1_1mprod.html#eca722ed1b219727c6c0f8cbc6bf1e51" title="pointers to epdfs - shortcut to mpdfs().posterior()">epdfs</a> ( i )-&gt;sample();
+<a name="l00302"></a>00302                         <span class="comment">// copy contribution of this pdf into smp</span>
+<a name="l00303"></a>00303                         <a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f" title="Data link for each mpdfs.">dls</a> ( i )-&gt;pushup ( smp, smpi );
+<a name="l00304"></a>00304                         <span class="comment">// add ith likelihood contribution</span>
+<a name="l00305"></a>00305                 }
+<a name="l00306"></a>00306                 <span class="keywordflow">return</span> smp;
+<a name="l00307"></a>00307         }
+<a name="l00308"></a>00308         mat <a class="code" href="classbdm_1_1mprod.html#ee715a8013acf9892f6cb489db595555" title="Returns a sample from the density conditioned on cond, .">samplecond</a> ( <span class="keyword">const</span> vec &amp;cond,  <span class="keywordtype">int</span> N ) {
+<a name="l00309"></a>00309                 mat Smp ( dimension(),N );
+<a name="l00310"></a>00310                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;N;i++ ) {Smp.set_col ( i,<a class="code" href="classbdm_1_1mprod.html#ee715a8013acf9892f6cb489db595555" title="Returns a sample from the density conditioned on cond, .">samplecond</a> ( cond ) );}
+<a name="l00311"></a>00311                 <span class="keywordflow">return</span> Smp;
+<a name="l00312"></a>00312         }
+<a name="l00313"></a>00313 
+<a name="l00314"></a>00314         ~<a class="code" href="classbdm_1_1mprod.html#fed864cdd0e724d9133e6c6bfcacf94b" title="Constructor from list of mFacs,.">mprod</a>() {};
+<a name="l00322"></a><a class="code" href="classbdm_1_1mprod.html#bfa7478f8df1de6d8cd4c349db512831">00322</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mprod.html#bfa7478f8df1de6d8cd4c349db512831">from_setting</a>(<span class="keyword">const</span> Setting &amp;<span class="keyword">set</span>){
+<a name="l00323"></a>00323                 Array&lt;mpdf*&gt; Atmp; <span class="comment">//temporary Array</span>
+<a name="l00324"></a>00324                 UI::get(Atmp,<span class="keyword">set</span>, <span class="stringliteral">"mpdfs"</span>);
+<a name="l00325"></a>00325                 set_elements(Atmp,<span class="keyword">true</span>);
+<a name="l00326"></a>00326         }
+<a name="l00327"></a>00327         
+<a name="l00328"></a>00328 };
+<a name="l00329"></a>00329 UIREGISTER(mprod);
+<a name="l00330"></a>00330 
+<a name="l00332"></a><a class="code" href="classbdm_1_1eprod.html">00332</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1eprod.html" title="Product of independent epdfs. For dependent pdfs, use mprod.">eprod</a>: <span class="keyword">public</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> {
+<a name="l00333"></a>00333 <span class="keyword">protected</span>:
+<a name="l00335"></a><a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391">00335</a>         Array&lt;const epdf*&gt; <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>;
+<a name="l00337"></a><a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43">00337</a>         Array&lt;datalink*&gt; <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a>;
+<a name="l00338"></a>00338 <span class="keyword">public</span>:
+<a name="l00339"></a>00339         <a class="code" href="classbdm_1_1eprod.html" title="Product of independent epdfs. For dependent pdfs, use mprod.">eprod</a> () : <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( 0 ),<a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( 0 ) {};
+<a name="l00340"></a>00340         <span class="keywordtype">void</span> set_parameters ( <span class="keyword">const</span> Array&lt;const epdf*&gt; &amp;epdfs0, <span class="keywordtype">bool</span> named=<span class="keyword">true</span> ) {
+<a name="l00341"></a>00341                 <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>=epdfs0;<span class="comment">//.set_length ( epdfs0.length() );</span>
+<a name="l00342"></a>00342                 <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a>.set_length ( <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length() );
+<a name="l00343"></a>00343 
+<a name="l00344"></a>00344                 <span class="keywordtype">bool</span> independent=<span class="keyword">true</span>;
+<a name="l00345"></a>00345                 <span class="keywordflow">if</span> ( named ) {
+<a name="l00346"></a>00346                         <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length();i++ ) {
+<a name="l00347"></a>00347                                 independent=rv.add ( <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;<a class="code" href="classbdm_1_1epdf.html#a4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>() );
+<a name="l00348"></a>00348                                 it_assert_debug ( independent==<span class="keyword">true</span>, <span class="stringliteral">"eprod:: given components are not independent."</span> );
+<a name="l00349"></a>00349                         }
+<a name="l00350"></a>00350                         <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>=rv._dsize();
+<a name="l00351"></a>00351                 }
+<a name="l00352"></a>00352                 <span class="keywordflow">else</span> {
+<a name="l00353"></a>00353                         <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> =0; <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length();i++ ) {
+<a name="l00354"></a>00354                                 <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>+=<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;dimension();
+<a name="l00355"></a>00355                         }
+<a name="l00356"></a>00356                 }
+<a name="l00357"></a>00357                 <span class="comment">//</span>
+<a name="l00358"></a>00358                 <span class="keywordtype">int</span> cumdim=0;
+<a name="l00359"></a>00359                 <span class="keywordtype">int</span> dimi=0;
+<a name="l00360"></a>00360                 <span class="keywordtype">int</span> i;
+<a name="l00361"></a>00361                 <span class="keywordflow">for</span> ( i=0;i&lt;<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length();i++ ) {
+<a name="l00362"></a>00362                         <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i ) = <span class="keyword">new</span> datalink;
+<a name="l00363"></a>00363                         <span class="keywordflow">if</span> ( named ) {<a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i )-&gt;set_connection ( <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;<a class="code" href="classbdm_1_1epdf.html#a4ab378d5e004c3ff3e2d4e64f7bba21" title="Return name (fails when isnamed is false).">_rv</a>() , rv );}
+<a name="l00364"></a>00364                         <span class="keywordflow">else</span> {
+<a name="l00365"></a>00365                                 dimi = <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;dimension();
+<a name="l00366"></a>00366                                 <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i )-&gt;set_connection ( dimi, <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>, linspace ( cumdim,cumdim+dimi-1 ) );
+<a name="l00367"></a>00367                                 cumdim+=dimi;
+<a name="l00368"></a>00368                         }
+<a name="l00369"></a>00369                 }
+<a name="l00370"></a>00370         }
+<a name="l00371"></a>00371 
+<a name="l00372"></a><a class="code" href="classbdm_1_1eprod.html#1d494351e7e385ad3382387c96915d24">00372</a>         vec <a class="code" href="classbdm_1_1eprod.html#1d494351e7e385ad3382387c96915d24" title="return expected value">mean</a>()<span class="keyword"> const </span>{
+<a name="l00373"></a>00373                 vec tmp ( <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> );
+<a name="l00374"></a>00374                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length();i++ ) {
+<a name="l00375"></a>00375                         vec pom = <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;mean();
+<a name="l00376"></a>00376                         <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i )-&gt;pushup ( tmp, pom );
+<a name="l00377"></a>00377                 }
+<a name="l00378"></a>00378                 <span class="keywordflow">return</span> tmp;
+<a name="l00379"></a>00379         }
+<a name="l00380"></a><a class="code" href="classbdm_1_1eprod.html#cc53a151f5ac5dfba68d425acc3a5615">00380</a>         vec <a class="code" href="classbdm_1_1eprod.html#cc53a151f5ac5dfba68d425acc3a5615" title="return expected variance (not covariance!)">variance</a>()<span class="keyword"> const </span>{
+<a name="l00381"></a>00381                 vec tmp ( <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> ); <span class="comment">//second moment</span>
+<a name="l00382"></a>00382                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length();i++ ) {
+<a name="l00383"></a>00383                         vec pom = <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;mean();
+<a name="l00384"></a>00384                         <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i )-&gt;pushup ( tmp, pow ( pom,2 ) );
+<a name="l00385"></a>00385                 }
+<a name="l00386"></a>00386                 <span class="keywordflow">return</span> tmp-pow ( <a class="code" href="classbdm_1_1eprod.html#1d494351e7e385ad3382387c96915d24" title="return expected value">mean</a>(),2 );
+<a name="l00387"></a>00387         }
+<a name="l00388"></a><a class="code" href="classbdm_1_1eprod.html#af48debea25d3473bcb71b6a77fac741">00388</a>         vec <a class="code" href="classbdm_1_1eprod.html#af48debea25d3473bcb71b6a77fac741" title="Returns a sample,  from density .">sample</a>()<span class="keyword"> const </span>{
+<a name="l00389"></a>00389                 vec tmp ( <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> );
+<a name="l00390"></a>00390                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length();i++ ) {
+<a name="l00391"></a>00391                         vec pom = <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;sample();
+<a name="l00392"></a>00392                         <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i )-&gt;pushup ( tmp, pom );
+<a name="l00393"></a>00393                 }
+<a name="l00394"></a>00394                 <span class="keywordflow">return</span> tmp;
+<a name="l00395"></a>00395         }
+<a name="l00396"></a><a class="code" href="classbdm_1_1eprod.html#a5a91e67d2f74ff2b0b8eecde2fa42e2">00396</a>         <span class="keywordtype">double</span> <a class="code" href="classbdm_1_1eprod.html#a5a91e67d2f74ff2b0b8eecde2fa42e2" title="Compute log-probability of argument val.">evallog</a> ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const </span>{
+<a name="l00397"></a>00397                 <span class="keywordtype">double</span> tmp=0;
+<a name="l00398"></a>00398                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length();i++ ) {
+<a name="l00399"></a>00399                         tmp+=<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;evallog ( <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i )-&gt;pushdown ( val ) );
+<a name="l00400"></a>00400                 }
+<a name="l00401"></a>00401                 it_assert_debug ( std::isfinite ( tmp ),<span class="stringliteral">"Infinite"</span> );
+<a name="l00402"></a>00402                 <span class="keywordflow">return</span> tmp;
+<a name="l00403"></a>00403         }
+<a name="l00405"></a><a class="code" href="classbdm_1_1eprod.html#5194b47dd05a5886e0745250b6704953">00405</a>         <span class="keyword">const</span> <a class="code" href="classbdm_1_1epdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classbdm_1_1eprod.html#5194b47dd05a5886e0745250b6704953" title="access function">operator () </a>( <span class="keywordtype">int</span> i )<span class="keyword"> const </span>{it_assert_debug ( i&lt;<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length(),<span class="stringliteral">"wrong index"</span> );<span class="keywordflow">return</span> <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i );}
 <a name="l00406"></a>00406 
-<a name="l00407"></a>00407 }
-<a name="l00408"></a>00408 <span class="preprocessor">#endif //MX_H</span>
+<a name="l00408"></a><a class="code" href="classbdm_1_1eprod.html#708b37971aab3667f20e325c358632cf">00408</a>         <a class="code" href="classbdm_1_1eprod.html#708b37971aab3667f20e325c358632cf" title="Destructor.">~eprod</a>() {<span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>.length();i++ ) {<span class="keyword">delete</span> <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i );}}
+<a name="l00409"></a>00409 };
+<a name="l00410"></a>00410 
+<a name="l00411"></a>00411 
+<a name="l00415"></a><a class="code" href="classbdm_1_1mmix.html">00415</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1mmix.html" title="Mixture of mpdfs with constant weights, all mpdfs are of equal type.">mmix</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> {
+<a name="l00416"></a>00416 <span class="keyword">protected</span>:
+<a name="l00418"></a><a class="code" href="classbdm_1_1mmix.html#52e0bcc70d5b26babeba08097579da9c">00418</a>         Array&lt;mpdf*&gt; <a class="code" href="classbdm_1_1mmix.html#52e0bcc70d5b26babeba08097579da9c" title="Component (epdfs).">Coms</a>;
+<a name="l00420"></a><a class="code" href="classbdm_1_1mmix.html#0c4dd6ca6556ddd8ae3c5f3257c04b60">00420</a>         <a class="code" href="classbdm_1_1emix.html" title="Mixture of epdfs.">emix</a> <a class="code" href="classbdm_1_1mmix.html#0c4dd6ca6556ddd8ae3c5f3257c04b60" title="Internal epdf.">Epdf</a>;
+<a name="l00421"></a>00421 <span class="keyword">public</span>:
+<a name="l00423"></a><a class="code" href="classbdm_1_1mmix.html#a0cf51b7daeb6751103e94e6b96213fb">00423</a>         <a class="code" href="classbdm_1_1mmix.html#a0cf51b7daeb6751103e94e6b96213fb" title="Default constructor.">mmix</a> ( ) : <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> ( ), <a class="code" href="classbdm_1_1mmix.html#0c4dd6ca6556ddd8ae3c5f3257c04b60" title="Internal epdf.">Epdf</a> () {<a class="code" href="classbdm_1_1mpdf.html#5eea43c56d38e4441bfb30270db949c0" title="pointer to internal epdf">ep</a> = &amp;<a class="code" href="classbdm_1_1mmix.html#0c4dd6ca6556ddd8ae3c5f3257c04b60" title="Internal epdf.">Epdf</a>;};
+<a name="l00425"></a><a class="code" href="classbdm_1_1mmix.html#ad8d9df36cb0ca093a29af0eca12da32">00425</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mmix.html#ad8d9df36cb0ca093a29af0eca12da32" title="Set weights w and components R.">set_parameters</a> ( <span class="keyword">const</span> vec &amp;w, <span class="keyword">const</span> Array&lt;mpdf*&gt; &amp;<a class="code" href="classbdm_1_1mmix.html#52e0bcc70d5b26babeba08097579da9c" title="Component (epdfs).">Coms</a> ) {
+<a name="l00426"></a>00426                 Array&lt;epdf*&gt; Eps ( Coms.length() );
+<a name="l00427"></a>00427 
+<a name="l00428"></a>00428                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0;i &lt; Coms.length();i++ ) {
+<a name="l00429"></a>00429                         Eps ( i ) = &amp; ( <a class="code" href="classbdm_1_1mmix.html#52e0bcc70d5b26babeba08097579da9c" title="Component (epdfs).">Coms</a> ( i )-&gt;_epdf() );
+<a name="l00430"></a>00430                 }
+<a name="l00431"></a>00431                 <a class="code" href="classbdm_1_1mmix.html#0c4dd6ca6556ddd8ae3c5f3257c04b60" title="Internal epdf.">Epdf</a>.<a class="code" href="classbdm_1_1emix.html#3a107a6b808a081389ef17af951c234a">set_parameters</a> ( w, Eps );
+<a name="l00432"></a>00432         };
+<a name="l00433"></a>00433 
+<a name="l00434"></a><a class="code" href="classbdm_1_1mmix.html#0a5241ecc9911e816b00b92d5c7c8df0">00434</a>         <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1mmix.html#0a5241ecc9911e816b00b92d5c7c8df0" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( <span class="keyword">const</span> vec &amp;cond ) {
+<a name="l00435"></a>00435                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0;i &lt; <a class="code" href="classbdm_1_1mmix.html#52e0bcc70d5b26babeba08097579da9c" title="Component (epdfs).">Coms</a>.length();i++ ) {<a class="code" href="classbdm_1_1mmix.html#52e0bcc70d5b26babeba08097579da9c" title="Component (epdfs).">Coms</a> ( i )-&gt;condition ( cond );}
+<a name="l00436"></a>00436         };
+<a name="l00437"></a>00437 };
+<a name="l00438"></a>00438 
+<a name="l00439"></a>00439 }
+<a name="l00440"></a>00440 <span class="preprocessor">#endif //MX_H</span>
 </pre></div></div>
-<hr size="1"><address style="text-align: right;"><small>Generated on Wed Jun 17 14:13:28 2009 for mixpp by&nbsp;
+<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 23 19:52:49 2009 for mixpp by&nbsp;
 <a href="http://www.doxygen.org/index.html">
 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>
