Index: doc/html/emix_8h-source.html
===================================================================
--- doc/html/emix_8h-source.html (revision 375)
+++ doc/html/emix_8h-source.html (revision 380)
@@ -211,5 +211,5 @@
 <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="Abstract composition of pdfs, will be used for specific classes 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><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>;
@@ -217,161 +217,166 @@
 <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#680c3e2d95b116c7cfb227c7f2984525">00236</a>         <a class="code" href="classbdm_1_1mprod.html#680c3e2d95b116c7cfb227c7f2984525" title="Constructor from list of mFacs,.">mprod</a> ( Array&lt;mpdf*&gt; mFacs ) : <a class="code" href="classbdm_1_1compositepdf.html" title="Abstract composition of pdfs, will be used for specific classes this abstract class...">compositepdf</a> ( mFacs ), <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_1mprod.html#eca722ed1b219727c6c0f8cbc6bf1e51" title="pointers to epdfs - shortcut to mpdfs().posterior()">epdfs</a> ( <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a> ), <a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f" title="Data link for each mpdfs.">dls</a> ( <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a> ) {
-<a name="l00237"></a>00237                 <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="l00238"></a>00238                 <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> rv=<a class="code" href="classbdm_1_1compositepdf.html#c73d39acc4378eee6a63155c3517d3c9" title="find common rv, flag">getrv</a> ( <span class="keyword">true</span> );
-<a name="l00239"></a>00239                 set_rv ( rv );<a class="code" href="classbdm_1_1mprod.html#e3fe66c257e5eca9de1031ef44907677" title="dummy ep">dummy</a>.<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="l00240"></a>00240                 <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;<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_1mpdf.html#5a5f08950daa08b85b01ddf4e1c36288" title="random variable in condition">rvc</a> );
-<a name="l00241"></a>00241                 <span class="comment">// rv and rvc established = &gt; we can link them with mpdfs</span>
-<a name="l00242"></a>00242                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0;i &lt; <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a>;i++ ) {
-<a name="l00243"></a>00243                         <a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f" title="Data link for each mpdfs.">dls</a> ( i ) = <span class="keyword">new</span> <a class="code" href="classbdm_1_1datalink__m2m.html">datalink_m2m</a>;
-<a name="l00244"></a>00244                         <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="l00245"></a>00245                 }
-<a name="l00246"></a>00246 
-<a name="l00247"></a>00247                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;n;i++ ) {
-<a name="l00248"></a>00248                         <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="l00249"></a>00249                 }
-<a name="l00250"></a>00250         };
+<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><a class="code" href="classbdm_1_1mprod.html#800f21d94c919137608a2fd5c88719e2">00252</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="l00253"></a>00253                 <span class="keywordtype">int</span> i;
-<a name="l00254"></a>00254                 <span class="keywordtype">double</span> res = 0.0;
-<a name="l00255"></a>00255                 <span class="keywordflow">for</span> ( i = <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a> - 1;i &gt;= 0;i-- ) {
-<a name="l00256"></a>00256                         <span class="comment">/*                      if ( mpdfs(i)-&gt;_rvc().count() &gt;0) {</span>
-<a name="l00257"></a>00257 <span class="comment">                                                        mpdfs ( i )-&gt;condition ( dls ( i )-&gt;get_cond ( val,cond ) );</span>
-<a name="l00258"></a>00258 <span class="comment">                                                }</span>
-<a name="l00259"></a>00259 <span class="comment">                                                // add logarithms</span>
-<a name="l00260"></a>00260 <span class="comment">                                                res += epdfs ( i )-&gt;evallog ( dls ( i )-&gt;pushdown ( val ) );*/</span>
-<a name="l00261"></a>00261                         res += <a class="code" href="classbdm_1_1compositepdf.html#23faf2debc4dde10836393b8c665914a" title="Elements of composition.">mpdfs</a> ( i )-&gt;evallogcond (
-<a name="l00262"></a>00262                                    <a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f" title="Data link for each mpdfs.">dls</a> ( i )-&gt;pushdown ( val ),
-<a name="l00263"></a>00263                                    <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="l00264"></a>00264                                );
-<a name="l00265"></a>00265                 }
-<a name="l00266"></a>00266                 <span class="keywordflow">return</span> res;
-<a name="l00267"></a>00267         }
-<a name="l00268"></a>00268         <span class="comment">//TODO smarter...</span>
-<a name="l00269"></a><a class="code" href="classbdm_1_1mprod.html#ee715a8013acf9892f6cb489db595555">00269</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="l00271"></a>00271                 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="l00272"></a>00272                 vec smpi;
-<a name="l00273"></a>00273                 <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="l00274"></a>00274                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = ( <a class="code" href="classbdm_1_1compositepdf.html#7ca3cd8ed92a7154f5b9ff13b1e9d52a" title="Number of mpdfs in the composite.">n</a> - 1 );i &gt;= 0;i-- ) {
-<a name="l00275"></a>00275                         <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="l00276"></a>00276                                 <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="l00277"></a>00277                         }
-<a name="l00278"></a>00278                         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="l00279"></a>00279                         <span class="comment">// copy contribution of this pdf into smp</span>
-<a name="l00280"></a>00280                         <a class="code" href="classbdm_1_1mprod.html#acf679b3b1d48629c5a042d9ac0d973f" title="Data link for each mpdfs.">dls</a> ( i )-&gt;pushup ( smp, smpi );
-<a name="l00281"></a>00281                         <span class="comment">// add ith likelihood contribution</span>
-<a name="l00282"></a>00282                 }
-<a name="l00283"></a>00283                 <span class="keywordflow">return</span> smp;
-<a name="l00284"></a>00284         }
-<a name="l00285"></a>00285         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="l00286"></a>00286                 mat Smp ( dimension(),N );
-<a name="l00287"></a>00287                 <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="l00288"></a>00288                 <span class="keywordflow">return</span> Smp;
+<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 
-<a name="l00291"></a>00291         ~<a class="code" href="classbdm_1_1mprod.html#680c3e2d95b116c7cfb227c7f2984525" title="Constructor from list of mFacs,.">mprod</a>() {};
-<a name="l00292"></a>00292 };
-<a name="l00293"></a>00293 
-<a name="l00295"></a><a class="code" href="classbdm_1_1eprod.html">00295</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="l00296"></a>00296 <span class="keyword">protected</span>:
-<a name="l00298"></a><a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391">00298</a>         Array&lt;const epdf*&gt; <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a>;
-<a name="l00300"></a><a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43">00300</a>         Array&lt;datalink*&gt; <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a>;
-<a name="l00301"></a>00301 <span class="keyword">public</span>:
-<a name="l00302"></a>00302         <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="l00303"></a>00303         <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="l00304"></a>00304                 <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="l00305"></a>00305                 <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="l00306"></a>00306 
-<a name="l00307"></a>00307                 <span class="keywordtype">bool</span> independent=<span class="keyword">true</span>;
-<a name="l00308"></a>00308                 <span class="keywordflow">if</span> ( named ) {
-<a name="l00309"></a>00309                         <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="l00310"></a>00310                                 independent=<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>.<a class="code" href="classbdm_1_1RV.html#87841b5ee43997b79789c0c22047e224" title="Add (concat) another variable to the current one,.">add</a> ( <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="l00311"></a>00311                                 it_assert_debug ( independent==<span class="keyword">true</span>, <span class="stringliteral">"eprod:: given components are not independent."</span> );
-<a name="l00312"></a>00312                         }
-<a name="l00313"></a>00313                         <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a>=<a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a>._dsize();
-<a name="l00314"></a>00314                 }
-<a name="l00315"></a>00315                 <span class="keywordflow">else</span> {
-<a name="l00316"></a>00316                         <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="l00317"></a>00317                                 <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="l00318"></a>00318                         }
+<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="comment">//</span>
-<a name="l00321"></a>00321                 <span class="keywordtype">int</span> cumdim=0;
-<a name="l00322"></a>00322                 <span class="keywordtype">int</span> dimi=0;
-<a name="l00323"></a>00323                 <span class="keywordtype">int</span> i;
-<a name="l00324"></a>00324                 <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="l00325"></a>00325                         <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i ) = <span class="keyword">new</span> datalink;
-<a name="l00326"></a>00326                         <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>() , <a class="code" href="classbdm_1_1epdf.html#62c5b8ff71d9ebe6cd58d3c342eb1dc8" title="Description of the random variable.">rv</a> );}
-<a name="l00327"></a>00327                         <span class="keywordflow">else</span> {
-<a name="l00328"></a>00328                                 dimi = <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;dimension();
-<a name="l00329"></a>00329                                 <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="l00330"></a>00330                                 cumdim+=dimi;
-<a name="l00331"></a>00331                         }
-<a name="l00332"></a>00332                 }
-<a name="l00333"></a>00333         }
-<a name="l00334"></a>00334 
-<a name="l00335"></a><a class="code" href="classbdm_1_1eprod.html#1d494351e7e385ad3382387c96915d24">00335</a>         vec <a class="code" href="classbdm_1_1eprod.html#1d494351e7e385ad3382387c96915d24" title="return expected value">mean</a>()<span class="keyword"> const </span>{
-<a name="l00336"></a>00336                 vec tmp ( <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> );
-<a name="l00337"></a>00337                 <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="l00338"></a>00338                         vec pom = <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;mean();
-<a name="l00339"></a>00339                         <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i )-&gt;pushup ( tmp, pom );
-<a name="l00340"></a>00340                 }
-<a name="l00341"></a>00341                 <span class="keywordflow">return</span> tmp;
-<a name="l00342"></a>00342         }
-<a name="l00343"></a><a class="code" href="classbdm_1_1eprod.html#cc53a151f5ac5dfba68d425acc3a5615">00343</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="l00344"></a>00344                 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="l00345"></a>00345                 <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="l00346"></a>00346                         vec pom = <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;mean();
-<a name="l00347"></a>00347                         <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i )-&gt;pushup ( tmp, pow ( pom,2 ) );
-<a name="l00348"></a>00348                 }
-<a name="l00349"></a>00349                 <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="l00350"></a>00350         }
-<a name="l00351"></a><a class="code" href="classbdm_1_1eprod.html#af48debea25d3473bcb71b6a77fac741">00351</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="l00352"></a>00352                 vec tmp ( <a class="code" href="classbdm_1_1epdf.html#16adac20ec7fe07e1ea0b27d917788ce" title="dimension of the random variable">dim</a> );
-<a name="l00353"></a>00353                 <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                         vec pom = <a class="code" href="classbdm_1_1eprod.html#fa0b0981730f0a8339b9ff3e29d78391" title="Components (epdfs).">epdfs</a> ( i )-&gt;sample();
-<a name="l00355"></a>00355                         <a class="code" href="classbdm_1_1eprod.html#6b5a9be71a644f6009e7beda6c762a43" title="Array of indeces.">dls</a> ( i )-&gt;pushup ( tmp, pom );
-<a name="l00356"></a>00356                 }
-<a name="l00357"></a>00357                 <span class="keywordflow">return</span> tmp;
-<a name="l00358"></a>00358         }
-<a name="l00359"></a><a class="code" href="classbdm_1_1eprod.html#a5a91e67d2f74ff2b0b8eecde2fa42e2">00359</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="l00360"></a>00360                 <span class="keywordtype">double</span> tmp=0;
-<a name="l00361"></a>00361                 <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="l00362"></a>00362                         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="l00363"></a>00363                 }
-<a name="l00364"></a>00364                 it_assert_debug ( std::isfinite ( tmp ),<span class="stringliteral">"Infinite"</span> );
-<a name="l00365"></a>00365                 <span class="keywordflow">return</span> tmp;
-<a name="l00366"></a>00366         }
-<a name="l00368"></a><a class="code" href="classbdm_1_1eprod.html#5194b47dd05a5886e0745250b6704953">00368</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="l00369"></a>00369 
-<a name="l00371"></a><a class="code" href="classbdm_1_1eprod.html#708b37971aab3667f20e325c358632cf">00371</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="l00372"></a>00372 };
-<a name="l00373"></a>00373 
+<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="l00378"></a><a class="code" href="classbdm_1_1mmix.html">00378</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="l00379"></a>00379 <span class="keyword">protected</span>:
-<a name="l00381"></a><a class="code" href="classbdm_1_1mmix.html#52e0bcc70d5b26babeba08097579da9c">00381</a>         Array&lt;mpdf*&gt; <a class="code" href="classbdm_1_1mmix.html#52e0bcc70d5b26babeba08097579da9c" title="Component (epdfs).">Coms</a>;
-<a name="l00383"></a><a class="code" href="classbdm_1_1mmix.html#0c4dd6ca6556ddd8ae3c5f3257c04b60">00383</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="l00384"></a>00384 <span class="keyword">public</span>:
-<a name="l00386"></a><a class="code" href="classbdm_1_1mmix.html#a0cf51b7daeb6751103e94e6b96213fb">00386</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="l00388"></a><a class="code" href="classbdm_1_1mmix.html#ad8d9df36cb0ca093a29af0eca12da32">00388</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="l00389"></a>00389                 Array&lt;epdf*&gt; Eps ( Coms.length() );
-<a name="l00390"></a>00390 
-<a name="l00391"></a>00391                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0;i &lt; Coms.length();i++ ) {
-<a name="l00392"></a>00392                         Eps ( i ) = &amp; ( <a class="code" href="classbdm_1_1mmix.html#52e0bcc70d5b26babeba08097579da9c" title="Component (epdfs).">Coms</a> ( i )-&gt;_epdf() );
-<a name="l00393"></a>00393                 }
-<a name="l00394"></a>00394                 <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="l00395"></a>00395         };
-<a name="l00396"></a>00396 
-<a name="l00397"></a><a class="code" href="classbdm_1_1mmix.html#0a5241ecc9911e816b00b92d5c7c8df0">00397</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="l00398"></a>00398                 <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="l00399"></a>00399         };
-<a name="l00400"></a>00400 };
+<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>00402 }
-<a name="l00403"></a>00403 <span class="preprocessor">#endif //MX_H</span>
+<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="l00406"></a>00406 
+<a name="l00407"></a>00407 }
+<a name="l00408"></a>00408 <span class="preprocessor">#endif //MX_H</span>
 </pre></div></div>
-<hr size="1"><address style="text-align: right;"><small>Generated on Mon Jun 15 13:47:07 2009 for mixpp by&nbsp;
+<hr size="1"><address style="text-align: right;"><small>Generated on Wed Jun 17 14:13:28 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>
