Show
Ignore:
Timestamp:
12/18/08 20:38:46 (16 years ago)
Author:
smidl
Message:

doc

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • doc/html/libEF_8h-source.html

    r210 r219  
    1111      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li> 
    1212      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li> 
     13      <li><a href="modules.html"><span>Modules</span></a></li> 
    1314      <li><a href="annotated.html"><span>Classes</span></a></li> 
    1415      <li class="current"><a href="files.html"><span>Files</span></a></li> 
     
    3839<a name="l00044"></a>00044         <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classeEF.html#69e5680dac10375d62520d26c672477d" title="logarithm of the normalizing constant, ">lognc</a>() <span class="keyword">const</span> =0; 
    3940<a name="l00046"></a><a class="code" href="classeEF.html#a89bef8996410609004fa019b5b48964">00046</a>         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classeEF.html#a89bef8996410609004fa019b5b48964" title="TODO decide if it is really needed.">dupdate</a> ( mat &amp;v ) {it_error ( <span class="stringliteral">"Not implemented"</span> );}; 
    40 <a name="l00048"></a><a class="code" href="classeEF.html#48cdd33d0e20d1a1aa45683c956bc61c">00048</a>         <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classeEF.html#48cdd33d0e20d1a1aa45683c956bc61c" title="Evaluate normalized log-probability.">evalpdflog_nn</a> ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const</span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> 0.0;}; 
    41 <a name="l00050"></a><a class="code" href="classeEF.html#6466e8d4aa9dd64698ed288cbb1afc03">00050</a>         <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classeEF.html#6466e8d4aa9dd64698ed288cbb1afc03" title="Evaluate normalized log-probability.">evalpdflog</a> ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const </span>{<span class="keywordtype">double</span> tmp;tmp= <a class="code" href="classeEF.html#48cdd33d0e20d1a1aa45683c956bc61c" title="Evaluate normalized log-probability.">evalpdflog_nn</a> ( val )-<a class="code" href="classeEF.html#69e5680dac10375d62520d26c672477d" title="logarithm of the normalizing constant, ">lognc</a>();it_assert_debug(std::isfinite(tmp),<span class="stringliteral">"why?"</span>); <span class="keywordflow">return</span> tmp;} 
    42 <a name="l00052"></a><a class="code" href="classeEF.html#c71faf4b2d153efda14bf1f87dca1507">00052</a>         <span class="keyword">virtual</span> vec <a class="code" href="classeEF.html#6466e8d4aa9dd64698ed288cbb1afc03" title="Evaluate normalized log-probability.">evalpdflog</a> ( <span class="keyword">const</span> mat &amp;Val )<span class="keyword"> const </span>{ 
     41<a name="l00048"></a><a class="code" href="classeEF.html#41c70565b4d3fb424599817d008f0c71">00048</a>         <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classeEF.html#41c70565b4d3fb424599817d008f0c71" title="Evaluate normalized log-probability.">evallog_nn</a> ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const</span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> 0.0;}; 
     42<a name="l00050"></a><a class="code" href="classeEF.html#357512dd565e199904d367294b7dd862">00050</a>         <span class="keyword">virtual</span> <span class="keywordtype">double</span> <a class="code" href="classeEF.html#357512dd565e199904d367294b7dd862" title="Evaluate normalized log-probability.">evallog</a> ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const </span>{<span class="keywordtype">double</span> tmp;tmp= <a class="code" href="classeEF.html#41c70565b4d3fb424599817d008f0c71" title="Evaluate normalized log-probability.">evallog_nn</a> ( val )-<a class="code" href="classeEF.html#69e5680dac10375d62520d26c672477d" title="logarithm of the normalizing constant, ">lognc</a>();it_assert_debug(std::isfinite(tmp),<span class="stringliteral">"Infinite value"</span>); <span class="keywordflow">return</span> tmp;} 
     43<a name="l00052"></a><a class="code" href="classeEF.html#cff03a658aec11b806c3e3d48f37b81f">00052</a>         <span class="keyword">virtual</span> vec <a class="code" href="classeEF.html#357512dd565e199904d367294b7dd862" title="Evaluate normalized log-probability.">evallog</a> ( <span class="keyword">const</span> mat &amp;Val )<span class="keyword"> const </span>{ 
    4344<a name="l00053"></a>00053                 vec x ( Val.cols() ); 
    44 <a name="l00054"></a>00054                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;Val.cols();i++ ) {x ( i ) =<a class="code" href="classeEF.html#48cdd33d0e20d1a1aa45683c956bc61c" title="Evaluate normalized log-probability.">evalpdflog_nn</a> ( Val.get_col ( i ) ) ;} 
     45<a name="l00054"></a>00054                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;Val.cols();i++ ) {x ( i ) =<a class="code" href="classeEF.html#41c70565b4d3fb424599817d008f0c71" title="Evaluate normalized log-probability.">evallog_nn</a> ( Val.get_col ( i ) ) ;} 
    4546<a name="l00055"></a>00055                 <span class="keywordflow">return</span> x-<a class="code" href="classeEF.html#69e5680dac10375d62520d26c672477d" title="logarithm of the normalizing constant, ">lognc</a>(); 
    4647<a name="l00056"></a>00056         } 
     
    8889<a name="l00127"></a>00127         vec <a class="code" href="classenorm.html#60b47544f6181ffd4530d3e415ce12c5" title="Returns a sample,  from density .">sample</a>() <span class="keyword">const</span>; 
    8990<a name="l00129"></a>00129         mat <a class="code" href="classenorm.html#60b47544f6181ffd4530d3e415ce12c5" title="Returns a sample,  from density .">sample</a> ( <span class="keywordtype">int</span> N ) <span class="keyword">const</span>; 
    90 <a name="l00130"></a>00130         <span class="keywordtype">double</span> eval ( <span class="keyword">const</span> vec &amp;val ) <span class="keyword">const</span> ; 
    91 <a name="l00131"></a>00131         <span class="keywordtype">double</span> <a class="code" href="classenorm.html#c1e3dcba256b0153cfdb286120e110be" title="Evaluate normalized log-probability.">evalpdflog_nn</a> ( <span class="keyword">const</span> vec &amp;val ) <span class="keyword">const</span>; 
     91<a name="l00130"></a>00130 <span class="comment">//      double eval ( const vec &amp;val ) const ;</span> 
     92<a name="l00131"></a>00131         <span class="keywordtype">double</span> <a class="code" href="classenorm.html#50cb0a083d97a7adbbd97c92e712c46c" title="Evaluate normalized log-probability.">evallog_nn</a> ( <span class="keyword">const</span> vec &amp;val ) <span class="keyword">const</span>; 
    9293<a name="l00132"></a>00132         <span class="keywordtype">double</span> <a class="code" href="classenorm.html#b289a36a69db59d182bb6eba9c05d4a8" title="logarithm of the normalizing constant, ">lognc</a> () <span class="keyword">const</span>; 
    9394<a name="l00133"></a><a class="code" href="classenorm.html#50fa84da7bae02f7af17a98f37566899">00133</a>         vec <a class="code" href="classenorm.html#50fa84da7bae02f7af17a98f37566899" title="return expected value">mean</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a>;} 
     
    102103<a name="l00144"></a>00144  
    103104<a name="l00146"></a><a class="code" href="classenorm.html#7a5034b25771a84450a990d10fc40ac9">00146</a>         sq_T&amp; <a class="code" href="classenorm.html#7a5034b25771a84450a990d10fc40ac9" title="returns pointers to the internal variance and its inverse. Use with Care!">_R</a>() {<span class="keywordflow">return</span> <a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>;} 
    104 <a name="l00147"></a>00147  
    105 <a name="l00149"></a>00149 <span class="comment">//      mat getR () {return R.to_mat();}</span> 
    106 <a name="l00150"></a>00150 }; 
    107 <a name="l00151"></a>00151  
    108 <a name="l00158"></a><a class="code" href="classegiw.html">00158</a> <span class="keyword">class </span><a class="code" href="classegiw.html" title="Gauss-inverse-Wishart density stored in LD form.">egiw</a> : <span class="keyword">public</span> <a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> { 
    109 <a name="l00159"></a>00159 <span class="keyword">protected</span>: 
    110 <a name="l00161"></a><a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442">00161</a>         <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> <a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>; 
    111 <a name="l00163"></a><a class="code" href="classegiw.html#4a2f130b91afe84f6d62fed289d5d453">00163</a>         <span class="keywordtype">double</span> <a class="code" href="classegiw.html#4a2f130b91afe84f6d62fed289d5d453" title="Number of data records (degrees of freedom) of sufficient statistics.">nu</a>; 
    112 <a name="l00165"></a><a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e">00165</a>         <span class="keywordtype">int</span> <a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e" title="Dimension of the output.">xdim</a>; 
    113 <a name="l00167"></a><a class="code" href="classegiw.html#c70d13d86e0d9f0acede3e1dc0368812">00167</a>         <span class="keywordtype">int</span> <a class="code" href="classegiw.html#c70d13d86e0d9f0acede3e1dc0368812" title="Dimension of the regressor.">nPsi</a>; 
    114 <a name="l00168"></a>00168 <span class="keyword">public</span>: 
    115 <a name="l00170"></a><a class="code" href="classegiw.html#056c094f01ca1cc308d72162f47617c9">00170</a>         <a class="code" href="classegiw.html#056c094f01ca1cc308d72162f47617c9" title="Default constructor, if nu0&amp;lt;0 a minimal nu0 will be computed.">egiw</a> ( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>, mat V0, <span class="keywordtype">double</span> nu0=-1.0 ) : <a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> ( rv ), <a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a> ( V0 ), <a class="code" href="classegiw.html#4a2f130b91afe84f6d62fed289d5d453" title="Number of data records (degrees of freedom) of sufficient statistics.">nu</a> ( nu0 ) { 
    116 <a name="l00171"></a>00171                 <a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e" title="Dimension of the output.">xdim</a> = rv.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() /<a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>.<a class="code" href="classldmat.html#96dfb21865db4f5bd36fa70f9b0b1163" title="access function">rows</a>(); 
    117 <a name="l00172"></a>00172                 it_assert_debug ( rv.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ==<a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e" title="Dimension of the output.">xdim</a>*<a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>.<a class="code" href="classldmat.html#96dfb21865db4f5bd36fa70f9b0b1163" title="access function">rows</a>(),<span class="stringliteral">"Incompatible V0."</span> ); 
    118 <a name="l00173"></a>00173                 <a class="code" href="classegiw.html#c70d13d86e0d9f0acede3e1dc0368812" title="Dimension of the regressor.">nPsi</a> = <a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>.<a class="code" href="classldmat.html#96dfb21865db4f5bd36fa70f9b0b1163" title="access function">rows</a>()-<a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e" title="Dimension of the output.">xdim</a>; 
    119 <a name="l00174"></a>00174                 <span class="comment">//set mu to have proper normalization and </span> 
    120 <a name="l00175"></a>00175                 <span class="keywordflow">if</span> (nu0&lt;0){ 
    121 <a name="l00176"></a>00176                         <a class="code" href="classegiw.html#4a2f130b91afe84f6d62fed289d5d453" title="Number of data records (degrees of freedom) of sufficient statistics.">nu</a> = 0.1 +nPsi +2*<a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e" title="Dimension of the output.">xdim</a> +2; <span class="comment">// +2 assures finite expected value of R</span> 
    122 <a name="l00177"></a>00177                         <span class="comment">// terms before that are sufficient for finite normalization</span> 
    123 <a name="l00178"></a>00178                 } 
    124 <a name="l00179"></a>00179         } 
    125 <a name="l00181"></a><a class="code" href="classegiw.html#18c1bf6125652a6dcbca68dd02dddd8d">00181</a>         <a class="code" href="classegiw.html#056c094f01ca1cc308d72162f47617c9" title="Default constructor, if nu0&amp;lt;0 a minimal nu0 will be computed.">egiw</a> ( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>, <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> V0, <span class="keywordtype">double</span> nu0=-1.0 ) : <a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> ( rv ), <a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a> ( V0 ), <a class="code" href="classegiw.html#4a2f130b91afe84f6d62fed289d5d453" title="Number of data records (degrees of freedom) of sufficient statistics.">nu</a> ( nu0 ) { 
    126 <a name="l00182"></a>00182                 <a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e" title="Dimension of the output.">xdim</a> = rv.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() /<a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>.<a class="code" href="classldmat.html#96dfb21865db4f5bd36fa70f9b0b1163" title="access function">rows</a>(); 
    127 <a name="l00183"></a>00183                 it_assert_debug ( rv.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ==<a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e" title="Dimension of the output.">xdim</a>*<a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>.<a class="code" href="classldmat.html#96dfb21865db4f5bd36fa70f9b0b1163" title="access function">rows</a>(),<span class="stringliteral">"Incompatible V0."</span> ); 
    128 <a name="l00184"></a>00184                 <a class="code" href="classegiw.html#c70d13d86e0d9f0acede3e1dc0368812" title="Dimension of the regressor.">nPsi</a> = <a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>.<a class="code" href="classldmat.html#96dfb21865db4f5bd36fa70f9b0b1163" title="access function">rows</a>()-<a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e" title="Dimension of the output.">xdim</a>; 
    129 <a name="l00185"></a>00185                 <span class="keywordflow">if</span> (nu0&lt;0){ 
    130 <a name="l00186"></a>00186                         <a class="code" href="classegiw.html#4a2f130b91afe84f6d62fed289d5d453" title="Number of data records (degrees of freedom) of sufficient statistics.">nu</a> = 0.1 +nPsi +2*<a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e" title="Dimension of the output.">xdim</a> +2; <span class="comment">// +2 assures finite expected value of R</span> 
    131 <a name="l00187"></a>00187                         <span class="comment">// terms before that are sufficient for finite normalization</span> 
    132 <a name="l00188"></a>00188                 } 
    133 <a name="l00189"></a>00189         } 
    134 <a name="l00190"></a>00190  
    135 <a name="l00191"></a>00191         vec <a class="code" href="classegiw.html#3d2c1f2ba0f9966781f1e0ae695e8a6f" title="Returns a sample,  from density .">sample</a>() <span class="keyword">const</span>; 
    136 <a name="l00192"></a>00192         vec <a class="code" href="classegiw.html#6deb0ff2859f41ef7cbdf6a842cabb29" title="return expected value">mean</a>() <span class="keyword">const</span>; 
    137 <a name="l00193"></a>00193         <span class="keywordtype">void</span> mean_mat ( mat &amp;M, mat&amp;R ) <span class="keyword">const</span>; 
    138 <a name="l00195"></a>00195         <span class="keywordtype">double</span> <a class="code" href="classegiw.html#2ab1e525d692be8272a6f383d60b94cd" title="In this instance, val= [theta, r]. For multivariate instances, it is stored columnwise...">evalpdflog_nn</a> ( <span class="keyword">const</span> vec &amp;val ) <span class="keyword">const</span>; 
    139 <a name="l00196"></a>00196         <span class="keywordtype">double</span> <a class="code" href="classegiw.html#70eb1a0b88459b227f919b425b0d3359" title="logarithm of the normalizing constant, ">lognc</a> () <span class="keyword">const</span>; 
    140 <a name="l00197"></a>00197  
    141 <a name="l00198"></a>00198         <span class="comment">//Access</span> 
    142 <a name="l00200"></a><a class="code" href="classegiw.html#533e792e1175bfa06d5d595dc5d080d5">00200</a> <span class="comment"></span>        <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a>&amp; <a class="code" href="classegiw.html#533e792e1175bfa06d5d595dc5d080d5" title="returns a pointer to the internal statistics. Use with Care!">_V</a>() {<span class="keywordflow">return</span> <a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>;} 
    143 <a name="l00202"></a><a class="code" href="classegiw.html#a46c8a206edf80b357a138d7491780c1">00202</a>         <span class="keyword">const</span> <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a>&amp; <a class="code" href="classegiw.html#533e792e1175bfa06d5d595dc5d080d5" title="returns a pointer to the internal statistics. Use with Care!">_V</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>;} 
    144 <a name="l00204"></a><a class="code" href="classegiw.html#08029c481ff95d24f093df0573879afe">00204</a>         <span class="keywordtype">double</span>&amp; <a class="code" href="classegiw.html#08029c481ff95d24f093df0573879afe" title="returns a pointer to the internal statistics. Use with Care!">_nu</a>()  {<span class="keywordflow">return</span> <a class="code" href="classegiw.html#4a2f130b91afe84f6d62fed289d5d453" title="Number of data records (degrees of freedom) of sufficient statistics.">nu</a>;} 
    145 <a name="l00205"></a>00205         <span class="keyword">const</span> <span class="keywordtype">double</span>&amp; <a class="code" href="classegiw.html#08029c481ff95d24f093df0573879afe" title="returns a pointer to the internal statistics. Use with Care!">_nu</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classegiw.html#4a2f130b91afe84f6d62fed289d5d453" title="Number of data records (degrees of freedom) of sufficient statistics.">nu</a>;} 
    146 <a name="l00206"></a><a class="code" href="classegiw.html#036306322a90a9977834baac07460816">00206</a>         <span class="keywordtype">void</span> <a class="code" href="classegiw.html#036306322a90a9977834baac07460816" title="Power of the density, used e.g. to flatten the density.">pow</a> ( <span class="keywordtype">double</span> p ) {<a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>*=p;<a class="code" href="classegiw.html#4a2f130b91afe84f6d62fed289d5d453" title="Number of data records (degrees of freedom) of sufficient statistics.">nu</a>*=p;}; 
    147 <a name="l00207"></a>00207 }; 
    148 <a name="l00208"></a>00208  
    149 <a name="l00217"></a><a class="code" href="classeDirich.html">00217</a> <span class="keyword">class </span><a class="code" href="classeDirich.html" title="Dirichlet posterior density.">eDirich</a>: <span class="keyword">public</span> <a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> { 
    150 <a name="l00218"></a>00218 <span class="keyword">protected</span>: 
    151 <a name="l00220"></a><a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7">00220</a>         vec <a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a>; 
    152 <a name="l00221"></a>00221 <span class="keyword">public</span>: 
    153 <a name="l00223"></a><a class="code" href="classeDirich.html#ac7e6116f3575c3860d07355e96cd4af">00223</a>         <a class="code" href="classeDirich.html#ac7e6116f3575c3860d07355e96cd4af" title="Default constructor.">eDirich</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>, <span class="keyword">const</span> vec &amp;beta0 ) : <a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> ( rv ),<a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a> ( beta0 ) {it_assert_debug ( rv.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ==<a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a>.length(),<span class="stringliteral">"Incompatible statistics"</span> ); }; 
    154 <a name="l00225"></a><a class="code" href="classeDirich.html#55cccbc5eb44764dce722567acf5fd58">00225</a>         <a class="code" href="classeDirich.html#ac7e6116f3575c3860d07355e96cd4af" title="Default constructor.">eDirich</a> ( <span class="keyword">const</span> <a class="code" href="classeDirich.html" title="Dirichlet posterior density.">eDirich</a> &amp;D0 ) : <a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> ( D0.<a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a> ),<a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a> ( D0.<a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a> ) {}; 
    155 <a name="l00226"></a><a class="code" href="classeDirich.html#23dff79110822e9639343fe8e177fd80">00226</a>         vec <a class="code" href="classeDirich.html#23dff79110822e9639343fe8e177fd80" title="Returns a sample,  from density .">sample</a>()<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> vec_1 ( 0.0 );}; 
    156 <a name="l00227"></a><a class="code" href="classeDirich.html#4206e1da149d51ff3b663c9241096b73">00227</a>         vec <a class="code" href="classeDirich.html#4206e1da149d51ff3b663c9241096b73" title="return expected value">mean</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a>/sum ( <a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a> );}; 
    157 <a name="l00229"></a><a class="code" href="classeDirich.html#688a24f04be6d80d4769cf0e4ded7acc">00229</a>         <span class="keywordtype">double</span> <a class="code" href="classeDirich.html#688a24f04be6d80d4769cf0e4ded7acc" title="In this instance, val is ...">evalpdflog_nn</a> ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const </span>{<span class="keywordflow">return</span> ( <a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a>-1 ) *log ( val );}; 
    158 <a name="l00230"></a><a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77">00230</a>         <span class="keywordtype">double</span> <a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77" title="logarithm of the normalizing constant, ">lognc</a> ()<span class="keyword"> const </span>{ 
    159 <a name="l00231"></a>00231                 <span class="keywordtype">double</span> gam=sum ( <a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a> ); 
    160 <a name="l00232"></a>00232                 <span class="keywordtype">double</span> lgb=0.0; 
    161 <a name="l00233"></a>00233                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a>.length();i++ ) {lgb+=lgamma ( <a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a> ( i ) );} 
    162 <a name="l00234"></a>00234                 <span class="keywordflow">return</span> lgb-lgamma ( gam ); 
    163 <a name="l00235"></a>00235         }; 
    164 <a name="l00237"></a><a class="code" href="classeDirich.html#6409d0362143a23976b43641ff19e53a">00237</a>         vec&amp; <a class="code" href="classeDirich.html#6409d0362143a23976b43641ff19e53a" title="access function">_beta</a>()  {<span class="keywordflow">return</span> <a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a>;} 
    165 <a name="l00239"></a><a class="code" href="classeDirich.html#c842acb2e1cce5cc9000769ff06c086d">00239</a>         <span class="keywordtype">void</span> <a class="code" href="classeDirich.html#c842acb2e1cce5cc9000769ff06c086d" title="Set internal parameters.">set_parameters</a> ( <span class="keyword">const</span> vec &amp;beta0 ) { 
    166 <a name="l00240"></a>00240                 <span class="keywordflow">if</span> ( beta0.length() !=<a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a>.length() ) { 
    167 <a name="l00241"></a>00241                         it_assert_debug ( <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>.<a class="code" href="classRV.html#c114a6f3ff06796cc2f4dacba74291eb" title="Return length (number of entries) of the RV.">length</a>() ==1,<span class="stringliteral">"Undefined"</span> ); 
    168 <a name="l00242"></a>00242                         <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>.<a class="code" href="classRV.html#70b24c39c5130b1e4753fa2eef495433" title="access function">set_size</a> ( 0,beta0.length() ); 
    169 <a name="l00243"></a>00243                 } 
    170 <a name="l00244"></a>00244                 <a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a>= beta0; 
    171 <a name="l00245"></a>00245         } 
    172 <a name="l00246"></a>00246 }; 
    173 <a name="l00247"></a>00247  
    174 <a name="l00249"></a><a class="code" href="classmultiBM.html">00249</a> <span class="keyword">class </span><a class="code" href="classmultiBM.html" title="Estimator for Multinomial density.">multiBM</a> : <span class="keyword">public</span> <a class="code" href="classBMEF.html" title="Estimator for Exponential family.">BMEF</a> { 
    175 <a name="l00250"></a>00250 <span class="keyword">protected</span>: 
    176 <a name="l00252"></a><a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5">00252</a>         <a class="code" href="classeDirich.html" title="Dirichlet posterior density.">eDirich</a> <a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>; 
    177 <a name="l00254"></a><a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6">00254</a>         vec &amp;<a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a>; 
    178 <a name="l00255"></a>00255 <span class="keyword">public</span>: 
    179 <a name="l00257"></a><a class="code" href="classmultiBM.html#7d7d7e78c129602bcde96078359dc6e5">00257</a>         <a class="code" href="classmultiBM.html#7d7d7e78c129602bcde96078359dc6e5" title="Default constructor.">multiBM</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a>, <span class="keyword">const</span> vec beta0 ) : <a class="code" href="classBMEF.html" title="Estimator for Exponential family.">BMEF</a> ( rv ),<a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a> ( rv,beta0 ),<a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a> ( <a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>._beta() ) {<a class="code" href="classBMEF.html#308cf5d4133cd471fdf1ecd5dfa09d02" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>=<a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>.<a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77" title="logarithm of the normalizing constant, ">lognc</a>();} 
    180 <a name="l00259"></a><a class="code" href="classmultiBM.html#b92751adbfb9f259ca8c95232cfd9c09">00259</a>         <a class="code" href="classmultiBM.html#7d7d7e78c129602bcde96078359dc6e5" title="Default constructor.">multiBM</a> ( <span class="keyword">const</span> <a class="code" href="classmultiBM.html" title="Estimator for Multinomial density.">multiBM</a> &amp;B ) : <a class="code" href="classBMEF.html" title="Estimator for Exponential family.">BMEF</a> ( B ),<a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a> ( <a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a>,B.<a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a> ),<a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a> ( <a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>._beta() ) {} 
    181 <a name="l00261"></a><a class="code" href="classmultiBM.html#42e36804041e551d3ceea6c75abc0562">00261</a>         <span class="keywordtype">void</span> <a class="code" href="classmultiBM.html#42e36804041e551d3ceea6c75abc0562" title="Sets sufficient statistics to match that of givefrom mB0.">set_statistics</a> ( <span class="keyword">const</span> <a class="code" href="classBM.html" title="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</a>* mB0 ) {<span class="keyword">const</span> <a class="code" href="classmultiBM.html" title="Estimator for Multinomial density.">multiBM</a>* mB=<span class="keyword">dynamic_cast&lt;</span><span class="keyword">const </span><a class="code" href="classmultiBM.html" title="Estimator for Multinomial density.">multiBM</a>*<span class="keyword">&gt;</span> ( mB0 ); <a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a>=mB-&gt;<a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a>;} 
    182 <a name="l00262"></a><a class="code" href="classmultiBM.html#11eeba7e97954e316e959116f90d80e2">00262</a>         <span class="keywordtype">void</span> <a class="code" href="classmultiBM.html#11eeba7e97954e316e959116f90d80e2" title="Incremental Bayes rule.">bayes</a> ( <span class="keyword">const</span> vec &amp;dt ) { 
    183 <a name="l00263"></a>00263                 <span class="keywordflow">if</span> ( <a class="code" href="classBMEF.html#538d632e59f9afa8daa1de74da12ce71" title="forgetting factor">frg</a>&lt;1.0 ) {<a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a>*=<a class="code" href="classBMEF.html#538d632e59f9afa8daa1de74da12ce71" title="forgetting factor">frg</a>;<a class="code" href="classBMEF.html#308cf5d4133cd471fdf1ecd5dfa09d02" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>=<a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>.<a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77" title="logarithm of the normalizing constant, ">lognc</a>();} 
    184 <a name="l00264"></a>00264                 <a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a>+=dt; 
    185 <a name="l00265"></a>00265                 <span class="keywordflow">if</span> ( <a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ) {<a class="code" href="classBM.html#5623fef6572a08c2b53b8c87b82dc979" title="Logarithm of marginalized data likelihood.">ll</a>=<a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>.<a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77" title="logarithm of the normalizing constant, ">lognc</a>()-<a class="code" href="classBMEF.html#308cf5d4133cd471fdf1ecd5dfa09d02" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>;} 
    186 <a name="l00266"></a>00266         } 
    187 <a name="l00267"></a><a class="code" href="classmultiBM.html#13e26a61757278981fd8cac9a7ef91eb">00267</a>         <span class="keywordtype">double</span> <a class="code" href="classmultiBM.html#13e26a61757278981fd8cac9a7ef91eb">logpred</a> ( <span class="keyword">const</span> vec &amp;dt )<span class="keyword"> const </span>{ 
    188 <a name="l00268"></a>00268                 <a class="code" href="classeDirich.html" title="Dirichlet posterior density.">eDirich</a> pred ( <a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a> ); 
    189 <a name="l00269"></a>00269                 vec &amp;<a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a> = pred.<a class="code" href="classeDirich.html#6409d0362143a23976b43641ff19e53a" title="access function">_beta</a>(); 
    190 <a name="l00270"></a>00270  
    191 <a name="l00271"></a>00271                 <span class="keywordtype">double</span> lll; 
    192 <a name="l00272"></a>00272                 <span class="keywordflow">if</span> ( <a class="code" href="classBMEF.html#538d632e59f9afa8daa1de74da12ce71" title="forgetting factor">frg</a>&lt;1.0 ) 
    193 <a name="l00273"></a>00273                         {beta*=<a class="code" href="classBMEF.html#538d632e59f9afa8daa1de74da12ce71" title="forgetting factor">frg</a>;lll=pred.<a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77" title="logarithm of the normalizing constant, ">lognc</a>();} 
    194 <a name="l00274"></a>00274                 <span class="keywordflow">else</span> 
    195 <a name="l00275"></a>00275                         <span class="keywordflow">if</span> ( <a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ) {lll=<a class="code" href="classBMEF.html#308cf5d4133cd471fdf1ecd5dfa09d02" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>;} 
    196 <a name="l00276"></a>00276                         <span class="keywordflow">else</span>{lll=pred.<a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77" title="logarithm of the normalizing constant, ">lognc</a>();} 
    197 <a name="l00277"></a>00277  
    198 <a name="l00278"></a>00278                 beta+=dt; 
    199 <a name="l00279"></a>00279                 <span class="keywordflow">return</span> pred.<a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77" title="logarithm of the normalizing constant, ">lognc</a>()-lll; 
    200 <a name="l00280"></a>00280         } 
    201 <a name="l00281"></a><a class="code" href="classmultiBM.html#3988322f8f51b153622036f461f62a67">00281</a>         <span class="keywordtype">void</span> <a class="code" href="classmultiBM.html#3988322f8f51b153622036f461f62a67" title="Flatten the posterior according to the given BMEF (of the same type!).">flatten</a> ( <span class="keyword">const</span> <a class="code" href="classBMEF.html" title="Estimator for Exponential family.">BMEF</a>* B ) { 
    202 <a name="l00282"></a>00282                 <span class="keyword">const</span> <a class="code" href="classmultiBM.html" title="Estimator for Multinomial density.">multiBM</a>* E=<span class="keyword">dynamic_cast&lt;</span><span class="keyword">const </span><a class="code" href="classmultiBM.html" title="Estimator for Multinomial density.">multiBM</a>*<span class="keyword">&gt;</span> ( B ); 
    203 <a name="l00283"></a>00283                 <span class="comment">// sum(beta) should be equal to sum(B.beta)</span> 
    204 <a name="l00284"></a>00284                 <span class="keyword">const</span> vec &amp;Eb=E-&gt;<a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a>;<span class="comment">//const_cast&lt;multiBM*&gt; ( E )-&gt;_beta();</span> 
    205 <a name="l00285"></a>00285                 <a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a>*= ( sum ( Eb ) /sum ( <a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a> ) ); 
    206 <a name="l00286"></a>00286                 <span class="keywordflow">if</span> ( <a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ) {<a class="code" href="classBMEF.html#308cf5d4133cd471fdf1ecd5dfa09d02" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>=<a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>.<a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77" title="logarithm of the normalizing constant, ">lognc</a>();} 
    207 <a name="l00287"></a>00287         } 
    208 <a name="l00288"></a><a class="code" href="classmultiBM.html#66cdfd83a70bc281840ab0646b941684">00288</a>         <span class="keyword">const</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>&amp; <a class="code" href="classmultiBM.html#66cdfd83a70bc281840ab0646b941684" title="Returns a reference to the epdf representing posterior density on parameters.">_epdf</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>;}; 
    209 <a name="l00289"></a><a class="code" href="classmultiBM.html#66a0fa6966e40bb6c3e7ba22d26e9d35">00289</a>         <span class="keyword">const</span> <a class="code" href="classeDirich.html" title="Dirichlet posterior density.">eDirich</a>* <a class="code" href="classmultiBM.html#66a0fa6966e40bb6c3e7ba22d26e9d35" title="Returns a pointer to the epdf representing posterior density on parameters. Use with...">_e</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> &amp;<a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>;}; 
    210 <a name="l00290"></a>00290         <span class="keywordtype">void</span> set_parameters ( <span class="keyword">const</span> vec &amp;beta0 ) { 
    211 <a name="l00291"></a>00291                 <a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>.<a class="code" href="classeDirich.html#c842acb2e1cce5cc9000769ff06c086d" title="Set internal parameters.">set_parameters</a> ( beta0 ); 
    212 <a name="l00292"></a>00292                 <a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a> = <a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>.<a class="code" href="classepdf.html#ca0d32aabb4cbba347e0c37fe8607562" title="access function, possibly dangerous!">_rv</a>(); 
    213 <a name="l00293"></a>00293                 <span class="keywordflow">if</span> ( <a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ) {<a class="code" href="classBMEF.html#308cf5d4133cd471fdf1ecd5dfa09d02" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>=<a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>.<a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77" title="logarithm of the normalizing constant, ">lognc</a>();} 
    214 <a name="l00294"></a>00294         } 
    215 <a name="l00295"></a>00295 }; 
    216 <a name="l00296"></a>00296  
    217 <a name="l00306"></a><a class="code" href="classegamma.html">00306</a> <span class="keyword">class </span><a class="code" href="classegamma.html" title="Gamma posterior density.">egamma</a> : <span class="keyword">public</span> <a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> { 
    218 <a name="l00307"></a>00307 <span class="keyword">protected</span>: 
    219 <a name="l00309"></a><a class="code" href="classegamma.html#376cebd8932546c440f21b182910b01b">00309</a>         vec <a class="code" href="classegamma.html#376cebd8932546c440f21b182910b01b" title="Vector .">alpha</a>; 
    220 <a name="l00311"></a><a class="code" href="classegamma.html#cfc5f136467488a421ab22f886323790">00311</a>         vec <a class="code" href="classegamma.html#cfc5f136467488a421ab22f886323790" title="Vector .">beta</a>; 
    221 <a name="l00312"></a>00312 <span class="keyword">public</span> : 
    222 <a name="l00314"></a><a class="code" href="classegamma.html#4b1d34f3b244ea51a58ec10c468788c1">00314</a>         <a class="code" href="classegamma.html#4b1d34f3b244ea51a58ec10c468788c1" title="Default constructor.">egamma</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a> ) :<a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> ( rv ) {}; 
    223 <a name="l00316"></a><a class="code" href="classegamma.html#8e348b89be82b70471fe8c5630f61339">00316</a>         <span class="keywordtype">void</span> <a class="code" href="classegamma.html#8e348b89be82b70471fe8c5630f61339" title="Sets parameters.">set_parameters</a> ( <span class="keyword">const</span> vec &amp;a, <span class="keyword">const</span> vec &amp;b ) {<a class="code" href="classegamma.html#376cebd8932546c440f21b182910b01b" title="Vector .">alpha</a>=a,<a class="code" href="classegamma.html#cfc5f136467488a421ab22f886323790" title="Vector .">beta</a>=b;}; 
    224 <a name="l00317"></a>00317         vec <a class="code" href="classegamma.html#8e10c0021b5dfdd9cb62c6959b5ef425" title="Returns a sample,  from density .">sample</a>() <span class="keyword">const</span>; 
    225 <a name="l00319"></a>00319 <span class="comment">//      mat sample ( int N ) const;</span> 
    226 <a name="l00320"></a>00320         <span class="keywordtype">double</span> <a class="code" href="classegamma.html#de84faac8f9799dfe2777ddbedf997ef" title="TODO: is it used anywhere?">evalpdflog</a> ( <span class="keyword">const</span> vec &amp;val ) <span class="keyword">const</span>; 
    227 <a name="l00321"></a>00321         <span class="keywordtype">double</span> <a class="code" href="classegamma.html#d6dbbdb72360f9e54d64501f80318bb6" title="logarithm of the normalizing constant, ">lognc</a> () <span class="keyword">const</span>; 
    228 <a name="l00323"></a><a class="code" href="classegamma.html#44445c56e60b91b377f207f8d5089790">00323</a>         <span class="keywordtype">void</span> <a class="code" href="classegamma.html#44445c56e60b91b377f207f8d5089790" title="Returns poiter to alpha and beta. Potentially dengerous: use with care!">_param</a> ( vec* &amp;a, vec* &amp;b ) {a=&amp;<a class="code" href="classegamma.html#376cebd8932546c440f21b182910b01b" title="Vector .">alpha</a>;b=&amp;<a class="code" href="classegamma.html#cfc5f136467488a421ab22f886323790" title="Vector .">beta</a>;}; 
    229 <a name="l00324"></a><a class="code" href="classegamma.html#6ab5ba56f7cdb2e5921c3e77524fa50a">00324</a>         vec <a class="code" href="classegamma.html#6ab5ba56f7cdb2e5921c3e77524fa50a" title="return expected value">mean</a>()<span class="keyword"> const </span>{vec pom ( <a class="code" href="classegamma.html#376cebd8932546c440f21b182910b01b" title="Vector .">alpha</a> ); pom/=<a class="code" href="classegamma.html#cfc5f136467488a421ab22f886323790" title="Vector .">beta</a>; <span class="keywordflow">return</span> pom;} 
    230 <a name="l00325"></a>00325 }; 
    231 <a name="l00326"></a>00326 <span class="comment">/*</span> 
    232 <a name="l00328"></a>00328 <span class="comment">class emix : public epdf {</span> 
    233 <a name="l00329"></a>00329 <span class="comment">protected:</span> 
    234 <a name="l00330"></a>00330 <span class="comment">        int n;</span> 
    235 <a name="l00331"></a>00331 <span class="comment">        vec &amp;w;</span> 
    236 <a name="l00332"></a>00332 <span class="comment">        Array&lt;epdf*&gt; Coms;</span> 
    237 <a name="l00333"></a>00333 <span class="comment">public:</span> 
    238 <a name="l00335"></a>00335 <span class="comment">        emix ( const RV &amp;rv, vec &amp;w0): epdf(rv), n(w0.length()), w(w0), Coms(n) {};</span> 
    239 <a name="l00336"></a>00336 <span class="comment">        void set_parameters( int &amp;i, double wi, epdf* ep){w(i)=wi;Coms(i)=ep;}</span> 
    240 <a name="l00337"></a>00337 <span class="comment">        vec mean(){vec pom; for(int i=0;i&lt;n;i++){pom+=Coms(i)-&gt;mean()*w(i);} return pom;};</span> 
    241 <a name="l00338"></a>00338 <span class="comment">        vec sample() {it_error ( "Not implemented" );return 0;}</span> 
    242 <a name="l00339"></a>00339 <span class="comment">};</span> 
    243 <a name="l00340"></a>00340 <span class="comment">*/</span> 
    244 <a name="l00341"></a>00341  
    245 <a name="l00343"></a>00343  
    246 <a name="l00344"></a><a class="code" href="classeuni.html">00344</a> <span class="keyword">class </span><a class="code" href="classeuni.html" title="Uniform distributed density on a rectangular support.">euni</a>: <span class="keyword">public</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> { 
    247 <a name="l00345"></a>00345 <span class="keyword">protected</span>: 
    248 <a name="l00347"></a><a class="code" href="classeuni.html#ef42cd8d7645422048d46c46ec5cdac1">00347</a>         vec <a class="code" href="classeuni.html#ef42cd8d7645422048d46c46ec5cdac1" title="lower bound on support">low</a>; 
    249 <a name="l00349"></a><a class="code" href="classeuni.html#71b6d6b41aeb61a7f76f682b72119231">00349</a>         vec <a class="code" href="classeuni.html#71b6d6b41aeb61a7f76f682b72119231" title="upper bound on support">high</a>; 
    250 <a name="l00351"></a><a class="code" href="classeuni.html#52a6ff4a54010f88a6a19fca605c64a4">00351</a>         vec <a class="code" href="classeuni.html#52a6ff4a54010f88a6a19fca605c64a4" title="internal">distance</a>; 
    251 <a name="l00353"></a><a class="code" href="classeuni.html#63105490e946e43372d6187ad1bafdda">00353</a>         <span class="keywordtype">double</span> <a class="code" href="classeuni.html#63105490e946e43372d6187ad1bafdda" title="normalizing coefficients">nk</a>; 
    252 <a name="l00355"></a><a class="code" href="classeuni.html#f445a0ce24f39d14c1a4eed53fc8e2c3">00355</a>         <span class="keywordtype">double</span> <a class="code" href="classeuni.html#f445a0ce24f39d14c1a4eed53fc8e2c3" title="cache of log( nk )">lnk</a>; 
    253 <a name="l00356"></a>00356 <span class="keyword">public</span>: 
    254 <a name="l00358"></a><a class="code" href="classeuni.html#2537a6c239cff52e3ba814851a1116cd">00358</a>         <a class="code" href="classeuni.html#2537a6c239cff52e3ba814851a1116cd" title="Defualt constructor.">euni</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a> ) :<a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> ( rv ) {} 
    255 <a name="l00359"></a>00359         <span class="keywordtype">double</span> eval ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const  </span>{<span class="keywordflow">return</span> <a class="code" href="classeuni.html#63105490e946e43372d6187ad1bafdda" title="normalizing coefficients">nk</a>;} 
    256 <a name="l00360"></a><a class="code" href="classeuni.html#06af95d514a6623ad4688bd2ad50ad71">00360</a>         <span class="keywordtype">double</span> <a class="code" href="classeuni.html#06af95d514a6623ad4688bd2ad50ad71" title="Compute log-probability of argument val.">evalpdflog</a> ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const  </span>{<span class="keywordflow">return</span> <a class="code" href="classeuni.html#f445a0ce24f39d14c1a4eed53fc8e2c3" title="cache of log( nk )">lnk</a>;} 
    257 <a name="l00361"></a><a class="code" href="classeuni.html#4a0e09392be17beaee120ba98fc038cd">00361</a>         vec <a class="code" href="classeuni.html#4a0e09392be17beaee120ba98fc038cd" title="Returns a sample,  from density .">sample</a>()<span class="keyword"> const </span>{ 
    258 <a name="l00362"></a>00362                 vec smp ( <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ); 
    259 <a name="l00363"></a>00363 <span class="preprocessor">#pragma omp critical</span> 
    260 <a name="l00364"></a>00364 <span class="preprocessor"></span>                UniRNG.sample_vector ( <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>(),smp ); 
    261 <a name="l00365"></a>00365                 <span class="keywordflow">return</span> <a class="code" href="classeuni.html#ef42cd8d7645422048d46c46ec5cdac1" title="lower bound on support">low</a>+elem_mult ( <a class="code" href="classeuni.html#52a6ff4a54010f88a6a19fca605c64a4" title="internal">distance</a>,smp ); 
    262 <a name="l00366"></a>00366         } 
    263 <a name="l00368"></a><a class="code" href="classeuni.html#4fd7c6a05100616ad16ece405cad7bf2">00368</a>         <span class="keywordtype">void</span> <a class="code" href="classeuni.html#4fd7c6a05100616ad16ece405cad7bf2" title="set values of low and high ">set_parameters</a> ( <span class="keyword">const</span> vec &amp;low0, <span class="keyword">const</span> vec &amp;high0 ) { 
    264 <a name="l00369"></a>00369                 <a class="code" href="classeuni.html#52a6ff4a54010f88a6a19fca605c64a4" title="internal">distance</a> = high0-low0; 
    265 <a name="l00370"></a>00370                 it_assert_debug ( min ( <a class="code" href="classeuni.html#52a6ff4a54010f88a6a19fca605c64a4" title="internal">distance</a> ) &gt;0.0,<span class="stringliteral">"bad support"</span> ); 
    266 <a name="l00371"></a>00371                 <a class="code" href="classeuni.html#ef42cd8d7645422048d46c46ec5cdac1" title="lower bound on support">low</a> = low0; 
    267 <a name="l00372"></a>00372                 <a class="code" href="classeuni.html#71b6d6b41aeb61a7f76f682b72119231" title="upper bound on support">high</a> = high0; 
    268 <a name="l00373"></a>00373                 <a class="code" href="classeuni.html#63105490e946e43372d6187ad1bafdda" title="normalizing coefficients">nk</a> = prod ( 1.0/<a class="code" href="classeuni.html#52a6ff4a54010f88a6a19fca605c64a4" title="internal">distance</a> ); 
    269 <a name="l00374"></a>00374                 <a class="code" href="classeuni.html#f445a0ce24f39d14c1a4eed53fc8e2c3" title="cache of log( nk )">lnk</a> = log ( <a class="code" href="classeuni.html#63105490e946e43372d6187ad1bafdda" title="normalizing coefficients">nk</a> ); 
    270 <a name="l00375"></a>00375         } 
    271 <a name="l00376"></a><a class="code" href="classeuni.html#8050087e421a9cfd1b4b1f8bd33b1cc1">00376</a>         vec <a class="code" href="classeuni.html#8050087e421a9cfd1b4b1f8bd33b1cc1" title="return expected value">mean</a>()<span class="keyword"> const </span>{vec pom=<a class="code" href="classeuni.html#71b6d6b41aeb61a7f76f682b72119231" title="upper bound on support">high</a>; pom-=<a class="code" href="classeuni.html#ef42cd8d7645422048d46c46ec5cdac1" title="lower bound on support">low</a>; pom/=2.0; <span class="keywordflow">return</span> pom;} 
    272 <a name="l00377"></a>00377 }; 
    273 <a name="l00378"></a>00378  
    274 <a name="l00379"></a>00379  
    275 <a name="l00385"></a>00385 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    276 <a name="l00386"></a><a class="code" href="classmlnorm.html">00386</a> <span class="keyword">class </span><a class="code" href="classmlnorm.html" title="Normal distributed linear function with linear function of mean value;.">mlnorm</a> : <span class="keyword">public</span> <a class="code" href="classmEF.html" title="Exponential family model.">mEF</a> { 
    277 <a name="l00387"></a>00387 <span class="keyword">protected</span>: 
    278 <a name="l00389"></a><a class="code" href="classmlnorm.html#b76ee2171ace4fb3ff95a131ae8fc421">00389</a>         <a class="code" href="classenorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">enorm&lt;sq_T&gt;</a> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>; 
    279 <a name="l00390"></a>00390         mat A; 
    280 <a name="l00391"></a>00391         vec mu_const; 
    281 <a name="l00392"></a>00392         vec&amp; _mu; <span class="comment">//cached epdf.mu;</span> 
    282 <a name="l00393"></a>00393 <span class="keyword">public</span>: 
    283 <a name="l00395"></a>00395         <a class="code" href="classmlnorm.html#3a5ad4798d8a3878c5e93b8e796c8837" title="Constructor.">mlnorm</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a>, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classmpdf.html#acb7dda792b3cd5576f39fa3129abbab" title="random variable in condition">rvc</a> ); 
    284 <a name="l00397"></a>00397         <span class="keywordtype">void</span> <a class="code" href="classmlnorm.html#f95dfce0b500636a44ecd7e5210de999" title="Set A and R.">set_parameters</a> ( <span class="keyword">const</span>  mat &amp;A, <span class="keyword">const</span> vec &amp;mu0, <span class="keyword">const</span> sq_T &amp;R ); 
    285 <a name="l00398"></a>00398 <span class="comment">//      //!Generate one sample of the posterior</span> 
    286 <a name="l00399"></a>00399 <span class="comment">//      vec samplecond (const vec &amp;cond, double &amp;lik );</span> 
    287 <a name="l00400"></a>00400 <span class="comment">//      //!Generate matrix of samples of the posterior</span> 
    288 <a name="l00401"></a>00401 <span class="comment">//      mat samplecond (const vec &amp;cond, vec &amp;lik, int n );</span> 
    289 <a name="l00403"></a>00403 <span class="comment"></span>        <span class="keywordtype">void</span> <a class="code" href="classmlnorm.html#d41126455ac64b888a38f677886e1b40" title="Set value of rvc . Result of this operation is stored in epdf use function _ep to...">condition</a> ( <span class="keyword">const</span> vec &amp;cond ); 
    290 <a name="l00404"></a>00404  
    291 <a name="l00406"></a><a class="code" href="classmlnorm.html#2732ae47835dd25d5784bf08fde0a546">00406</a>         vec&amp; <a class="code" href="classmlnorm.html#2732ae47835dd25d5784bf08fde0a546" title="access function">_mu_const</a>() {<span class="keywordflow">return</span> mu_const;} 
    292 <a name="l00408"></a><a class="code" href="classmlnorm.html#65ec3840c21b21102896bfd2282b47b3">00408</a>         mat&amp; <a class="code" href="classmlnorm.html#65ec3840c21b21102896bfd2282b47b3" title="access function">_A</a>() {<span class="keywordflow">return</span> A;} 
    293 <a name="l00410"></a><a class="code" href="classmlnorm.html#3ff2b03fbb5e1133a5fe1bf831939f63">00410</a>         mat <a class="code" href="classmlnorm.html#3ff2b03fbb5e1133a5fe1bf831939f63" title="access function">_R</a>() {<span class="keywordflow">return</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>._R().to_mat();} 
    294 <a name="l00411"></a>00411  
    295 <a name="l00412"></a>00412         <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_M&gt; 
    296 <a name="l00413"></a>00413         <span class="keyword">friend</span> std::ostream &amp;operator&lt;&lt; ( std::ostream &amp;os,  mlnorm&lt;sq_M&gt; &amp;ml ); 
    297 <a name="l00414"></a>00414 }; 
    298 <a name="l00415"></a>00415  
    299 <a name="l00418"></a><a class="code" href="classmlstudent.html">00418</a> <span class="keyword">class </span><a class="code" href="classmlstudent.html">mlstudent</a> : <span class="keyword">public</span> <a class="code" href="classmlnorm.html" title="Normal distributed linear function with linear function of mean value;.">mlnorm</a>&lt;ldmat&gt; { 
    300 <a name="l00419"></a>00419 <span class="keyword">protected</span>: 
    301 <a name="l00420"></a>00420         <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> Lambda; 
    302 <a name="l00421"></a>00421         <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> &amp;<a class="code" href="classmlnorm.html#3ff2b03fbb5e1133a5fe1bf831939f63" title="access function">_R</a>; 
    303 <a name="l00422"></a>00422         <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> Re; 
    304 <a name="l00423"></a>00423 <span class="keyword">public</span>: 
    305 <a name="l00424"></a>00424         <a class="code" href="classmlstudent.html">mlstudent</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv0, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvc0 ) :<a class="code" href="classmlnorm.html" title="Normal distributed linear function with linear function of mean value;.">mlnorm&lt;ldmat&gt;</a> ( rv0,rvc0 ), 
    306 <a name="l00425"></a>00425                         Lambda ( rv0.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ), 
    307 <a name="l00426"></a>00426                         <a class="code" href="classmlnorm.html#3ff2b03fbb5e1133a5fe1bf831939f63" title="access function">_R</a> ( <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>._R() ) {} 
    308 <a name="l00427"></a>00427         <span class="keywordtype">void</span> set_parameters ( <span class="keyword">const</span> mat &amp;A0, <span class="keyword">const</span> vec &amp;mu0, <span class="keyword">const</span> <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> &amp;R0, <span class="keyword">const</span> <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a>&amp; Lambda0) { 
    309 <a name="l00428"></a>00428                 <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.set_parameters ( zeros ( <a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a>.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ),Lambda ); 
    310 <a name="l00429"></a>00429                 A = A0; 
    311 <a name="l00430"></a>00430                 mu_const = mu0; 
    312 <a name="l00431"></a>00431                 Re=R0; 
    313 <a name="l00432"></a>00432                 Lambda = Lambda0; 
    314 <a name="l00433"></a>00433         } 
    315 <a name="l00434"></a><a class="code" href="classmlstudent.html#d153460ae0180f4bc7f28301f5cde876">00434</a>         <span class="keywordtype">void</span> <a class="code" href="classmlstudent.html#d153460ae0180f4bc7f28301f5cde876" title="Set value of rvc . Result of this operation is stored in epdf use function _ep to...">condition</a> ( <span class="keyword">const</span> vec &amp;cond ) { 
    316 <a name="l00435"></a>00435                 _mu = A*cond + mu_const; 
    317 <a name="l00436"></a>00436                 <span class="keywordtype">double</span> zeta; 
    318 <a name="l00437"></a>00437                 <span class="comment">//ugly hack!</span> 
    319 <a name="l00438"></a>00438                 <span class="keywordflow">if</span> ((cond.length()+1)==Lambda.<a class="code" href="classldmat.html#96dfb21865db4f5bd36fa70f9b0b1163" title="access function">rows</a>()){ 
    320 <a name="l00439"></a>00439                         zeta = Lambda.<a class="code" href="classldmat.html#d876c5f83e02b3e809b35c9de5068f14" title="Evaluates quadratic form ;.">invqform</a> ( concat(cond, vec_1(1.0)) ); 
    321 <a name="l00440"></a>00440                 } <span class="keywordflow">else</span> { 
    322 <a name="l00441"></a>00441                         zeta = Lambda.<a class="code" href="classldmat.html#d876c5f83e02b3e809b35c9de5068f14" title="Evaluates quadratic form ;.">invqform</a> ( cond ); 
    323 <a name="l00442"></a>00442                 } 
    324 <a name="l00443"></a>00443                 <a class="code" href="classmlnorm.html#3ff2b03fbb5e1133a5fe1bf831939f63" title="access function">_R</a> = Re; 
    325 <a name="l00444"></a>00444                 <a class="code" href="classmlnorm.html#3ff2b03fbb5e1133a5fe1bf831939f63" title="access function">_R</a>*=( 1+zeta );<span class="comment">// / ( nu ); &lt;&lt; nu is in Re!!!!!!</span> 
    326 <a name="l00445"></a>00445         }; 
    327 <a name="l00446"></a>00446  
    328 <a name="l00447"></a>00447 }; 
    329 <a name="l00457"></a><a class="code" href="classmgamma.html">00457</a> <span class="keyword">class </span><a class="code" href="classmgamma.html" title="Gamma random walk.">mgamma</a> : <span class="keyword">public</span> <a class="code" href="classmEF.html" title="Exponential family model.">mEF</a> { 
    330 <a name="l00458"></a>00458 <span class="keyword">protected</span>: 
    331 <a name="l00460"></a><a class="code" href="classmgamma.html#612dbf35c770a780027619aaac2c443e">00460</a>         <a class="code" href="classegamma.html" title="Gamma posterior density.">egamma</a> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>; 
    332 <a name="l00462"></a><a class="code" href="classmgamma.html#43f733cce0245a52363d566099add687">00462</a>         <span class="keywordtype">double</span> <a class="code" href="classmgamma.html#43f733cce0245a52363d566099add687" title="Constant .">k</a>; 
    333 <a name="l00464"></a><a class="code" href="classmgamma.html#5e90652837448bcc29707e7412f99691">00464</a>         vec* <a class="code" href="classmgamma.html#5e90652837448bcc29707e7412f99691" title="cache of epdf.beta">_beta</a>; 
    334 <a name="l00465"></a>00465  
    335 <a name="l00466"></a>00466 <span class="keyword">public</span>: 
    336 <a name="l00468"></a>00468         <a class="code" href="classmgamma.html#af43e61b86900c0398d5c0ffc83b94e6" title="Constructor.">mgamma</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a>,<span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classmpdf.html#acb7dda792b3cd5576f39fa3129abbab" title="random variable in condition">rvc</a> ); 
    337 <a name="l00470"></a>00470         <span class="keywordtype">void</span> <a class="code" href="classmgamma.html#a9d646cf758a70126dde7c48790b6e94" title="Set value of k.">set_parameters</a> ( <span class="keywordtype">double</span> <a class="code" href="classmgamma.html#43f733cce0245a52363d566099add687" title="Constant .">k</a> ); 
    338 <a name="l00471"></a><a class="code" href="classmgamma.html#a61094c9f7a2d64ea77b130cbc031f97">00471</a>         <span class="keywordtype">void</span> <a class="code" href="classmgamma.html#a61094c9f7a2d64ea77b130cbc031f97" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( <span class="keyword">const</span> vec &amp;val ) {*<a class="code" href="classmgamma.html#5e90652837448bcc29707e7412f99691" title="cache of epdf.beta">_beta</a>=<a class="code" href="classmgamma.html#43f733cce0245a52363d566099add687" title="Constant .">k</a>/val;}; 
    339 <a name="l00472"></a>00472 }; 
    340 <a name="l00473"></a>00473  
    341 <a name="l00485"></a><a class="code" href="classmgamma__fix.html">00485</a> <span class="keyword">class </span><a class="code" href="classmgamma__fix.html" title="Gamma random walk around a fixed point.">mgamma_fix</a> : <span class="keyword">public</span> <a class="code" href="classmgamma.html" title="Gamma random walk.">mgamma</a> { 
    342 <a name="l00486"></a>00486 <span class="keyword">protected</span>: 
    343 <a name="l00488"></a><a class="code" href="classmgamma__fix.html#3f48c09caddc298901ad75fe7c0529f6">00488</a>         <span class="keywordtype">double</span> <a class="code" href="classmgamma__fix.html#3f48c09caddc298901ad75fe7c0529f6" title="parameter l">l</a>; 
    344 <a name="l00490"></a><a class="code" href="classmgamma__fix.html#81ce49029ecc385418619b200dcafeb0">00490</a>         vec <a class="code" href="classmgamma__fix.html#81ce49029ecc385418619b200dcafeb0" title="reference vector">refl</a>; 
    345 <a name="l00491"></a>00491 <span class="keyword">public</span>: 
    346 <a name="l00493"></a><a class="code" href="classmgamma__fix.html#b92c3d2e5fd0381033a072e5ef3bcf80">00493</a>         <a class="code" href="classmgamma__fix.html#b92c3d2e5fd0381033a072e5ef3bcf80" title="Constructor.">mgamma_fix</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a>,<span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classmpdf.html#acb7dda792b3cd5576f39fa3129abbab" title="random variable in condition">rvc</a> ) : <a class="code" href="classmgamma.html" title="Gamma random walk.">mgamma</a> ( rv,rvc ),<a class="code" href="classmgamma__fix.html#81ce49029ecc385418619b200dcafeb0" title="reference vector">refl</a> ( rv.count() ) {}; 
    347 <a name="l00495"></a><a class="code" href="classmgamma__fix.html#ec6f846896749e27cb7be9fa48dd1cb1">00495</a>         <span class="keywordtype">void</span> <a class="code" href="classmgamma__fix.html#ec6f846896749e27cb7be9fa48dd1cb1" title="Set value of k.">set_parameters</a> ( <span class="keywordtype">double</span> k0 , vec ref0, <span class="keywordtype">double</span> l0 ) { 
    348 <a name="l00496"></a>00496                 <a class="code" href="classmgamma.html#a9d646cf758a70126dde7c48790b6e94" title="Set value of k.">mgamma::set_parameters</a> ( k0 ); 
    349 <a name="l00497"></a>00497                 <a class="code" href="classmgamma__fix.html#81ce49029ecc385418619b200dcafeb0" title="reference vector">refl</a>=pow ( ref0,1.0-l0 );<a class="code" href="classmgamma__fix.html#3f48c09caddc298901ad75fe7c0529f6" title="parameter l">l</a>=l0; 
    350 <a name="l00498"></a>00498         }; 
    351 <a name="l00499"></a>00499  
    352 <a name="l00500"></a><a class="code" href="classmgamma__fix.html#6ea3931eec7b7da7b693e45981052460">00500</a>         <span class="keywordtype">void</span> <a class="code" href="classmgamma__fix.html#6ea3931eec7b7da7b693e45981052460" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( <span class="keyword">const</span> vec &amp;val ) {vec mean=elem_mult ( <a class="code" href="classmgamma__fix.html#81ce49029ecc385418619b200dcafeb0" title="reference vector">refl</a>,pow ( val,<a class="code" href="classmgamma__fix.html#3f48c09caddc298901ad75fe7c0529f6" title="parameter l">l</a> ) ); *<a class="code" href="classmgamma.html#5e90652837448bcc29707e7412f99691" title="cache of epdf.beta">_beta</a>=<a class="code" href="classmgamma.html#43f733cce0245a52363d566099add687" title="Constant .">k</a>/mean;}; 
    353 <a name="l00501"></a>00501 }; 
    354 <a name="l00502"></a>00502  
    355 <a name="l00504"></a><a class="code" href="libEF_8h.html#99497a3ff630f761cf6bff7babd23212">00504</a> <span class="keyword">enum</span> <a class="code" href="libEF_8h.html#99497a3ff630f761cf6bff7babd23212" title="Switch between various resampling methods.">RESAMPLING_METHOD</a> { MULTINOMIAL = 0, STRATIFIED = 1, SYSTEMATIC = 3 }; 
    356 <a name="l00510"></a><a class="code" href="classeEmp.html">00510</a> <span class="keyword">class </span><a class="code" href="classeEmp.html" title="Weighted empirical density.">eEmp</a>: <span class="keyword">public</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> { 
    357 <a name="l00511"></a>00511 <span class="keyword">protected</span> : 
    358 <a name="l00513"></a><a class="code" href="classeEmp.html#8c33034de0e35f03f8bb85d3d67438fd">00513</a>         <span class="keywordtype">int</span> <a class="code" href="classeEmp.html#8c33034de0e35f03f8bb85d3d67438fd" title="Number of particles.">n</a>; 
    359 <a name="l00515"></a><a class="code" href="classeEmp.html#ae78d144404ddba843c93b171b215de8">00515</a>         vec <a class="code" href="classeEmp.html#ae78d144404ddba843c93b171b215de8" title="Sample weights .">w</a>; 
    360 <a name="l00517"></a><a class="code" href="classeEmp.html#a4d6f4bbd6a6824fc39f14676701279a">00517</a>         Array&lt;vec&gt; <a class="code" href="classeEmp.html#a4d6f4bbd6a6824fc39f14676701279a" title="Samples .">samples</a>; 
    361 <a name="l00518"></a>00518 <span class="keyword">public</span>: 
    362 <a name="l00520"></a><a class="code" href="classeEmp.html#0c04b073ecd0dae3d498e680ae27e9e4">00520</a>         <a class="code" href="classeEmp.html#0c04b073ecd0dae3d498e680ae27e9e4" title="Default constructor.">eEmp</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv0 ,<span class="keywordtype">int</span> n0 ) :<a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> ( rv0 ),<a class="code" href="classeEmp.html#8c33034de0e35f03f8bb85d3d67438fd" title="Number of particles.">n</a> ( n0 ),<a class="code" href="classeEmp.html#ae78d144404ddba843c93b171b215de8" title="Sample weights .">w</a> ( <a class="code" href="classeEmp.html#8c33034de0e35f03f8bb85d3d67438fd" title="Number of particles.">n</a> ),<a class="code" href="classeEmp.html#a4d6f4bbd6a6824fc39f14676701279a" title="Samples .">samples</a> ( <a class="code" href="classeEmp.html#8c33034de0e35f03f8bb85d3d67438fd" title="Number of particles.">n</a> ) {}; 
    363 <a name="l00522"></a>00522         <span class="keywordtype">void</span> <a class="code" href="classeEmp.html#eab03bd3381aaea11ce34d5a26556353" title="Set samples and weights.">set_parameters</a> ( <span class="keyword">const</span> vec &amp;w0, <span class="keyword">const</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* pdf0 ); 
    364 <a name="l00524"></a>00524         <span class="keywordtype">void</span> <a class="code" href="classeEmp.html#e31bc9e6196173c3480b06a761a3e716" title="Set sample.">set_samples</a> ( <span class="keyword">const</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* pdf0 ); 
    365 <a name="l00526"></a><a class="code" href="classeEmp.html#a4215f6a5a04d07b43f7ebaa942e15f1">00526</a>         <span class="keywordtype">void</span> <a class="code" href="classeEmp.html#a4215f6a5a04d07b43f7ebaa942e15f1" title="Set sample.">set_n</a> ( <span class="keywordtype">int</span> n0, <span class="keywordtype">bool</span> copy=<span class="keyword">true</span> ){<a class="code" href="classeEmp.html#ae78d144404ddba843c93b171b215de8" title="Sample weights .">w</a>.set_size(n0,copy);<a class="code" href="classeEmp.html#a4d6f4bbd6a6824fc39f14676701279a" title="Samples .">samples</a>.set_size(n0,copy);}; 
    366 <a name="l00528"></a><a class="code" href="classeEmp.html#31b2bfb73b72486a5c89f2ab850c7a9b">00528</a>         vec&amp; <a class="code" href="classeEmp.html#31b2bfb73b72486a5c89f2ab850c7a9b" title="Potentially dangerous, use with care.">_w</a>()  {<span class="keywordflow">return</span> <a class="code" href="classeEmp.html#ae78d144404ddba843c93b171b215de8" title="Sample weights .">w</a>;}; 
    367 <a name="l00530"></a><a class="code" href="classeEmp.html#d6f4ae1a67ecd2bff8b9f176ee261afc">00530</a>         <span class="keyword">const</span> vec&amp; <a class="code" href="classeEmp.html#31b2bfb73b72486a5c89f2ab850c7a9b" title="Potentially dangerous, use with care.">_w</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classeEmp.html#ae78d144404ddba843c93b171b215de8" title="Sample weights .">w</a>;}; 
    368 <a name="l00532"></a><a class="code" href="classeEmp.html#31b747eca73b16f30370827ba4cc3575">00532</a>         Array&lt;vec&gt;&amp; <a class="code" href="classeEmp.html#31b747eca73b16f30370827ba4cc3575" title="access function">_samples</a>() {<span class="keywordflow">return</span> <a class="code" href="classeEmp.html#a4d6f4bbd6a6824fc39f14676701279a" title="Samples .">samples</a>;}; 
    369 <a name="l00534"></a><a class="code" href="classeEmp.html#bd48c1c36e2e9e78dbcea7df66dcbf25">00534</a>         <span class="keyword">const</span> Array&lt;vec&gt;&amp; <a class="code" href="classeEmp.html#31b747eca73b16f30370827ba4cc3575" title="access function">_samples</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classeEmp.html#a4d6f4bbd6a6824fc39f14676701279a" title="Samples .">samples</a>;}; 
    370 <a name="l00536"></a>00536         ivec <a class="code" href="classeEmp.html#77268292fc4465cb73ddbfb1f2932a59" title="Function performs resampling, i.e. removal of low-weight samples and duplication...">resample</a> ( <a class="code" href="libEF_8h.html#99497a3ff630f761cf6bff7babd23212" title="Switch between various resampling methods.">RESAMPLING_METHOD</a> method = SYSTEMATIC ); 
    371 <a name="l00538"></a><a class="code" href="classeEmp.html#83f9283f92b805508d896479dc1ccf12">00538</a>         vec <a class="code" href="classeEmp.html#83f9283f92b805508d896479dc1ccf12" title="inherited operation : NOT implemneted">sample</a>()<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> 0;} 
    372 <a name="l00540"></a><a class="code" href="classeEmp.html#23e7358995400865ad2e278945922fb3">00540</a>         <span class="keywordtype">double</span> <a class="code" href="classeEmp.html#23e7358995400865ad2e278945922fb3" title="inherited operation : NOT implemneted">evalpdflog</a> ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> 0.0;} 
    373 <a name="l00541"></a><a class="code" href="classeEmp.html#ba055c19038cc72628d98e25197e982d">00541</a>         vec <a class="code" href="classeEmp.html#ba055c19038cc72628d98e25197e982d" title="return expected value">mean</a>()<span class="keyword"> const </span>{ 
    374 <a name="l00542"></a>00542                 vec pom=zeros ( <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ); 
    375 <a name="l00543"></a>00543                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classeEmp.html#8c33034de0e35f03f8bb85d3d67438fd" title="Number of particles.">n</a>;i++ ) {pom+=<a class="code" href="classeEmp.html#a4d6f4bbd6a6824fc39f14676701279a" title="Samples .">samples</a> ( i ) *<a class="code" href="classeEmp.html#ae78d144404ddba843c93b171b215de8" title="Sample weights .">w</a> ( i );} 
    376 <a name="l00544"></a>00544                 <span class="keywordflow">return</span> pom; 
    377 <a name="l00545"></a>00545         } 
    378 <a name="l00546"></a>00546 }; 
    379 <a name="l00547"></a>00547  
    380 <a name="l00548"></a>00548  
    381 <a name="l00550"></a>00550  
    382 <a name="l00551"></a>00551 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    383 <a name="l00552"></a><a class="code" href="classenorm.html#0caf54fed9e48f9fe28b534b2027df2f">00552</a> <a class="code" href="classenorm.html#0caf54fed9e48f9fe28b534b2027df2f" title="Default constructor.">enorm&lt;sq_T&gt;::enorm</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv ) :<a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> ( rv ), mu ( rv.count() ),R ( rv.count() ),dim ( rv.count() ) {}; 
     105<a name="l00147"></a>00147         <span class="keyword">const</span> sq_T&amp; <a class="code" href="classenorm.html#7a5034b25771a84450a990d10fc40ac9" title="returns pointers to the internal variance and its inverse. Use with Care!">_R</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>;} 
     106<a name="l00148"></a>00148  
     107<a name="l00150"></a>00150 <span class="comment">//      mat getR () {return R.to_mat();}</span> 
     108<a name="l00151"></a>00151 }; 
     109<a name="l00152"></a>00152  
     110<a name="l00159"></a><a class="code" href="classegiw.html">00159</a> <span class="keyword">class </span><a class="code" href="classegiw.html" title="Gauss-inverse-Wishart density stored in LD form.">egiw</a> : <span class="keyword">public</span> <a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> { 
     111<a name="l00160"></a>00160 <span class="keyword">protected</span>: 
     112<a name="l00162"></a><a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442">00162</a>         <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> <a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>; 
     113<a name="l00164"></a><a class="code" href="classegiw.html#4a2f130b91afe84f6d62fed289d5d453">00164</a>         <span class="keywordtype">double</span> <a class="code" href="classegiw.html#4a2f130b91afe84f6d62fed289d5d453" title="Number of data records (degrees of freedom) of sufficient statistics.">nu</a>; 
     114<a name="l00166"></a><a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e">00166</a>         <span class="keywordtype">int</span> <a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e" title="Dimension of the output.">xdim</a>; 
     115<a name="l00168"></a><a class="code" href="classegiw.html#c70d13d86e0d9f0acede3e1dc0368812">00168</a>         <span class="keywordtype">int</span> <a class="code" href="classegiw.html#c70d13d86e0d9f0acede3e1dc0368812" title="Dimension of the regressor.">nPsi</a>; 
     116<a name="l00169"></a>00169 <span class="keyword">public</span>: 
     117<a name="l00171"></a><a class="code" href="classegiw.html#056c094f01ca1cc308d72162f47617c9">00171</a>         <a class="code" href="classegiw.html#056c094f01ca1cc308d72162f47617c9" title="Default constructor, if nu0&amp;lt;0 a minimal nu0 will be computed.">egiw</a> ( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>, mat V0, <span class="keywordtype">double</span> nu0=-1.0 ) : <a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> ( rv ), <a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a> ( V0 ), <a class="code" href="classegiw.html#4a2f130b91afe84f6d62fed289d5d453" title="Number of data records (degrees of freedom) of sufficient statistics.">nu</a> ( nu0 ) { 
     118<a name="l00172"></a>00172                 <a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e" title="Dimension of the output.">xdim</a> = rv.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() /<a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>.<a class="code" href="group__math.html#g96dfb21865db4f5bd36fa70f9b0b1163" title="access function">rows</a>(); 
     119<a name="l00173"></a>00173                 it_assert_debug ( rv.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ==<a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e" title="Dimension of the output.">xdim</a>*<a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>.<a class="code" href="group__math.html#g96dfb21865db4f5bd36fa70f9b0b1163" title="access function">rows</a>(),<span class="stringliteral">"Incompatible V0."</span> ); 
     120<a name="l00174"></a>00174                 <a class="code" href="classegiw.html#c70d13d86e0d9f0acede3e1dc0368812" title="Dimension of the regressor.">nPsi</a> = <a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>.<a class="code" href="group__math.html#g96dfb21865db4f5bd36fa70f9b0b1163" title="access function">rows</a>()-<a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e" title="Dimension of the output.">xdim</a>; 
     121<a name="l00175"></a>00175                 <span class="comment">//set mu to have proper normalization and </span> 
     122<a name="l00176"></a>00176                 <span class="keywordflow">if</span> (nu0&lt;0){ 
     123<a name="l00177"></a>00177                         <a class="code" href="classegiw.html#4a2f130b91afe84f6d62fed289d5d453" title="Number of data records (degrees of freedom) of sufficient statistics.">nu</a> = 0.1 +nPsi +2*<a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e" title="Dimension of the output.">xdim</a> +2; <span class="comment">// +2 assures finite expected value of R</span> 
     124<a name="l00178"></a>00178                         <span class="comment">// terms before that are sufficient for finite normalization</span> 
     125<a name="l00179"></a>00179                 } 
     126<a name="l00180"></a>00180         } 
     127<a name="l00182"></a><a class="code" href="classegiw.html#18c1bf6125652a6dcbca68dd02dddd8d">00182</a>         <a class="code" href="classegiw.html#056c094f01ca1cc308d72162f47617c9" title="Default constructor, if nu0&amp;lt;0 a minimal nu0 will be computed.">egiw</a> ( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>, <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> V0, <span class="keywordtype">double</span> nu0=-1.0 ) : <a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> ( rv ), <a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a> ( V0 ), <a class="code" href="classegiw.html#4a2f130b91afe84f6d62fed289d5d453" title="Number of data records (degrees of freedom) of sufficient statistics.">nu</a> ( nu0 ) { 
     128<a name="l00183"></a>00183                 <a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e" title="Dimension of the output.">xdim</a> = rv.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() /<a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>.<a class="code" href="group__math.html#g96dfb21865db4f5bd36fa70f9b0b1163" title="access function">rows</a>(); 
     129<a name="l00184"></a>00184                 it_assert_debug ( rv.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ==<a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e" title="Dimension of the output.">xdim</a>*<a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>.<a class="code" href="group__math.html#g96dfb21865db4f5bd36fa70f9b0b1163" title="access function">rows</a>(),<span class="stringliteral">"Incompatible V0."</span> ); 
     130<a name="l00185"></a>00185                 <a class="code" href="classegiw.html#c70d13d86e0d9f0acede3e1dc0368812" title="Dimension of the regressor.">nPsi</a> = <a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>.<a class="code" href="group__math.html#g96dfb21865db4f5bd36fa70f9b0b1163" title="access function">rows</a>()-<a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e" title="Dimension of the output.">xdim</a>; 
     131<a name="l00186"></a>00186                 <span class="keywordflow">if</span> (nu0&lt;0){ 
     132<a name="l00187"></a>00187                         <a class="code" href="classegiw.html#4a2f130b91afe84f6d62fed289d5d453" title="Number of data records (degrees of freedom) of sufficient statistics.">nu</a> = 0.1 +nPsi +2*<a class="code" href="classegiw.html#3d5c719f15a5527a6c62c2a53160148e" title="Dimension of the output.">xdim</a> +2; <span class="comment">// +2 assures finite expected value of R</span> 
     133<a name="l00188"></a>00188                         <span class="comment">// terms before that are sufficient for finite normalization</span> 
     134<a name="l00189"></a>00189                 } 
     135<a name="l00190"></a>00190         } 
     136<a name="l00191"></a>00191  
     137<a name="l00192"></a>00192         vec <a class="code" href="classegiw.html#3d2c1f2ba0f9966781f1e0ae695e8a6f" title="Returns a sample,  from density .">sample</a>() <span class="keyword">const</span>; 
     138<a name="l00193"></a>00193         vec <a class="code" href="classegiw.html#6deb0ff2859f41ef7cbdf6a842cabb29" title="return expected value">mean</a>() <span class="keyword">const</span>; 
     139<a name="l00194"></a>00194         <span class="keywordtype">void</span> mean_mat ( mat &amp;M, mat&amp;R ) <span class="keyword">const</span>; 
     140<a name="l00196"></a>00196         <span class="keywordtype">double</span> <a class="code" href="classegiw.html#2d94daac10d66bb743e4ddc8c1ba7268" 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>; 
     141<a name="l00197"></a>00197         <span class="keywordtype">double</span> <a class="code" href="classegiw.html#70eb1a0b88459b227f919b425b0d3359" title="logarithm of the normalizing constant, ">lognc</a> () <span class="keyword">const</span>; 
     142<a name="l00198"></a>00198  
     143<a name="l00199"></a>00199         <span class="comment">//Access</span> 
     144<a name="l00201"></a><a class="code" href="classegiw.html#533e792e1175bfa06d5d595dc5d080d5">00201</a> <span class="comment"></span>        <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a>&amp; <a class="code" href="classegiw.html#533e792e1175bfa06d5d595dc5d080d5" title="returns a pointer to the internal statistics. Use with Care!">_V</a>() {<span class="keywordflow">return</span> <a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>;} 
     145<a name="l00203"></a><a class="code" href="classegiw.html#a46c8a206edf80b357a138d7491780c1">00203</a>         <span class="keyword">const</span> <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a>&amp; <a class="code" href="classegiw.html#533e792e1175bfa06d5d595dc5d080d5" title="returns a pointer to the internal statistics. Use with Care!">_V</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>;} 
     146<a name="l00205"></a><a class="code" href="classegiw.html#08029c481ff95d24f093df0573879afe">00205</a>         <span class="keywordtype">double</span>&amp; <a class="code" href="classegiw.html#08029c481ff95d24f093df0573879afe" title="returns a pointer to the internal statistics. Use with Care!">_nu</a>()  {<span class="keywordflow">return</span> <a class="code" href="classegiw.html#4a2f130b91afe84f6d62fed289d5d453" title="Number of data records (degrees of freedom) of sufficient statistics.">nu</a>;} 
     147<a name="l00206"></a>00206         <span class="keyword">const</span> <span class="keywordtype">double</span>&amp; <a class="code" href="classegiw.html#08029c481ff95d24f093df0573879afe" title="returns a pointer to the internal statistics. Use with Care!">_nu</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classegiw.html#4a2f130b91afe84f6d62fed289d5d453" title="Number of data records (degrees of freedom) of sufficient statistics.">nu</a>;} 
     148<a name="l00207"></a><a class="code" href="classegiw.html#036306322a90a9977834baac07460816">00207</a>         <span class="keywordtype">void</span> <a class="code" href="classegiw.html#036306322a90a9977834baac07460816" title="Power of the density, used e.g. to flatten the density.">pow</a> ( <span class="keywordtype">double</span> p ) {<a class="code" href="classegiw.html#f343d03ede89db820edf44a6297fa442" title="Extended information matrix of sufficient statistics.">V</a>*=p;<a class="code" href="classegiw.html#4a2f130b91afe84f6d62fed289d5d453" title="Number of data records (degrees of freedom) of sufficient statistics.">nu</a>*=p;}; 
     149<a name="l00208"></a>00208 }; 
     150<a name="l00209"></a>00209  
     151<a name="l00218"></a><a class="code" href="classeDirich.html">00218</a> <span class="keyword">class </span><a class="code" href="classeDirich.html" title="Dirichlet posterior density.">eDirich</a>: <span class="keyword">public</span> <a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> { 
     152<a name="l00219"></a>00219 <span class="keyword">protected</span>: 
     153<a name="l00221"></a><a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7">00221</a>         vec <a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a>; 
     154<a name="l00222"></a>00222 <span class="keyword">public</span>: 
     155<a name="l00224"></a><a class="code" href="classeDirich.html#ac7e6116f3575c3860d07355e96cd4af">00224</a>         <a class="code" href="classeDirich.html#ac7e6116f3575c3860d07355e96cd4af" title="Default constructor.">eDirich</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>, <span class="keyword">const</span> vec &amp;beta0 ) : <a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> ( rv ),<a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a> ( beta0 ) {it_assert_debug ( rv.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ==<a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a>.length(),<span class="stringliteral">"Incompatible statistics"</span> ); }; 
     156<a name="l00226"></a><a class="code" href="classeDirich.html#55cccbc5eb44764dce722567acf5fd58">00226</a>         <a class="code" href="classeDirich.html#ac7e6116f3575c3860d07355e96cd4af" title="Default constructor.">eDirich</a> ( <span class="keyword">const</span> <a class="code" href="classeDirich.html" title="Dirichlet posterior density.">eDirich</a> &amp;D0 ) : <a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> ( D0.<a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a> ),<a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a> ( D0.<a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a> ) {}; 
     157<a name="l00227"></a><a class="code" href="classeDirich.html#23dff79110822e9639343fe8e177fd80">00227</a>         vec <a class="code" href="classeDirich.html#23dff79110822e9639343fe8e177fd80" title="Returns a sample,  from density .">sample</a>()<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> vec_1 ( 0.0 );}; 
     158<a name="l00228"></a><a class="code" href="classeDirich.html#4206e1da149d51ff3b663c9241096b73">00228</a>         vec <a class="code" href="classeDirich.html#4206e1da149d51ff3b663c9241096b73" title="return expected value">mean</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a>/sum ( <a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a> );}; 
     159<a name="l00230"></a><a class="code" href="classeDirich.html#bb4b14ed7794777386de10608a83d142">00230</a>         <span class="keywordtype">double</span> <a class="code" href="classeDirich.html#bb4b14ed7794777386de10608a83d142" title="In this instance, val is ...">evallog_nn</a> ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const </span>{<span class="keywordtype">double</span> tmp; tmp=( <a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a>-1 ) *log ( val );            it_assert_debug(std::isfinite(tmp),<span class="stringliteral">"Infinite value"</span>); 
     160<a name="l00231"></a>00231         <span class="keywordflow">return</span> tmp;}; 
     161<a name="l00232"></a><a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77">00232</a>         <span class="keywordtype">double</span> <a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77" title="logarithm of the normalizing constant, ">lognc</a> ()<span class="keyword"> const </span>{ 
     162<a name="l00233"></a>00233                 <span class="keywordtype">double</span> tmp; 
     163<a name="l00234"></a>00234                 <span class="keywordtype">double</span> gam=sum ( <a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a> ); 
     164<a name="l00235"></a>00235                 <span class="keywordtype">double</span> lgb=0.0; 
     165<a name="l00236"></a>00236                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a>.length();i++ ) {lgb+=lgamma ( <a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a> ( i ) );} 
     166<a name="l00237"></a>00237                 tmp= lgb-lgamma ( gam ); 
     167<a name="l00238"></a>00238                 it_assert_debug(std::isfinite(tmp),<span class="stringliteral">"Infinite value"</span>); 
     168<a name="l00239"></a>00239                 <span class="keywordflow">return</span> tmp; 
     169<a name="l00240"></a>00240         }; 
     170<a name="l00242"></a><a class="code" href="classeDirich.html#6409d0362143a23976b43641ff19e53a">00242</a>         vec&amp; <a class="code" href="classeDirich.html#6409d0362143a23976b43641ff19e53a" title="access function">_beta</a>()  {<span class="keywordflow">return</span> <a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a>;} 
     171<a name="l00244"></a><a class="code" href="classeDirich.html#c842acb2e1cce5cc9000769ff06c086d">00244</a>         <span class="keywordtype">void</span> <a class="code" href="classeDirich.html#c842acb2e1cce5cc9000769ff06c086d" title="Set internal parameters.">set_parameters</a> ( <span class="keyword">const</span> vec &amp;beta0 ) { 
     172<a name="l00245"></a>00245                 <span class="keywordflow">if</span> ( beta0.length() !=<a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a>.length() ) { 
     173<a name="l00246"></a>00246                         it_assert_debug ( <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>.<a class="code" href="classRV.html#c114a6f3ff06796cc2f4dacba74291eb" title="Return length (number of entries) of the RV.">length</a>() ==1,<span class="stringliteral">"Undefined"</span> ); 
     174<a name="l00247"></a>00247                         <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>.<a class="code" href="classRV.html#70b24c39c5130b1e4753fa2eef495433" title="access function">set_size</a> ( 0,beta0.length() ); 
     175<a name="l00248"></a>00248                 } 
     176<a name="l00249"></a>00249                 <a class="code" href="classeDirich.html#15e6b65e9595eedc8a1286c6cecd36d7" title="sufficient statistics">beta</a>= beta0; 
     177<a name="l00250"></a>00250         } 
     178<a name="l00251"></a>00251 }; 
     179<a name="l00252"></a>00252  
     180<a name="l00254"></a><a class="code" href="classmultiBM.html">00254</a> <span class="keyword">class </span><a class="code" href="classmultiBM.html" title="Estimator for Multinomial density.">multiBM</a> : <span class="keyword">public</span> <a class="code" href="classBMEF.html" title="Estimator for Exponential family.">BMEF</a> { 
     181<a name="l00255"></a>00255 <span class="keyword">protected</span>: 
     182<a name="l00257"></a><a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5">00257</a>         <a class="code" href="classeDirich.html" title="Dirichlet posterior density.">eDirich</a> <a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>; 
     183<a name="l00259"></a><a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6">00259</a>         vec &amp;<a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a>; 
     184<a name="l00260"></a>00260 <span class="keyword">public</span>: 
     185<a name="l00262"></a><a class="code" href="classmultiBM.html#7d7d7e78c129602bcde96078359dc6e5">00262</a>         <a class="code" href="classmultiBM.html#7d7d7e78c129602bcde96078359dc6e5" title="Default constructor.">multiBM</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a>, <span class="keyword">const</span> vec beta0 ) : <a class="code" href="classBMEF.html" title="Estimator for Exponential family.">BMEF</a> ( rv ),<a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a> ( rv,beta0 ),<a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a> ( <a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>._beta() ) {<span class="keywordflow">if</span>(<a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a>.length()&gt;0){<a class="code" href="classBMEF.html#308cf5d4133cd471fdf1ecd5dfa09d02" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>=<a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>.<a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77" title="logarithm of the normalizing constant, ">lognc</a>();}<span class="keywordflow">else</span>{<a class="code" href="classBMEF.html#308cf5d4133cd471fdf1ecd5dfa09d02" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>=0.0;}} 
     186<a name="l00264"></a><a class="code" href="classmultiBM.html#b92751adbfb9f259ca8c95232cfd9c09">00264</a>         <a class="code" href="classmultiBM.html#7d7d7e78c129602bcde96078359dc6e5" title="Default constructor.">multiBM</a> ( <span class="keyword">const</span> <a class="code" href="classmultiBM.html" title="Estimator for Multinomial density.">multiBM</a> &amp;B ) : <a class="code" href="classBMEF.html" title="Estimator for Exponential family.">BMEF</a> ( B ),<a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a> ( <a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a>,B.<a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a> ),<a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a> ( <a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>._beta() ) {} 
     187<a name="l00266"></a><a class="code" href="classmultiBM.html#42e36804041e551d3ceea6c75abc0562">00266</a>         <span class="keywordtype">void</span> <a class="code" href="classmultiBM.html#42e36804041e551d3ceea6c75abc0562" title="Sets sufficient statistics to match that of givefrom mB0.">set_statistics</a> ( <span class="keyword">const</span> <a class="code" href="classBM.html" title="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</a>* mB0 ) {<span class="keyword">const</span> <a class="code" href="classmultiBM.html" title="Estimator for Multinomial density.">multiBM</a>* mB=<span class="keyword">dynamic_cast&lt;</span><span class="keyword">const </span><a class="code" href="classmultiBM.html" title="Estimator for Multinomial density.">multiBM</a>*<span class="keyword">&gt;</span> ( mB0 ); <a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a>=mB-&gt;<a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a>;} 
     188<a name="l00267"></a><a class="code" href="classmultiBM.html#11eeba7e97954e316e959116f90d80e2">00267</a>         <span class="keywordtype">void</span> <a class="code" href="classmultiBM.html#11eeba7e97954e316e959116f90d80e2" title="Incremental Bayes rule.">bayes</a> ( <span class="keyword">const</span> vec &amp;dt ) { 
     189<a name="l00268"></a>00268                 <span class="keywordflow">if</span> ( <a class="code" href="classBMEF.html#538d632e59f9afa8daa1de74da12ce71" title="forgetting factor">frg</a>&lt;1.0 ) {<a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a>*=<a class="code" href="classBMEF.html#538d632e59f9afa8daa1de74da12ce71" title="forgetting factor">frg</a>;<a class="code" href="classBMEF.html#308cf5d4133cd471fdf1ecd5dfa09d02" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>=<a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>.<a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77" title="logarithm of the normalizing constant, ">lognc</a>();} 
     190<a name="l00269"></a>00269                 <a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a>+=dt; 
     191<a name="l00270"></a>00270                 <span class="keywordflow">if</span> ( <a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ) {<a class="code" href="classBM.html#5623fef6572a08c2b53b8c87b82dc979" title="Logarithm of marginalized data likelihood.">ll</a>=<a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>.<a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77" title="logarithm of the normalizing constant, ">lognc</a>()-<a class="code" href="classBMEF.html#308cf5d4133cd471fdf1ecd5dfa09d02" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>;} 
     192<a name="l00271"></a>00271         } 
     193<a name="l00272"></a><a class="code" href="classmultiBM.html#13e26a61757278981fd8cac9a7ef91eb">00272</a>         <span class="keywordtype">double</span> <a class="code" href="classmultiBM.html#13e26a61757278981fd8cac9a7ef91eb">logpred</a> ( <span class="keyword">const</span> vec &amp;dt )<span class="keyword"> const </span>{ 
     194<a name="l00273"></a>00273                 <a class="code" href="classeDirich.html" title="Dirichlet posterior density.">eDirich</a> pred ( <a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a> ); 
     195<a name="l00274"></a>00274                 vec &amp;<a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a> = pred.<a class="code" href="classeDirich.html#6409d0362143a23976b43641ff19e53a" title="access function">_beta</a>(); 
     196<a name="l00275"></a>00275  
     197<a name="l00276"></a>00276                 <span class="keywordtype">double</span> lll; 
     198<a name="l00277"></a>00277                 <span class="keywordflow">if</span> ( <a class="code" href="classBMEF.html#538d632e59f9afa8daa1de74da12ce71" title="forgetting factor">frg</a>&lt;1.0 ) 
     199<a name="l00278"></a>00278                         {beta*=<a class="code" href="classBMEF.html#538d632e59f9afa8daa1de74da12ce71" title="forgetting factor">frg</a>;lll=pred.<a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77" title="logarithm of the normalizing constant, ">lognc</a>();} 
     200<a name="l00279"></a>00279                 <span class="keywordflow">else</span> 
     201<a name="l00280"></a>00280                         <span class="keywordflow">if</span> ( <a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ) {lll=<a class="code" href="classBMEF.html#308cf5d4133cd471fdf1ecd5dfa09d02" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>;} 
     202<a name="l00281"></a>00281                         <span class="keywordflow">else</span>{lll=pred.<a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77" title="logarithm of the normalizing constant, ">lognc</a>();} 
     203<a name="l00282"></a>00282  
     204<a name="l00283"></a>00283                 beta+=dt; 
     205<a name="l00284"></a>00284                 <span class="keywordflow">return</span> pred.<a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77" title="logarithm of the normalizing constant, ">lognc</a>()-lll; 
     206<a name="l00285"></a>00285         } 
     207<a name="l00286"></a><a class="code" href="classmultiBM.html#3988322f8f51b153622036f461f62a67">00286</a>         <span class="keywordtype">void</span> <a class="code" href="classmultiBM.html#3988322f8f51b153622036f461f62a67" title="Flatten the posterior according to the given BMEF (of the same type!).">flatten</a> ( <span class="keyword">const</span> <a class="code" href="classBMEF.html" title="Estimator for Exponential family.">BMEF</a>* B ) { 
     208<a name="l00287"></a>00287                 <span class="keyword">const</span> <a class="code" href="classmultiBM.html" title="Estimator for Multinomial density.">multiBM</a>* E=<span class="keyword">dynamic_cast&lt;</span><span class="keyword">const </span><a class="code" href="classmultiBM.html" title="Estimator for Multinomial density.">multiBM</a>*<span class="keyword">&gt;</span> ( B ); 
     209<a name="l00288"></a>00288                 <span class="comment">// sum(beta) should be equal to sum(B.beta)</span> 
     210<a name="l00289"></a>00289                 <span class="keyword">const</span> vec &amp;Eb=E-&gt;<a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a>;<span class="comment">//const_cast&lt;multiBM*&gt; ( E )-&gt;_beta();</span> 
     211<a name="l00290"></a>00290                 <a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a>*= ( sum ( Eb ) /sum ( <a class="code" href="classmultiBM.html#7b606116aed7e8834a339cbb0424b1d6" title="Pointer inside est to sufficient statistics.">beta</a> ) ); 
     212<a name="l00291"></a>00291                 <span class="keywordflow">if</span> ( <a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ) {<a class="code" href="classBMEF.html#308cf5d4133cd471fdf1ecd5dfa09d02" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>=<a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>.<a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77" title="logarithm of the normalizing constant, ">lognc</a>();} 
     213<a name="l00292"></a>00292         } 
     214<a name="l00293"></a><a class="code" href="classmultiBM.html#66cdfd83a70bc281840ab0646b941684">00293</a>         <span class="keyword">const</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>&amp; <a class="code" href="classmultiBM.html#66cdfd83a70bc281840ab0646b941684" title="Returns a reference to the epdf representing posterior density on parameters.">_epdf</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>;}; 
     215<a name="l00294"></a><a class="code" href="classmultiBM.html#66a0fa6966e40bb6c3e7ba22d26e9d35">00294</a>         <span class="keyword">const</span> <a class="code" href="classeDirich.html" title="Dirichlet posterior density.">eDirich</a>* <a class="code" href="classmultiBM.html#66a0fa6966e40bb6c3e7ba22d26e9d35" title="Returns a pointer to the epdf representing posterior density on parameters. Use with...">_e</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> &amp;<a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>;}; 
     216<a name="l00295"></a>00295         <span class="keywordtype">void</span> set_parameters ( <span class="keyword">const</span> vec &amp;beta0 ) { 
     217<a name="l00296"></a>00296                 <a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>.<a class="code" href="classeDirich.html#c842acb2e1cce5cc9000769ff06c086d" title="Set internal parameters.">set_parameters</a> ( beta0 ); 
     218<a name="l00297"></a>00297                 <a class="code" href="classBM.html#af00f0612fabe66241dd507188cdbf88" title="Random variable of the posterior.">rv</a> = <a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>.<a class="code" href="classepdf.html#ca0d32aabb4cbba347e0c37fe8607562" title="access function, possibly dangerous!">_rv</a>(); 
     219<a name="l00298"></a>00298                 <span class="keywordflow">if</span> ( <a class="code" href="classBM.html#bf6fb59b30141074f8ee1e2f43d03129" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a> ) {<a class="code" href="classBMEF.html#308cf5d4133cd471fdf1ecd5dfa09d02" title="cached value of lognc() in the previous step (used in evaluation of ll )">last_lognc</a>=<a class="code" href="classmultiBM.html#eddee08a724170de63f36e40c57b27b5" title="Conjugate prior and posterior.">est</a>.<a class="code" href="classeDirich.html#7ce60be7119ffc639ede4e583c1f6e77" title="logarithm of the normalizing constant, ">lognc</a>();} 
     220<a name="l00299"></a>00299         } 
     221<a name="l00300"></a>00300 }; 
     222<a name="l00301"></a>00301  
     223<a name="l00311"></a><a class="code" href="classegamma.html">00311</a> <span class="keyword">class </span><a class="code" href="classegamma.html" title="Gamma posterior density.">egamma</a> : <span class="keyword">public</span> <a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> { 
     224<a name="l00312"></a>00312 <span class="keyword">protected</span>: 
     225<a name="l00314"></a><a class="code" href="classegamma.html#376cebd8932546c440f21b182910b01b">00314</a>         vec <a class="code" href="classegamma.html#376cebd8932546c440f21b182910b01b" title="Vector .">alpha</a>; 
     226<a name="l00316"></a><a class="code" href="classegamma.html#cfc5f136467488a421ab22f886323790">00316</a>         vec <a class="code" href="classegamma.html#cfc5f136467488a421ab22f886323790" title="Vector .">beta</a>; 
     227<a name="l00317"></a>00317 <span class="keyword">public</span> : 
     228<a name="l00319"></a><a class="code" href="classegamma.html#4b1d34f3b244ea51a58ec10c468788c1">00319</a>         <a class="code" href="classegamma.html#4b1d34f3b244ea51a58ec10c468788c1" title="Default constructor.">egamma</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a> ) :<a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> ( rv ) {}; 
     229<a name="l00321"></a><a class="code" href="classegamma.html#8e348b89be82b70471fe8c5630f61339">00321</a>         <span class="keywordtype">void</span> <a class="code" href="classegamma.html#8e348b89be82b70471fe8c5630f61339" title="Sets parameters.">set_parameters</a> ( <span class="keyword">const</span> vec &amp;a, <span class="keyword">const</span> vec &amp;b ) {<a class="code" href="classegamma.html#376cebd8932546c440f21b182910b01b" title="Vector .">alpha</a>=a,<a class="code" href="classegamma.html#cfc5f136467488a421ab22f886323790" title="Vector .">beta</a>=b;}; 
     230<a name="l00322"></a>00322         vec <a class="code" href="classegamma.html#8e10c0021b5dfdd9cb62c6959b5ef425" title="Returns a sample,  from density .">sample</a>() <span class="keyword">const</span>; 
     231<a name="l00324"></a>00324 <span class="comment">//      mat sample ( int N ) const;</span> 
     232<a name="l00325"></a>00325         <span class="keywordtype">double</span> <a class="code" href="classegamma.html#74a49a4c696f44e54bb6b0515e155a9b" title="TODO: is it used anywhere?">evallog</a> ( <span class="keyword">const</span> vec &amp;val ) <span class="keyword">const</span>; 
     233<a name="l00326"></a>00326         <span class="keywordtype">double</span> <a class="code" href="classegamma.html#d6dbbdb72360f9e54d64501f80318bb6" title="logarithm of the normalizing constant, ">lognc</a> () <span class="keyword">const</span>; 
     234<a name="l00328"></a><a class="code" href="classegamma.html#44445c56e60b91b377f207f8d5089790">00328</a>         <span class="keywordtype">void</span> <a class="code" href="classegamma.html#44445c56e60b91b377f207f8d5089790" title="Returns poiter to alpha and beta. Potentially dengerous: use with care!">_param</a> ( vec* &amp;a, vec* &amp;b ) {a=&amp;<a class="code" href="classegamma.html#376cebd8932546c440f21b182910b01b" title="Vector .">alpha</a>;b=&amp;<a class="code" href="classegamma.html#cfc5f136467488a421ab22f886323790" title="Vector .">beta</a>;}; 
     235<a name="l00329"></a><a class="code" href="classegamma.html#6ab5ba56f7cdb2e5921c3e77524fa50a">00329</a>         vec <a class="code" href="classegamma.html#6ab5ba56f7cdb2e5921c3e77524fa50a" title="return expected value">mean</a>()<span class="keyword"> const </span>{vec pom ( <a class="code" href="classegamma.html#376cebd8932546c440f21b182910b01b" title="Vector .">alpha</a> ); pom/=<a class="code" href="classegamma.html#cfc5f136467488a421ab22f886323790" title="Vector .">beta</a>; <span class="keywordflow">return</span> pom;} 
     236<a name="l00330"></a>00330 }; 
     237<a name="l00331"></a>00331 <span class="comment">/*</span> 
     238<a name="l00333"></a>00333 <span class="comment">class emix : public epdf {</span> 
     239<a name="l00334"></a>00334 <span class="comment">protected:</span> 
     240<a name="l00335"></a>00335 <span class="comment">        int n;</span> 
     241<a name="l00336"></a>00336 <span class="comment">        vec &amp;w;</span> 
     242<a name="l00337"></a>00337 <span class="comment">        Array&lt;epdf*&gt; Coms;</span> 
     243<a name="l00338"></a>00338 <span class="comment">public:</span> 
     244<a name="l00340"></a>00340 <span class="comment">        emix ( const RV &amp;rv, vec &amp;w0): epdf(rv), n(w0.length()), w(w0), Coms(n) {};</span> 
     245<a name="l00341"></a>00341 <span class="comment">        void set_parameters( int &amp;i, double wi, epdf* ep){w(i)=wi;Coms(i)=ep;}</span> 
     246<a name="l00342"></a>00342 <span class="comment">        vec mean(){vec pom; for(int i=0;i&lt;n;i++){pom+=Coms(i)-&gt;mean()*w(i);} return pom;};</span> 
     247<a name="l00343"></a>00343 <span class="comment">        vec sample() {it_error ( "Not implemented" );return 0;}</span> 
     248<a name="l00344"></a>00344 <span class="comment">};</span> 
     249<a name="l00345"></a>00345 <span class="comment">*/</span> 
     250<a name="l00346"></a>00346  
     251<a name="l00348"></a>00348  
     252<a name="l00349"></a><a class="code" href="classeuni.html">00349</a> <span class="keyword">class </span><a class="code" href="classeuni.html" title="Uniform distributed density on a rectangular support.">euni</a>: <span class="keyword">public</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> { 
     253<a name="l00350"></a>00350 <span class="keyword">protected</span>: 
     254<a name="l00352"></a><a class="code" href="classeuni.html#ef42cd8d7645422048d46c46ec5cdac1">00352</a>         vec <a class="code" href="classeuni.html#ef42cd8d7645422048d46c46ec5cdac1" title="lower bound on support">low</a>; 
     255<a name="l00354"></a><a class="code" href="classeuni.html#71b6d6b41aeb61a7f76f682b72119231">00354</a>         vec <a class="code" href="classeuni.html#71b6d6b41aeb61a7f76f682b72119231" title="upper bound on support">high</a>; 
     256<a name="l00356"></a><a class="code" href="classeuni.html#52a6ff4a54010f88a6a19fca605c64a4">00356</a>         vec <a class="code" href="classeuni.html#52a6ff4a54010f88a6a19fca605c64a4" title="internal">distance</a>; 
     257<a name="l00358"></a><a class="code" href="classeuni.html#63105490e946e43372d6187ad1bafdda">00358</a>         <span class="keywordtype">double</span> <a class="code" href="classeuni.html#63105490e946e43372d6187ad1bafdda" title="normalizing coefficients">nk</a>; 
     258<a name="l00360"></a><a class="code" href="classeuni.html#f445a0ce24f39d14c1a4eed53fc8e2c3">00360</a>         <span class="keywordtype">double</span> <a class="code" href="classeuni.html#f445a0ce24f39d14c1a4eed53fc8e2c3" title="cache of log( nk )">lnk</a>; 
     259<a name="l00361"></a>00361 <span class="keyword">public</span>: 
     260<a name="l00363"></a><a class="code" href="classeuni.html#2537a6c239cff52e3ba814851a1116cd">00363</a>         <a class="code" href="classeuni.html#2537a6c239cff52e3ba814851a1116cd" title="Defualt constructor.">euni</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a> ) :<a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> ( rv ) {} 
     261<a name="l00364"></a>00364         <span class="keywordtype">double</span> eval ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const  </span>{<span class="keywordflow">return</span> <a class="code" href="classeuni.html#63105490e946e43372d6187ad1bafdda" title="normalizing coefficients">nk</a>;} 
     262<a name="l00365"></a><a class="code" href="classeuni.html#357b36417ef4c9211d12e7a4a602fd6a">00365</a>         <span class="keywordtype">double</span> <a class="code" href="classeuni.html#357b36417ef4c9211d12e7a4a602fd6a" title="Compute log-probability of argument val.">evallog</a> ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const  </span>{<span class="keywordflow">return</span> <a class="code" href="classeuni.html#f445a0ce24f39d14c1a4eed53fc8e2c3" title="cache of log( nk )">lnk</a>;} 
     263<a name="l00366"></a><a class="code" href="classeuni.html#4a0e09392be17beaee120ba98fc038cd">00366</a>         vec <a class="code" href="classeuni.html#4a0e09392be17beaee120ba98fc038cd" title="Returns a sample,  from density .">sample</a>()<span class="keyword"> const </span>{ 
     264<a name="l00367"></a>00367                 vec smp ( <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ); 
     265<a name="l00368"></a>00368 <span class="preprocessor">#pragma omp critical</span> 
     266<a name="l00369"></a>00369 <span class="preprocessor"></span>                UniRNG.sample_vector ( <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>(),smp ); 
     267<a name="l00370"></a>00370                 <span class="keywordflow">return</span> <a class="code" href="classeuni.html#ef42cd8d7645422048d46c46ec5cdac1" title="lower bound on support">low</a>+elem_mult ( <a class="code" href="classeuni.html#52a6ff4a54010f88a6a19fca605c64a4" title="internal">distance</a>,smp ); 
     268<a name="l00371"></a>00371         } 
     269<a name="l00373"></a><a class="code" href="classeuni.html#4fd7c6a05100616ad16ece405cad7bf2">00373</a>         <span class="keywordtype">void</span> <a class="code" href="classeuni.html#4fd7c6a05100616ad16ece405cad7bf2" title="set values of low and high ">set_parameters</a> ( <span class="keyword">const</span> vec &amp;low0, <span class="keyword">const</span> vec &amp;high0 ) { 
     270<a name="l00374"></a>00374                 <a class="code" href="classeuni.html#52a6ff4a54010f88a6a19fca605c64a4" title="internal">distance</a> = high0-low0; 
     271<a name="l00375"></a>00375                 it_assert_debug ( min ( <a class="code" href="classeuni.html#52a6ff4a54010f88a6a19fca605c64a4" title="internal">distance</a> ) &gt;0.0,<span class="stringliteral">"bad support"</span> ); 
     272<a name="l00376"></a>00376                 <a class="code" href="classeuni.html#ef42cd8d7645422048d46c46ec5cdac1" title="lower bound on support">low</a> = low0; 
     273<a name="l00377"></a>00377                 <a class="code" href="classeuni.html#71b6d6b41aeb61a7f76f682b72119231" title="upper bound on support">high</a> = high0; 
     274<a name="l00378"></a>00378                 <a class="code" href="classeuni.html#63105490e946e43372d6187ad1bafdda" title="normalizing coefficients">nk</a> = prod ( 1.0/<a class="code" href="classeuni.html#52a6ff4a54010f88a6a19fca605c64a4" title="internal">distance</a> ); 
     275<a name="l00379"></a>00379                 <a class="code" href="classeuni.html#f445a0ce24f39d14c1a4eed53fc8e2c3" title="cache of log( nk )">lnk</a> = log ( <a class="code" href="classeuni.html#63105490e946e43372d6187ad1bafdda" title="normalizing coefficients">nk</a> ); 
     276<a name="l00380"></a>00380         } 
     277<a name="l00381"></a><a class="code" href="classeuni.html#8050087e421a9cfd1b4b1f8bd33b1cc1">00381</a>         vec <a class="code" href="classeuni.html#8050087e421a9cfd1b4b1f8bd33b1cc1" title="return expected value">mean</a>()<span class="keyword"> const </span>{vec pom=<a class="code" href="classeuni.html#71b6d6b41aeb61a7f76f682b72119231" title="upper bound on support">high</a>; pom-=<a class="code" href="classeuni.html#ef42cd8d7645422048d46c46ec5cdac1" title="lower bound on support">low</a>; pom/=2.0; <span class="keywordflow">return</span> pom;} 
     278<a name="l00382"></a>00382 }; 
     279<a name="l00383"></a>00383  
     280<a name="l00384"></a>00384  
     281<a name="l00390"></a>00390 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     282<a name="l00391"></a><a class="code" href="classmlnorm.html">00391</a> <span class="keyword">class </span><a class="code" href="classmlnorm.html" title="Normal distributed linear function with linear function of mean value;.">mlnorm</a> : <span class="keyword">public</span> <a class="code" href="classmEF.html" title="Exponential family model.">mEF</a> { 
     283<a name="l00392"></a>00392 <span class="keyword">protected</span>: 
     284<a name="l00394"></a><a class="code" href="classmlnorm.html#b76ee2171ace4fb3ff95a131ae8fc421">00394</a>         <a class="code" href="classenorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">enorm&lt;sq_T&gt;</a> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>; 
     285<a name="l00395"></a>00395         mat A; 
     286<a name="l00396"></a>00396         vec mu_const; 
     287<a name="l00397"></a>00397         vec&amp; _mu; <span class="comment">//cached epdf.mu;</span> 
     288<a name="l00398"></a>00398 <span class="keyword">public</span>: 
     289<a name="l00400"></a>00400         <a class="code" href="classmlnorm.html#3a5ad4798d8a3878c5e93b8e796c8837" title="Constructor.">mlnorm</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a>, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classmpdf.html#acb7dda792b3cd5576f39fa3129abbab" title="random variable in condition">rvc</a> ); 
     290<a name="l00402"></a>00402         <span class="keywordtype">void</span> <a class="code" href="classmlnorm.html#f95dfce0b500636a44ecd7e5210de999" title="Set A and R.">set_parameters</a> ( <span class="keyword">const</span>  mat &amp;A, <span class="keyword">const</span> vec &amp;mu0, <span class="keyword">const</span> sq_T &amp;R ); 
     291<a name="l00403"></a>00403 <span class="comment">//      //!Generate one sample of the posterior</span> 
     292<a name="l00404"></a>00404 <span class="comment">//      vec samplecond (const vec &amp;cond, double &amp;lik );</span> 
     293<a name="l00405"></a>00405 <span class="comment">//      //!Generate matrix of samples of the posterior</span> 
     294<a name="l00406"></a>00406 <span class="comment">//      mat samplecond (const vec &amp;cond, vec &amp;lik, int n );</span> 
     295<a name="l00408"></a>00408 <span class="comment"></span>        <span class="keywordtype">void</span> <a class="code" href="classmlnorm.html#d41126455ac64b888a38f677886e1b40" title="Set value of rvc . Result of this operation is stored in epdf use function _ep to...">condition</a> ( <span class="keyword">const</span> vec &amp;cond ); 
     296<a name="l00409"></a>00409  
     297<a name="l00411"></a><a class="code" href="classmlnorm.html#2732ae47835dd25d5784bf08fde0a546">00411</a>         vec&amp; <a class="code" href="classmlnorm.html#2732ae47835dd25d5784bf08fde0a546" title="access function">_mu_const</a>() {<span class="keywordflow">return</span> mu_const;} 
     298<a name="l00413"></a><a class="code" href="classmlnorm.html#65ec3840c21b21102896bfd2282b47b3">00413</a>         mat&amp; <a class="code" href="classmlnorm.html#65ec3840c21b21102896bfd2282b47b3" title="access function">_A</a>() {<span class="keywordflow">return</span> A;} 
     299<a name="l00415"></a><a class="code" href="classmlnorm.html#3ff2b03fbb5e1133a5fe1bf831939f63">00415</a>         mat <a class="code" href="classmlnorm.html#3ff2b03fbb5e1133a5fe1bf831939f63" title="access function">_R</a>() {<span class="keywordflow">return</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>._R().to_mat();} 
     300<a name="l00416"></a>00416  
     301<a name="l00417"></a>00417         <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_M&gt; 
     302<a name="l00418"></a>00418         <span class="keyword">friend</span> std::ostream &amp;operator&lt;&lt; ( std::ostream &amp;os,  mlnorm&lt;sq_M&gt; &amp;ml ); 
     303<a name="l00419"></a>00419 }; 
     304<a name="l00420"></a>00420  
     305<a name="l00423"></a><a class="code" href="classmlstudent.html">00423</a> <span class="keyword">class </span><a class="code" href="classmlstudent.html">mlstudent</a> : <span class="keyword">public</span> <a class="code" href="classmlnorm.html" title="Normal distributed linear function with linear function of mean value;.">mlnorm</a>&lt;ldmat&gt; { 
     306<a name="l00424"></a>00424 <span class="keyword">protected</span>: 
     307<a name="l00425"></a>00425         <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> Lambda; 
     308<a name="l00426"></a>00426         <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> &amp;<a class="code" href="classmlnorm.html#3ff2b03fbb5e1133a5fe1bf831939f63" title="access function">_R</a>; 
     309<a name="l00427"></a>00427         <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> Re; 
     310<a name="l00428"></a>00428 <span class="keyword">public</span>: 
     311<a name="l00429"></a>00429         <a class="code" href="classmlstudent.html">mlstudent</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv0, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvc0 ) :<a class="code" href="classmlnorm.html" title="Normal distributed linear function with linear function of mean value;.">mlnorm&lt;ldmat&gt;</a> ( rv0,rvc0 ), 
     312<a name="l00430"></a>00430                         Lambda ( rv0.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ), 
     313<a name="l00431"></a>00431                         <a class="code" href="classmlnorm.html#3ff2b03fbb5e1133a5fe1bf831939f63" title="access function">_R</a> ( <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>._R() ) {} 
     314<a name="l00432"></a>00432         <span class="keywordtype">void</span> set_parameters ( <span class="keyword">const</span> mat &amp;A0, <span class="keyword">const</span> vec &amp;mu0, <span class="keyword">const</span> <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a> &amp;R0, <span class="keyword">const</span> <a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a>&amp; Lambda0) { 
     315<a name="l00433"></a>00433                 <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.set_parameters ( zeros ( <a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a>.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ),Lambda ); 
     316<a name="l00434"></a>00434                 A = A0; 
     317<a name="l00435"></a>00435                 mu_const = mu0; 
     318<a name="l00436"></a>00436                 Re=R0; 
     319<a name="l00437"></a>00437                 Lambda = Lambda0; 
     320<a name="l00438"></a>00438         } 
     321<a name="l00439"></a><a class="code" href="classmlstudent.html#d153460ae0180f4bc7f28301f5cde876">00439</a>         <span class="keywordtype">void</span> <a class="code" href="classmlstudent.html#d153460ae0180f4bc7f28301f5cde876" title="Set value of rvc . Result of this operation is stored in epdf use function _ep to...">condition</a> ( <span class="keyword">const</span> vec &amp;cond ) { 
     322<a name="l00440"></a>00440                 _mu = A*cond + mu_const; 
     323<a name="l00441"></a>00441                 <span class="keywordtype">double</span> zeta; 
     324<a name="l00442"></a>00442                 <span class="comment">//ugly hack!</span> 
     325<a name="l00443"></a>00443                 <span class="keywordflow">if</span> ((cond.length()+1)==Lambda.<a class="code" href="group__math.html#g96dfb21865db4f5bd36fa70f9b0b1163" title="access function">rows</a>()){ 
     326<a name="l00444"></a>00444                         zeta = Lambda.<a class="code" href="classldmat.html#d876c5f83e02b3e809b35c9de5068f14" title="Evaluates quadratic form ;.">invqform</a> ( <a class="code" href="group__core.html#g33c114e83980d883c5b211c47d5322a4" title="Concat two random variables.">concat</a>(cond, vec_1(1.0)) ); 
     327<a name="l00445"></a>00445                 } <span class="keywordflow">else</span> { 
     328<a name="l00446"></a>00446                         zeta = Lambda.<a class="code" href="classldmat.html#d876c5f83e02b3e809b35c9de5068f14" title="Evaluates quadratic form ;.">invqform</a> ( cond ); 
     329<a name="l00447"></a>00447                 } 
     330<a name="l00448"></a>00448                 <a class="code" href="classmlnorm.html#3ff2b03fbb5e1133a5fe1bf831939f63" title="access function">_R</a> = Re; 
     331<a name="l00449"></a>00449                 <a class="code" href="classmlnorm.html#3ff2b03fbb5e1133a5fe1bf831939f63" title="access function">_R</a>*=( 1+zeta );<span class="comment">// / ( nu ); &lt;&lt; nu is in Re!!!!!!</span> 
     332<a name="l00450"></a>00450         }; 
     333<a name="l00451"></a>00451  
     334<a name="l00452"></a>00452 }; 
     335<a name="l00462"></a><a class="code" href="classmgamma.html">00462</a> <span class="keyword">class </span><a class="code" href="classmgamma.html" title="Gamma random walk.">mgamma</a> : <span class="keyword">public</span> <a class="code" href="classmEF.html" title="Exponential family model.">mEF</a> { 
     336<a name="l00463"></a>00463 <span class="keyword">protected</span>: 
     337<a name="l00465"></a><a class="code" href="classmgamma.html#612dbf35c770a780027619aaac2c443e">00465</a>         <a class="code" href="classegamma.html" title="Gamma posterior density.">egamma</a> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>; 
     338<a name="l00467"></a><a class="code" href="classmgamma.html#43f733cce0245a52363d566099add687">00467</a>         <span class="keywordtype">double</span> <a class="code" href="classmgamma.html#43f733cce0245a52363d566099add687" title="Constant .">k</a>; 
     339<a name="l00469"></a><a class="code" href="classmgamma.html#5e90652837448bcc29707e7412f99691">00469</a>         vec* <a class="code" href="classmgamma.html#5e90652837448bcc29707e7412f99691" title="cache of epdf.beta">_beta</a>; 
     340<a name="l00470"></a>00470  
     341<a name="l00471"></a>00471 <span class="keyword">public</span>: 
     342<a name="l00473"></a>00473         <a class="code" href="classmgamma.html#af43e61b86900c0398d5c0ffc83b94e6" title="Constructor.">mgamma</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a>,<span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classmpdf.html#acb7dda792b3cd5576f39fa3129abbab" title="random variable in condition">rvc</a> ); 
     343<a name="l00475"></a>00475         <span class="keywordtype">void</span> <a class="code" href="classmgamma.html#a9d646cf758a70126dde7c48790b6e94" title="Set value of k.">set_parameters</a> ( <span class="keywordtype">double</span> <a class="code" href="classmgamma.html#43f733cce0245a52363d566099add687" title="Constant .">k</a> ); 
     344<a name="l00476"></a><a class="code" href="classmgamma.html#a61094c9f7a2d64ea77b130cbc031f97">00476</a>         <span class="keywordtype">void</span> <a class="code" href="classmgamma.html#a61094c9f7a2d64ea77b130cbc031f97" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( <span class="keyword">const</span> vec &amp;val ) {*<a class="code" href="classmgamma.html#5e90652837448bcc29707e7412f99691" title="cache of epdf.beta">_beta</a>=<a class="code" href="classmgamma.html#43f733cce0245a52363d566099add687" title="Constant .">k</a>/val;}; 
     345<a name="l00477"></a>00477 }; 
     346<a name="l00478"></a>00478  
     347<a name="l00490"></a><a class="code" href="classmgamma__fix.html">00490</a> <span class="keyword">class </span><a class="code" href="classmgamma__fix.html" title="Gamma random walk around a fixed point.">mgamma_fix</a> : <span class="keyword">public</span> <a class="code" href="classmgamma.html" title="Gamma random walk.">mgamma</a> { 
     348<a name="l00491"></a>00491 <span class="keyword">protected</span>: 
     349<a name="l00493"></a><a class="code" href="classmgamma__fix.html#3f48c09caddc298901ad75fe7c0529f6">00493</a>         <span class="keywordtype">double</span> <a class="code" href="classmgamma__fix.html#3f48c09caddc298901ad75fe7c0529f6" title="parameter l">l</a>; 
     350<a name="l00495"></a><a class="code" href="classmgamma__fix.html#81ce49029ecc385418619b200dcafeb0">00495</a>         vec <a class="code" href="classmgamma__fix.html#81ce49029ecc385418619b200dcafeb0" title="reference vector">refl</a>; 
     351<a name="l00496"></a>00496 <span class="keyword">public</span>: 
     352<a name="l00498"></a><a class="code" href="classmgamma__fix.html#b92c3d2e5fd0381033a072e5ef3bcf80">00498</a>         <a class="code" href="classmgamma__fix.html#b92c3d2e5fd0381033a072e5ef3bcf80" title="Constructor.">mgamma_fix</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a>,<span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;<a class="code" href="classmpdf.html#acb7dda792b3cd5576f39fa3129abbab" title="random variable in condition">rvc</a> ) : <a class="code" href="classmgamma.html" title="Gamma random walk.">mgamma</a> ( rv,rvc ),<a class="code" href="classmgamma__fix.html#81ce49029ecc385418619b200dcafeb0" title="reference vector">refl</a> ( rv.count() ) {}; 
     353<a name="l00500"></a><a class="code" href="classmgamma__fix.html#ec6f846896749e27cb7be9fa48dd1cb1">00500</a>         <span class="keywordtype">void</span> <a class="code" href="classmgamma__fix.html#ec6f846896749e27cb7be9fa48dd1cb1" title="Set value of k.">set_parameters</a> ( <span class="keywordtype">double</span> k0 , vec ref0, <span class="keywordtype">double</span> l0 ) { 
     354<a name="l00501"></a>00501                 <a class="code" href="classmgamma.html#a9d646cf758a70126dde7c48790b6e94" title="Set value of k.">mgamma::set_parameters</a> ( k0 ); 
     355<a name="l00502"></a>00502                 <a class="code" href="classmgamma__fix.html#81ce49029ecc385418619b200dcafeb0" title="reference vector">refl</a>=pow ( ref0,1.0-l0 );<a class="code" href="classmgamma__fix.html#3f48c09caddc298901ad75fe7c0529f6" title="parameter l">l</a>=l0; 
     356<a name="l00503"></a>00503         }; 
     357<a name="l00504"></a>00504  
     358<a name="l00505"></a><a class="code" href="classmgamma__fix.html#6ea3931eec7b7da7b693e45981052460">00505</a>         <span class="keywordtype">void</span> <a class="code" href="classmgamma__fix.html#6ea3931eec7b7da7b693e45981052460" title="Update ep so that it represents this mpdf conditioned on rvc = cond.">condition</a> ( <span class="keyword">const</span> vec &amp;val ) {vec mean=elem_mult ( <a class="code" href="classmgamma__fix.html#81ce49029ecc385418619b200dcafeb0" title="reference vector">refl</a>,pow ( val,<a class="code" href="classmgamma__fix.html#3f48c09caddc298901ad75fe7c0529f6" title="parameter l">l</a> ) ); *<a class="code" href="classmgamma.html#5e90652837448bcc29707e7412f99691" title="cache of epdf.beta">_beta</a>=<a class="code" href="classmgamma.html#43f733cce0245a52363d566099add687" title="Constant .">k</a>/mean;}; 
     359<a name="l00506"></a>00506 }; 
     360<a name="l00507"></a>00507  
     361<a name="l00509"></a><a class="code" href="libEF_8h.html#99497a3ff630f761cf6bff7babd23212">00509</a> <span class="keyword">enum</span> <a class="code" href="libEF_8h.html#99497a3ff630f761cf6bff7babd23212" title="Switch between various resampling methods.">RESAMPLING_METHOD</a> { MULTINOMIAL = 0, STRATIFIED = 1, SYSTEMATIC = 3 }; 
     362<a name="l00515"></a><a class="code" href="classeEmp.html">00515</a> <span class="keyword">class </span><a class="code" href="classeEmp.html" title="Weighted empirical density.">eEmp</a>: <span class="keyword">public</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> { 
     363<a name="l00516"></a>00516 <span class="keyword">protected</span> : 
     364<a name="l00518"></a><a class="code" href="classeEmp.html#8c33034de0e35f03f8bb85d3d67438fd">00518</a>         <span class="keywordtype">int</span> <a class="code" href="classeEmp.html#8c33034de0e35f03f8bb85d3d67438fd" title="Number of particles.">n</a>; 
     365<a name="l00520"></a><a class="code" href="classeEmp.html#ae78d144404ddba843c93b171b215de8">00520</a>         vec <a class="code" href="classeEmp.html#ae78d144404ddba843c93b171b215de8" title="Sample weights .">w</a>; 
     366<a name="l00522"></a><a class="code" href="classeEmp.html#a4d6f4bbd6a6824fc39f14676701279a">00522</a>         Array&lt;vec&gt; <a class="code" href="classeEmp.html#a4d6f4bbd6a6824fc39f14676701279a" title="Samples .">samples</a>; 
     367<a name="l00523"></a>00523 <span class="keyword">public</span>: 
     368<a name="l00525"></a><a class="code" href="classeEmp.html#0c04b073ecd0dae3d498e680ae27e9e4">00525</a>         <a class="code" href="classeEmp.html#0c04b073ecd0dae3d498e680ae27e9e4" title="Default constructor.">eEmp</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv0 ,<span class="keywordtype">int</span> n0 ) :<a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> ( rv0 ),<a class="code" href="classeEmp.html#8c33034de0e35f03f8bb85d3d67438fd" title="Number of particles.">n</a> ( n0 ),<a class="code" href="classeEmp.html#ae78d144404ddba843c93b171b215de8" title="Sample weights .">w</a> ( <a class="code" href="classeEmp.html#8c33034de0e35f03f8bb85d3d67438fd" title="Number of particles.">n</a> ),<a class="code" href="classeEmp.html#a4d6f4bbd6a6824fc39f14676701279a" title="Samples .">samples</a> ( <a class="code" href="classeEmp.html#8c33034de0e35f03f8bb85d3d67438fd" title="Number of particles.">n</a> ) {}; 
     369<a name="l00527"></a>00527         <span class="keywordtype">void</span> <a class="code" href="classeEmp.html#eab03bd3381aaea11ce34d5a26556353" title="Set samples and weights.">set_parameters</a> ( <span class="keyword">const</span> vec &amp;w0, <span class="keyword">const</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* pdf0 ); 
     370<a name="l00529"></a>00529         <span class="keywordtype">void</span> <a class="code" href="classeEmp.html#e31bc9e6196173c3480b06a761a3e716" title="Set sample.">set_samples</a> ( <span class="keyword">const</span> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* pdf0 ); 
     371<a name="l00531"></a><a class="code" href="classeEmp.html#a4215f6a5a04d07b43f7ebaa942e15f1">00531</a>         <span class="keywordtype">void</span> <a class="code" href="classeEmp.html#a4215f6a5a04d07b43f7ebaa942e15f1" title="Set sample.">set_n</a> ( <span class="keywordtype">int</span> n0, <span class="keywordtype">bool</span> copy=<span class="keyword">true</span> ){<a class="code" href="classeEmp.html#ae78d144404ddba843c93b171b215de8" title="Sample weights .">w</a>.set_size(n0,copy);<a class="code" href="classeEmp.html#a4d6f4bbd6a6824fc39f14676701279a" title="Samples .">samples</a>.set_size(n0,copy);}; 
     372<a name="l00533"></a><a class="code" href="classeEmp.html#31b2bfb73b72486a5c89f2ab850c7a9b">00533</a>         vec&amp; <a class="code" href="classeEmp.html#31b2bfb73b72486a5c89f2ab850c7a9b" title="Potentially dangerous, use with care.">_w</a>()  {<span class="keywordflow">return</span> <a class="code" href="classeEmp.html#ae78d144404ddba843c93b171b215de8" title="Sample weights .">w</a>;}; 
     373<a name="l00535"></a><a class="code" href="classeEmp.html#d6f4ae1a67ecd2bff8b9f176ee261afc">00535</a>         <span class="keyword">const</span> vec&amp; <a class="code" href="classeEmp.html#31b2bfb73b72486a5c89f2ab850c7a9b" title="Potentially dangerous, use with care.">_w</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classeEmp.html#ae78d144404ddba843c93b171b215de8" title="Sample weights .">w</a>;}; 
     374<a name="l00537"></a><a class="code" href="classeEmp.html#31b747eca73b16f30370827ba4cc3575">00537</a>         Array&lt;vec&gt;&amp; <a class="code" href="classeEmp.html#31b747eca73b16f30370827ba4cc3575" title="access function">_samples</a>() {<span class="keywordflow">return</span> <a class="code" href="classeEmp.html#a4d6f4bbd6a6824fc39f14676701279a" title="Samples .">samples</a>;}; 
     375<a name="l00539"></a><a class="code" href="classeEmp.html#bd48c1c36e2e9e78dbcea7df66dcbf25">00539</a>         <span class="keyword">const</span> Array&lt;vec&gt;&amp; <a class="code" href="classeEmp.html#31b747eca73b16f30370827ba4cc3575" title="access function">_samples</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classeEmp.html#a4d6f4bbd6a6824fc39f14676701279a" title="Samples .">samples</a>;}; 
     376<a name="l00541"></a>00541         ivec <a class="code" href="classeEmp.html#77268292fc4465cb73ddbfb1f2932a59" title="Function performs resampling, i.e. removal of low-weight samples and duplication...">resample</a> ( <a class="code" href="libEF_8h.html#99497a3ff630f761cf6bff7babd23212" title="Switch between various resampling methods.">RESAMPLING_METHOD</a> method = SYSTEMATIC ); 
     377<a name="l00543"></a><a class="code" href="classeEmp.html#83f9283f92b805508d896479dc1ccf12">00543</a>         vec <a class="code" href="classeEmp.html#83f9283f92b805508d896479dc1ccf12" title="inherited operation : NOT implemneted">sample</a>()<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> 0;} 
     378<a name="l00545"></a><a class="code" href="classeEmp.html#884f16c9fc1f888408686a660a95dacd">00545</a>         <span class="keywordtype">double</span> <a class="code" href="classeEmp.html#884f16c9fc1f888408686a660a95dacd" title="inherited operation : NOT implemneted">evallog</a> ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> 0.0;} 
     379<a name="l00546"></a><a class="code" href="classeEmp.html#ba055c19038cc72628d98e25197e982d">00546</a>         vec <a class="code" href="classeEmp.html#ba055c19038cc72628d98e25197e982d" title="return expected value">mean</a>()<span class="keyword"> const </span>{ 
     380<a name="l00547"></a>00547                 vec pom=zeros ( <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ); 
     381<a name="l00548"></a>00548                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classeEmp.html#8c33034de0e35f03f8bb85d3d67438fd" title="Number of particles.">n</a>;i++ ) {pom+=<a class="code" href="classeEmp.html#a4d6f4bbd6a6824fc39f14676701279a" title="Samples .">samples</a> ( i ) *<a class="code" href="classeEmp.html#ae78d144404ddba843c93b171b215de8" title="Sample weights .">w</a> ( i );} 
     382<a name="l00549"></a>00549                 <span class="keywordflow">return</span> pom; 
     383<a name="l00550"></a>00550         } 
     384<a name="l00551"></a>00551 }; 
     385<a name="l00552"></a>00552  
    384386<a name="l00553"></a>00553  
    385 <a name="l00554"></a>00554 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    386 <a name="l00555"></a><a class="code" href="classenorm.html#1394a65caa6e00d42e00cc99b12227af">00555</a> <span class="keywordtype">void</span> <a class="code" href="classenorm.html#1394a65caa6e00d42e00cc99b12227af" title="Set mean value mu and covariance R.">enorm&lt;sq_T&gt;::set_parameters</a> ( <span class="keyword">const</span> vec &amp;mu0, <span class="keyword">const</span> sq_T &amp;R0 ) { 
    387 <a name="l00556"></a>00556 <span class="comment">//Fixme test dimensions of mu0 and R0;</span> 
    388 <a name="l00557"></a>00557         <a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a> = mu0; 
    389 <a name="l00558"></a>00558         <a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a> = R0; 
    390 <a name="l00559"></a>00559 }; 
    391 <a name="l00560"></a>00560  
    392 <a name="l00561"></a>00561 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    393 <a name="l00562"></a><a class="code" href="classenorm.html#5bf185e31e5954fceb90ada3debd2ff2">00562</a> <span class="keywordtype">void</span> <a class="code" href="classenorm.html#5bf185e31e5954fceb90ada3debd2ff2" title="dupdate in exponential form (not really handy)">enorm&lt;sq_T&gt;::dupdate</a> ( mat &amp;v, <span class="keywordtype">double</span> nu ) { 
    394 <a name="l00563"></a>00563         <span class="comment">//</span> 
     387<a name="l00555"></a>00555  
     388<a name="l00556"></a>00556 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     389<a name="l00557"></a><a class="code" href="classenorm.html#0caf54fed9e48f9fe28b534b2027df2f">00557</a> <a class="code" href="classenorm.html#0caf54fed9e48f9fe28b534b2027df2f" title="Default constructor.">enorm&lt;sq_T&gt;::enorm</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv ) :<a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> ( rv ), mu ( rv.count() ),R ( rv.count() ),dim ( rv.count() ) {}; 
     390<a name="l00558"></a>00558  
     391<a name="l00559"></a>00559 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     392<a name="l00560"></a><a class="code" href="classenorm.html#1394a65caa6e00d42e00cc99b12227af">00560</a> <span class="keywordtype">void</span> <a class="code" href="classenorm.html#1394a65caa6e00d42e00cc99b12227af" title="Set mean value mu and covariance R.">enorm&lt;sq_T&gt;::set_parameters</a> ( <span class="keyword">const</span> vec &amp;mu0, <span class="keyword">const</span> sq_T &amp;R0 ) { 
     393<a name="l00561"></a>00561 <span class="comment">//Fixme test dimensions of mu0 and R0;</span> 
     394<a name="l00562"></a>00562         <a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a> = mu0; 
     395<a name="l00563"></a>00563         <a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a> = R0; 
    395396<a name="l00564"></a>00564 }; 
    396397<a name="l00565"></a>00565  
    397 <a name="l00566"></a>00566 <span class="comment">// template&lt;class sq_T&gt;</span> 
    398 <a name="l00567"></a>00567 <span class="comment">// void enorm&lt;sq_T&gt;::tupdate ( double phi, mat &amp;vbar, double nubar ) {</span> 
    399 <a name="l00568"></a>00568 <span class="comment">//      //</span> 
    400 <a name="l00569"></a>00569 <span class="comment">// };</span> 
     398<a name="l00566"></a>00566 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     399<a name="l00567"></a><a class="code" href="classenorm.html#5bf185e31e5954fceb90ada3debd2ff2">00567</a> <span class="keywordtype">void</span> <a class="code" href="classenorm.html#5bf185e31e5954fceb90ada3debd2ff2" title="dupdate in exponential form (not really handy)">enorm&lt;sq_T&gt;::dupdate</a> ( mat &amp;v, <span class="keywordtype">double</span> nu ) { 
     400<a name="l00568"></a>00568         <span class="comment">//</span> 
     401<a name="l00569"></a>00569 }; 
    401402<a name="l00570"></a>00570  
    402 <a name="l00571"></a>00571 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    403 <a name="l00572"></a><a class="code" href="classenorm.html#60b47544f6181ffd4530d3e415ce12c5">00572</a> vec <a class="code" href="classenorm.html#60b47544f6181ffd4530d3e415ce12c5" title="Returns a sample,  from density .">enorm&lt;sq_T&gt;::sample</a>()<span class="keyword"> const </span>{ 
    404 <a name="l00573"></a>00573         vec x ( <a class="code" href="classenorm.html#6938fc390a19cdaf6ad4503fcbaada4e" title="dimension (redundant from rv.count() for easier coding )">dim</a> ); 
    405 <a name="l00574"></a>00574         NorRNG.sample_vector ( <a class="code" href="classenorm.html#6938fc390a19cdaf6ad4503fcbaada4e" title="dimension (redundant from rv.count() for easier coding )">dim</a>,x ); 
    406 <a name="l00575"></a>00575         vec smp = <a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>.sqrt_mult ( x ); 
    407 <a name="l00576"></a>00576  
    408 <a name="l00577"></a>00577         smp += <a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a>; 
    409 <a name="l00578"></a>00578         <span class="keywordflow">return</span> smp; 
    410 <a name="l00579"></a>00579 }; 
    411 <a name="l00580"></a>00580  
    412 <a name="l00581"></a>00581 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    413 <a name="l00582"></a><a class="code" href="classenorm.html#60f0f3bfa53d6e65843eea9532b16d36">00582</a> mat <a class="code" href="classenorm.html#60b47544f6181ffd4530d3e415ce12c5" title="Returns a sample,  from density .">enorm&lt;sq_T&gt;::sample</a> ( <span class="keywordtype">int</span> N )<span class="keyword"> const </span>{ 
    414 <a name="l00583"></a>00583         mat X ( <a class="code" href="classenorm.html#6938fc390a19cdaf6ad4503fcbaada4e" title="dimension (redundant from rv.count() for easier coding )">dim</a>,N ); 
    415 <a name="l00584"></a>00584         vec x ( <a class="code" href="classenorm.html#6938fc390a19cdaf6ad4503fcbaada4e" title="dimension (redundant from rv.count() for easier coding )">dim</a> ); 
    416 <a name="l00585"></a>00585         vec pom; 
    417 <a name="l00586"></a>00586         <span class="keywordtype">int</span> i; 
    418 <a name="l00587"></a>00587  
    419 <a name="l00588"></a>00588         <span class="keywordflow">for</span> ( i=0;i&lt;N;i++ ) { 
    420 <a name="l00589"></a>00589                 NorRNG.sample_vector ( <a class="code" href="classenorm.html#6938fc390a19cdaf6ad4503fcbaada4e" title="dimension (redundant from rv.count() for easier coding )">dim</a>,x ); 
    421 <a name="l00590"></a>00590                 pom = <a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>.sqrt_mult ( x ); 
    422 <a name="l00591"></a>00591                 pom +=<a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a>; 
    423 <a name="l00592"></a>00592                 X.set_col ( i, pom ); 
    424 <a name="l00593"></a>00593         } 
    425 <a name="l00594"></a>00594  
    426 <a name="l00595"></a>00595         <span class="keywordflow">return</span> X; 
    427 <a name="l00596"></a>00596 }; 
    428 <a name="l00597"></a>00597  
    429 <a name="l00598"></a>00598 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    430 <a name="l00599"></a>00599 <span class="keywordtype">double</span> <a class="code" href="classenorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">enorm&lt;sq_T&gt;::eval</a> ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const </span>{ 
    431 <a name="l00600"></a>00600         <span class="keywordtype">double</span> pdfl,e; 
    432 <a name="l00601"></a>00601         pdfl = <a class="code" href="classeEF.html#6466e8d4aa9dd64698ed288cbb1afc03" title="Evaluate normalized log-probability.">evalpdflog</a> ( val ); 
    433 <a name="l00602"></a>00602         e = exp ( pdfl ); 
    434 <a name="l00603"></a>00603         <span class="keywordflow">return</span> e; 
    435 <a name="l00604"></a>00604 }; 
    436 <a name="l00605"></a>00605  
    437 <a name="l00606"></a>00606 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    438 <a name="l00607"></a><a class="code" href="classenorm.html#c1e3dcba256b0153cfdb286120e110be">00607</a> <span class="keywordtype">double</span> <a class="code" href="classenorm.html#c1e3dcba256b0153cfdb286120e110be" title="Evaluate normalized log-probability.">enorm&lt;sq_T&gt;::evalpdflog_nn</a> ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const </span>{ 
    439 <a name="l00608"></a>00608         <span class="comment">// 1.83787706640935 = log(2pi)</span> 
    440 <a name="l00609"></a>00609         <span class="keywordtype">double</span> tmp=-0.5* ( <a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>.invqform ( <a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a>-val ) );<span class="comment">// - lognc();</span> 
    441 <a name="l00610"></a>00610         <span class="keywordflow">return</span>  tmp; 
    442 <a name="l00611"></a>00611 }; 
    443 <a name="l00612"></a>00612  
    444 <a name="l00613"></a>00613 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    445 <a name="l00614"></a><a class="code" href="classenorm.html#b289a36a69db59d182bb6eba9c05d4a8">00614</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="classenorm.html#b289a36a69db59d182bb6eba9c05d4a8" title="logarithm of the normalizing constant, ">enorm&lt;sq_T&gt;::lognc</a> ()<span class="keyword"> const </span>{ 
    446 <a name="l00615"></a>00615         <span class="comment">// 1.83787706640935 = log(2pi)</span> 
    447 <a name="l00616"></a>00616         <span class="keywordtype">double</span> tmp=0.5* ( <a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>.cols() * 1.83787706640935 +<a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>.logdet() ); 
    448 <a name="l00617"></a>00617         <span class="keywordflow">return</span> tmp; 
    449 <a name="l00618"></a>00618 }; 
    450 <a name="l00619"></a>00619  
    451 <a name="l00620"></a>00620 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    452 <a name="l00621"></a><a class="code" href="classmlnorm.html#3a5ad4798d8a3878c5e93b8e796c8837">00621</a> <a class="code" href="classmlnorm.html#3a5ad4798d8a3878c5e93b8e796c8837" title="Constructor.">mlnorm&lt;sq_T&gt;::mlnorm</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv0, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvc0 ) :<a class="code" href="classmEF.html" title="Exponential family model.">mEF</a> ( rv0,rvc0 ),<a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> ( rv0 ),A ( rv0.count(),rv0.count() ),<a class="code" href="classenorm.html#0b8cb284e5af920a1b64a21d057ec5ac" title="returns a pointer to the internal mean value. Use with Care!">_mu</a> ( <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.<a class="code" href="classenorm.html#0b8cb284e5af920a1b64a21d057ec5ac" title="returns a pointer to the internal mean value. Use with Care!">_mu</a>() ) { 
    453 <a name="l00622"></a>00622         <a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a> =&amp;<a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>; 
    454 <a name="l00623"></a>00623 } 
     403<a name="l00571"></a>00571 <span class="comment">// template&lt;class sq_T&gt;</span> 
     404<a name="l00572"></a>00572 <span class="comment">// void enorm&lt;sq_T&gt;::tupdate ( double phi, mat &amp;vbar, double nubar ) {</span> 
     405<a name="l00573"></a>00573 <span class="comment">//      //</span> 
     406<a name="l00574"></a>00574 <span class="comment">// };</span> 
     407<a name="l00575"></a>00575  
     408<a name="l00576"></a>00576 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     409<a name="l00577"></a><a class="code" href="classenorm.html#60b47544f6181ffd4530d3e415ce12c5">00577</a> vec <a class="code" href="classenorm.html#60b47544f6181ffd4530d3e415ce12c5" title="Returns a sample,  from density .">enorm&lt;sq_T&gt;::sample</a>()<span class="keyword"> const </span>{ 
     410<a name="l00578"></a>00578         vec x ( <a class="code" href="classenorm.html#6938fc390a19cdaf6ad4503fcbaada4e" title="dimension (redundant from rv.count() for easier coding )">dim</a> ); 
     411<a name="l00579"></a>00579         NorRNG.sample_vector ( <a class="code" href="classenorm.html#6938fc390a19cdaf6ad4503fcbaada4e" title="dimension (redundant from rv.count() for easier coding )">dim</a>,x ); 
     412<a name="l00580"></a>00580         vec smp = <a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>.sqrt_mult ( x ); 
     413<a name="l00581"></a>00581  
     414<a name="l00582"></a>00582         smp += <a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a>; 
     415<a name="l00583"></a>00583         <span class="keywordflow">return</span> smp; 
     416<a name="l00584"></a>00584 }; 
     417<a name="l00585"></a>00585  
     418<a name="l00586"></a>00586 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     419<a name="l00587"></a><a class="code" href="classenorm.html#60f0f3bfa53d6e65843eea9532b16d36">00587</a> mat <a class="code" href="classenorm.html#60b47544f6181ffd4530d3e415ce12c5" title="Returns a sample,  from density .">enorm&lt;sq_T&gt;::sample</a> ( <span class="keywordtype">int</span> N )<span class="keyword"> const </span>{ 
     420<a name="l00588"></a>00588         mat X ( <a class="code" href="classenorm.html#6938fc390a19cdaf6ad4503fcbaada4e" title="dimension (redundant from rv.count() for easier coding )">dim</a>,N ); 
     421<a name="l00589"></a>00589         vec x ( <a class="code" href="classenorm.html#6938fc390a19cdaf6ad4503fcbaada4e" title="dimension (redundant from rv.count() for easier coding )">dim</a> ); 
     422<a name="l00590"></a>00590         vec pom; 
     423<a name="l00591"></a>00591         <span class="keywordtype">int</span> i; 
     424<a name="l00592"></a>00592  
     425<a name="l00593"></a>00593         <span class="keywordflow">for</span> ( i=0;i&lt;N;i++ ) { 
     426<a name="l00594"></a>00594                 NorRNG.sample_vector ( <a class="code" href="classenorm.html#6938fc390a19cdaf6ad4503fcbaada4e" title="dimension (redundant from rv.count() for easier coding )">dim</a>,x ); 
     427<a name="l00595"></a>00595                 pom = <a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>.sqrt_mult ( x ); 
     428<a name="l00596"></a>00596                 pom +=<a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a>; 
     429<a name="l00597"></a>00597                 X.set_col ( i, pom ); 
     430<a name="l00598"></a>00598         } 
     431<a name="l00599"></a>00599  
     432<a name="l00600"></a>00600         <span class="keywordflow">return</span> X; 
     433<a name="l00601"></a>00601 }; 
     434<a name="l00602"></a>00602  
     435<a name="l00603"></a>00603 <span class="comment">// template&lt;class sq_T&gt;</span> 
     436<a name="l00604"></a>00604 <span class="comment">// double enorm&lt;sq_T&gt;::eval ( const vec &amp;val ) const {</span> 
     437<a name="l00605"></a>00605 <span class="comment">//      double pdfl,e;</span> 
     438<a name="l00606"></a>00606 <span class="comment">//      pdfl = evallog ( val );</span> 
     439<a name="l00607"></a>00607 <span class="comment">//      e = exp ( pdfl );</span> 
     440<a name="l00608"></a>00608 <span class="comment">//      return e;</span> 
     441<a name="l00609"></a>00609 <span class="comment">// };</span> 
     442<a name="l00610"></a>00610  
     443<a name="l00611"></a>00611 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     444<a name="l00612"></a><a class="code" href="classenorm.html#50cb0a083d97a7adbbd97c92e712c46c">00612</a> <span class="keywordtype">double</span> <a class="code" href="classenorm.html#50cb0a083d97a7adbbd97c92e712c46c" title="Evaluate normalized log-probability.">enorm&lt;sq_T&gt;::evallog_nn</a> ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const </span>{ 
     445<a name="l00613"></a>00613         <span class="comment">// 1.83787706640935 = log(2pi)</span> 
     446<a name="l00614"></a>00614         <span class="keywordtype">double</span> tmp=-0.5* ( <a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>.invqform ( <a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a>-val ) );<span class="comment">// - lognc();</span> 
     447<a name="l00615"></a>00615         <span class="keywordflow">return</span>  tmp; 
     448<a name="l00616"></a>00616 }; 
     449<a name="l00617"></a>00617  
     450<a name="l00618"></a>00618 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     451<a name="l00619"></a><a class="code" href="classenorm.html#b289a36a69db59d182bb6eba9c05d4a8">00619</a> <span class="keyword">inline</span> <span class="keywordtype">double</span> <a class="code" href="classenorm.html#b289a36a69db59d182bb6eba9c05d4a8" title="logarithm of the normalizing constant, ">enorm&lt;sq_T&gt;::lognc</a> ()<span class="keyword"> const </span>{ 
     452<a name="l00620"></a>00620         <span class="comment">// 1.83787706640935 = log(2pi)</span> 
     453<a name="l00621"></a>00621         <span class="keywordtype">double</span> tmp=0.5* ( <a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>.cols() * 1.83787706640935 +<a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>.logdet() ); 
     454<a name="l00622"></a>00622         <span class="keywordflow">return</span> tmp; 
     455<a name="l00623"></a>00623 }; 
    455456<a name="l00624"></a>00624  
    456457<a name="l00625"></a>00625 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    457 <a name="l00626"></a><a class="code" href="classmlnorm.html#f95dfce0b500636a44ecd7e5210de999">00626</a> <span class="keywordtype">void</span> <a class="code" href="classmlnorm.html#f95dfce0b500636a44ecd7e5210de999" title="Set A and R.">mlnorm&lt;sq_T&gt;::set_parameters</a> ( <span class="keyword">const</span> mat &amp;A0, <span class="keyword">const</span> vec &amp;mu0, <span class="keyword">const</span> sq_T &amp;R0 ) { 
    458 <a name="l00627"></a>00627         <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.set_parameters ( zeros ( <a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a>.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ),R0 ); 
    459 <a name="l00628"></a>00628         A = A0; 
    460 <a name="l00629"></a>00629         mu_const = mu0; 
    461 <a name="l00630"></a>00630 } 
    462 <a name="l00631"></a>00631  
    463 <a name="l00632"></a>00632 <span class="comment">// template&lt;class sq_T&gt;</span> 
    464 <a name="l00633"></a>00633 <span class="comment">// vec mlnorm&lt;sq_T&gt;::samplecond (const  vec &amp;cond, double &amp;lik ) {</span> 
    465 <a name="l00634"></a>00634 <span class="comment">//      this-&gt;condition ( cond );</span> 
    466 <a name="l00635"></a>00635 <span class="comment">//      vec smp = epdf.sample();</span> 
    467 <a name="l00636"></a>00636 <span class="comment">//      lik = epdf.eval ( smp );</span> 
    468 <a name="l00637"></a>00637 <span class="comment">//      return smp;</span> 
    469 <a name="l00638"></a>00638 <span class="comment">// }</span> 
    470 <a name="l00639"></a>00639  
    471 <a name="l00640"></a>00640 <span class="comment">// template&lt;class sq_T&gt;</span> 
    472 <a name="l00641"></a>00641 <span class="comment">// mat mlnorm&lt;sq_T&gt;::samplecond (const vec &amp;cond, vec &amp;lik, int n ) {</span> 
    473 <a name="l00642"></a>00642 <span class="comment">//      int i;</span> 
    474 <a name="l00643"></a>00643 <span class="comment">//      int dim = rv.count();</span> 
    475 <a name="l00644"></a>00644 <span class="comment">//      mat Smp ( dim,n );</span> 
    476 <a name="l00645"></a>00645 <span class="comment">//      vec smp ( dim );</span> 
    477 <a name="l00646"></a>00646 <span class="comment">//      this-&gt;condition ( cond );</span> 
    478 <a name="l00647"></a>00647 <span class="comment">//</span> 
    479 <a name="l00648"></a>00648 <span class="comment">//      for ( i=0; i&lt;n; i++ ) {</span> 
    480 <a name="l00649"></a>00649 <span class="comment">//              smp = epdf.sample();</span> 
    481 <a name="l00650"></a>00650 <span class="comment">//              lik ( i ) = epdf.eval ( smp );</span> 
    482 <a name="l00651"></a>00651 <span class="comment">//              Smp.set_col ( i ,smp );</span> 
    483 <a name="l00652"></a>00652 <span class="comment">//      }</span> 
    484 <a name="l00653"></a>00653 <span class="comment">//</span> 
    485 <a name="l00654"></a>00654 <span class="comment">//      return Smp;</span> 
    486 <a name="l00655"></a>00655 <span class="comment">// }</span> 
    487 <a name="l00656"></a>00656  
    488 <a name="l00657"></a>00657 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    489 <a name="l00658"></a><a class="code" href="classmlnorm.html#d41126455ac64b888a38f677886e1b40">00658</a> <span class="keywordtype">void</span> <a class="code" href="classmlnorm.html#d41126455ac64b888a38f677886e1b40" title="Set value of rvc . Result of this operation is stored in epdf use function _ep to...">mlnorm&lt;sq_T&gt;::condition</a> ( <span class="keyword">const</span> vec &amp;cond ) { 
    490 <a name="l00659"></a>00659         _mu = A*cond + mu_const; 
    491 <a name="l00660"></a>00660 <span class="comment">//R is already assigned;</span> 
    492 <a name="l00661"></a>00661 } 
    493 <a name="l00662"></a>00662  
    494 <a name="l00663"></a>00663 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    495 <a name="l00664"></a><a class="code" href="classenorm.html#af50a6102846060bcb23a670bf38117b">00664</a> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classenorm.html#af50a6102846060bcb23a670bf38117b" title="Return marginal density on the given RV, the remainig rvs are intergrated out.">enorm&lt;sq_T&gt;::marginal</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvn )<span class="keyword"> const </span>{ 
    496 <a name="l00665"></a>00665         ivec irvn = rvn.<a class="code" href="classRV.html#bb724fa4e2d9ed7bfd0993b5975018a4">dataind</a> ( <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a> ); 
    497 <a name="l00666"></a>00666  
    498 <a name="l00667"></a>00667         sq_T Rn ( <a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>,irvn ); 
    499 <a name="l00668"></a>00668         <a class="code" href="classenorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">enorm&lt;sq_T&gt;</a>* tmp = <span class="keyword">new</span> <a class="code" href="classenorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">enorm&lt;sq_T&gt;</a> ( rvn ); 
    500 <a name="l00669"></a>00669         tmp-&gt;<a class="code" href="classenorm.html#1394a65caa6e00d42e00cc99b12227af" title="Set mean value mu and covariance R.">set_parameters</a> ( <a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a> ( irvn ), Rn ); 
    501 <a name="l00670"></a>00670         <span class="keywordflow">return</span> tmp; 
    502 <a name="l00671"></a>00671 } 
    503 <a name="l00672"></a>00672  
    504 <a name="l00673"></a>00673 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    505 <a name="l00674"></a><a class="code" href="classenorm.html#921024bd6d5a0e65f2af2e39bf38dfca">00674</a> <a class="code" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a>* <a class="code" href="classenorm.html#921024bd6d5a0e65f2af2e39bf38dfca" title="Return conditional density on the given RV, the remaining rvs will be in conditioning...">enorm&lt;sq_T&gt;::condition</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvn )<span class="keyword"> const </span>{ 
    506 <a name="l00675"></a>00675  
    507 <a name="l00676"></a>00676         <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rvc = <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>.<a class="code" href="classRV.html#b9d175c327c21488b1e2fb756a84e149" title="Subtract another variable from the current one.">subt</a> ( rvn ); 
    508 <a name="l00677"></a>00677         it_assert_debug ( ( rvc.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() +rvn.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ==<a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ),<span class="stringliteral">"wrong rvn"</span> ); 
    509 <a name="l00678"></a>00678         <span class="comment">//Permutation vector of the new R</span> 
    510 <a name="l00679"></a>00679         ivec irvn = rvn.<a class="code" href="classRV.html#bb724fa4e2d9ed7bfd0993b5975018a4">dataind</a> ( <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a> ); 
    511 <a name="l00680"></a>00680         ivec irvc = rvc.<a class="code" href="classRV.html#bb724fa4e2d9ed7bfd0993b5975018a4">dataind</a> ( <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a> ); 
    512 <a name="l00681"></a>00681         ivec perm=concat ( irvn , irvc ); 
    513 <a name="l00682"></a>00682         sq_T Rn ( <a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>,perm ); 
    514 <a name="l00683"></a>00683  
    515 <a name="l00684"></a>00684         <span class="comment">//fixme - could this be done in general for all sq_T?</span> 
    516 <a name="l00685"></a>00685         mat S=Rn.to_mat(); 
    517 <a name="l00686"></a>00686         <span class="comment">//fixme</span> 
    518 <a name="l00687"></a>00687         <span class="keywordtype">int</span> n=rvn.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>()-1; 
    519 <a name="l00688"></a>00688         <span class="keywordtype">int</span> end=<a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>.rows()-1; 
    520 <a name="l00689"></a>00689         mat S11 = S.get ( 0,n, 0, n ); 
    521 <a name="l00690"></a>00690         mat S12 = S.get ( 0, n , rvn.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>(), end ); 
    522 <a name="l00691"></a>00691         mat S22 = S.get ( rvn.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>(), end, rvn.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>(), end ); 
    523 <a name="l00692"></a>00692  
    524 <a name="l00693"></a>00693         vec mu1 = <a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a> ( irvn ); 
    525 <a name="l00694"></a>00694         vec mu2 = <a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a> ( irvc ); 
    526 <a name="l00695"></a>00695         mat A=S12*inv ( S22 ); 
    527 <a name="l00696"></a>00696         sq_T R_n ( S11 - A *S12.T() ); 
     458<a name="l00626"></a><a class="code" href="classmlnorm.html#3a5ad4798d8a3878c5e93b8e796c8837">00626</a> <a class="code" href="classmlnorm.html#3a5ad4798d8a3878c5e93b8e796c8837" title="Constructor.">mlnorm&lt;sq_T&gt;::mlnorm</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv0, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvc0 ) :<a class="code" href="classmEF.html" title="Exponential family model.">mEF</a> ( rv0,rvc0 ),<a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> ( rv0 ),A ( rv0.count(),rv0.count() ),<a class="code" href="classenorm.html#0b8cb284e5af920a1b64a21d057ec5ac" title="returns a pointer to the internal mean value. Use with Care!">_mu</a> ( <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.<a class="code" href="classenorm.html#0b8cb284e5af920a1b64a21d057ec5ac" title="returns a pointer to the internal mean value. Use with Care!">_mu</a>() ) { 
     459<a name="l00627"></a>00627         <a class="code" href="classmpdf.html#7aa894208a32f3487827df6d5054424c" title="pointer to internal epdf">ep</a> =&amp;<a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>; 
     460<a name="l00628"></a>00628 } 
     461<a name="l00629"></a>00629  
     462<a name="l00630"></a>00630 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     463<a name="l00631"></a><a class="code" href="classmlnorm.html#f95dfce0b500636a44ecd7e5210de999">00631</a> <span class="keywordtype">void</span> <a class="code" href="classmlnorm.html#f95dfce0b500636a44ecd7e5210de999" title="Set A and R.">mlnorm&lt;sq_T&gt;::set_parameters</a> ( <span class="keyword">const</span> mat &amp;A0, <span class="keyword">const</span> vec &amp;mu0, <span class="keyword">const</span> sq_T &amp;R0 ) { 
     464<a name="l00632"></a>00632         <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.set_parameters ( zeros ( <a class="code" href="classmpdf.html#f6687c07ff07d47812dd565368ca59eb" title="modeled random variable">rv</a>.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ),R0 ); 
     465<a name="l00633"></a>00633         A = A0; 
     466<a name="l00634"></a>00634         mu_const = mu0; 
     467<a name="l00635"></a>00635 } 
     468<a name="l00636"></a>00636  
     469<a name="l00637"></a>00637 <span class="comment">// template&lt;class sq_T&gt;</span> 
     470<a name="l00638"></a>00638 <span class="comment">// vec mlnorm&lt;sq_T&gt;::samplecond (const  vec &amp;cond, double &amp;lik ) {</span> 
     471<a name="l00639"></a>00639 <span class="comment">//      this-&gt;condition ( cond );</span> 
     472<a name="l00640"></a>00640 <span class="comment">//      vec smp = epdf.sample();</span> 
     473<a name="l00641"></a>00641 <span class="comment">//      lik = epdf.eval ( smp );</span> 
     474<a name="l00642"></a>00642 <span class="comment">//      return smp;</span> 
     475<a name="l00643"></a>00643 <span class="comment">// }</span> 
     476<a name="l00644"></a>00644  
     477<a name="l00645"></a>00645 <span class="comment">// template&lt;class sq_T&gt;</span> 
     478<a name="l00646"></a>00646 <span class="comment">// mat mlnorm&lt;sq_T&gt;::samplecond (const vec &amp;cond, vec &amp;lik, int n ) {</span> 
     479<a name="l00647"></a>00647 <span class="comment">//      int i;</span> 
     480<a name="l00648"></a>00648 <span class="comment">//      int dim = rv.count();</span> 
     481<a name="l00649"></a>00649 <span class="comment">//      mat Smp ( dim,n );</span> 
     482<a name="l00650"></a>00650 <span class="comment">//      vec smp ( dim );</span> 
     483<a name="l00651"></a>00651 <span class="comment">//      this-&gt;condition ( cond );</span> 
     484<a name="l00652"></a>00652 <span class="comment">//</span> 
     485<a name="l00653"></a>00653 <span class="comment">//      for ( i=0; i&lt;n; i++ ) {</span> 
     486<a name="l00654"></a>00654 <span class="comment">//              smp = epdf.sample();</span> 
     487<a name="l00655"></a>00655 <span class="comment">//              lik ( i ) = epdf.eval ( smp );</span> 
     488<a name="l00656"></a>00656 <span class="comment">//              Smp.set_col ( i ,smp );</span> 
     489<a name="l00657"></a>00657 <span class="comment">//      }</span> 
     490<a name="l00658"></a>00658 <span class="comment">//</span> 
     491<a name="l00659"></a>00659 <span class="comment">//      return Smp;</span> 
     492<a name="l00660"></a>00660 <span class="comment">// }</span> 
     493<a name="l00661"></a>00661  
     494<a name="l00662"></a>00662 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     495<a name="l00663"></a><a class="code" href="classmlnorm.html#d41126455ac64b888a38f677886e1b40">00663</a> <span class="keywordtype">void</span> <a class="code" href="classmlnorm.html#d41126455ac64b888a38f677886e1b40" title="Set value of rvc . Result of this operation is stored in epdf use function _ep to...">mlnorm&lt;sq_T&gt;::condition</a> ( <span class="keyword">const</span> vec &amp;cond ) { 
     496<a name="l00664"></a>00664         _mu = A*cond + mu_const; 
     497<a name="l00665"></a>00665 <span class="comment">//R is already assigned;</span> 
     498<a name="l00666"></a>00666 } 
     499<a name="l00667"></a>00667  
     500<a name="l00668"></a>00668 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     501<a name="l00669"></a><a class="code" href="classenorm.html#af50a6102846060bcb23a670bf38117b">00669</a> <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>* <a class="code" href="classenorm.html#af50a6102846060bcb23a670bf38117b" title="Return marginal density on the given RV, the remainig rvs are intergrated out.">enorm&lt;sq_T&gt;::marginal</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvn )<span class="keyword"> const </span>{ 
     502<a name="l00670"></a>00670         ivec irvn = rvn.<a class="code" href="classRV.html#bb724fa4e2d9ed7bfd0993b5975018a4">dataind</a> ( <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a> ); 
     503<a name="l00671"></a>00671  
     504<a name="l00672"></a>00672         sq_T Rn ( <a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>,irvn ); 
     505<a name="l00673"></a>00673         <a class="code" href="classenorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">enorm&lt;sq_T&gt;</a>* tmp = <span class="keyword">new</span> <a class="code" href="classenorm.html" title="Gaussian density with positive definite (decomposed) covariance matrix.">enorm&lt;sq_T&gt;</a> ( rvn ); 
     506<a name="l00674"></a>00674         tmp-&gt;<a class="code" href="classenorm.html#1394a65caa6e00d42e00cc99b12227af" title="Set mean value mu and covariance R.">set_parameters</a> ( <a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a> ( irvn ), Rn ); 
     507<a name="l00675"></a>00675         <span class="keywordflow">return</span> tmp; 
     508<a name="l00676"></a>00676 } 
     509<a name="l00677"></a>00677  
     510<a name="l00678"></a>00678 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     511<a name="l00679"></a><a class="code" href="classenorm.html#921024bd6d5a0e65f2af2e39bf38dfca">00679</a> <a class="code" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a>* <a class="code" href="classenorm.html#921024bd6d5a0e65f2af2e39bf38dfca" title="Return conditional density on the given RV, the remaining rvs will be in conditioning...">enorm&lt;sq_T&gt;::condition</a> ( <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvn )<span class="keyword"> const </span>{ 
     512<a name="l00680"></a>00680  
     513<a name="l00681"></a>00681         <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rvc = <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>.<a class="code" href="classRV.html#b9d175c327c21488b1e2fb756a84e149" title="Subtract another variable from the current one.">subt</a> ( rvn ); 
     514<a name="l00682"></a>00682         it_assert_debug ( ( rvc.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() +rvn.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ==<a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a>.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>() ),<span class="stringliteral">"wrong rvn"</span> ); 
     515<a name="l00683"></a>00683         <span class="comment">//Permutation vector of the new R</span> 
     516<a name="l00684"></a>00684         ivec irvn = rvn.<a class="code" href="classRV.html#bb724fa4e2d9ed7bfd0993b5975018a4">dataind</a> ( <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a> ); 
     517<a name="l00685"></a>00685         ivec irvc = rvc.<a class="code" href="classRV.html#bb724fa4e2d9ed7bfd0993b5975018a4">dataind</a> ( <a class="code" href="classepdf.html#74da992e3f5d598da8850b646b79b9d9" title="Identified of the random variable.">rv</a> ); 
     518<a name="l00686"></a>00686         ivec perm=<a class="code" href="group__core.html#g33c114e83980d883c5b211c47d5322a4" title="Concat two random variables.">concat</a> ( irvn , irvc ); 
     519<a name="l00687"></a>00687         sq_T Rn ( <a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>,perm ); 
     520<a name="l00688"></a>00688  
     521<a name="l00689"></a>00689         <span class="comment">//fixme - could this be done in general for all sq_T?</span> 
     522<a name="l00690"></a>00690         mat S=Rn.to_mat(); 
     523<a name="l00691"></a>00691         <span class="comment">//fixme</span> 
     524<a name="l00692"></a>00692         <span class="keywordtype">int</span> n=rvn.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>()-1; 
     525<a name="l00693"></a>00693         <span class="keywordtype">int</span> end=<a class="code" href="classenorm.html#4ccc8d8514d644ef1c98d8ab023748a1" title="Covariance matrix in decomposed form.">R</a>.rows()-1; 
     526<a name="l00694"></a>00694         mat S11 = S.get ( 0,n, 0, n ); 
     527<a name="l00695"></a>00695         mat S12 = S.get ( 0, n , rvn.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>(), end ); 
     528<a name="l00696"></a>00696         mat S22 = S.get ( rvn.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>(), end, rvn.<a class="code" href="classRV.html#f5c7b8bd589eef09ccdf3329a0addea0" title="Return number of scalars in the RV.">count</a>(), end ); 
    528529<a name="l00697"></a>00697  
    529 <a name="l00698"></a>00698         <a class="code" href="classmlnorm.html" title="Normal distributed linear function with linear function of mean value;.">mlnorm&lt;sq_T&gt;</a>* tmp=<span class="keyword">new</span> <a class="code" href="classmlnorm.html" title="Normal distributed linear function with linear function of mean value;.">mlnorm&lt;sq_T&gt;</a> ( rvn,rvc ); 
    530 <a name="l00699"></a>00699  
    531 <a name="l00700"></a>00700         tmp-&gt;set_parameters ( A,mu1-A*mu2,R_n ); 
    532 <a name="l00701"></a>00701         <span class="keywordflow">return</span> tmp; 
    533 <a name="l00702"></a>00702 } 
    534 <a name="l00703"></a>00703  
    535 <a name="l00705"></a>00705  
    536 <a name="l00706"></a>00706 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    537 <a name="l00707"></a>00707 std::ostream &amp;operator&lt;&lt; ( std::ostream &amp;os,  mlnorm&lt;sq_T&gt; &amp;ml ) { 
    538 <a name="l00708"></a>00708         os &lt;&lt; <span class="stringliteral">"A:"</span>&lt;&lt; ml.A&lt;&lt;endl; 
    539 <a name="l00709"></a>00709         os &lt;&lt; <span class="stringliteral">"mu:"</span>&lt;&lt; ml.mu_const&lt;&lt;endl; 
    540 <a name="l00710"></a>00710         os &lt;&lt; <span class="stringliteral">"R:"</span> &lt;&lt; ml.epdf._R().to_mat() &lt;&lt;endl; 
    541 <a name="l00711"></a>00711         <span class="keywordflow">return</span> os; 
    542 <a name="l00712"></a>00712 }; 
    543 <a name="l00713"></a>00713  
    544 <a name="l00714"></a>00714 <span class="preprocessor">#endif //EF_H</span> 
     530<a name="l00698"></a>00698         vec mu1 = <a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a> ( irvn ); 
     531<a name="l00699"></a>00699         vec mu2 = <a class="code" href="classenorm.html#71fde0d54bba147e00f612577f95ad20" title="mean value">mu</a> ( irvc ); 
     532<a name="l00700"></a>00700         mat A=S12*inv ( S22 ); 
     533<a name="l00701"></a>00701         sq_T R_n ( S11 - A *S12.T() ); 
     534<a name="l00702"></a>00702  
     535<a name="l00703"></a>00703         <a class="code" href="classmlnorm.html" title="Normal distributed linear function with linear function of mean value;.">mlnorm&lt;sq_T&gt;</a>* tmp=<span class="keyword">new</span> <a class="code" href="classmlnorm.html" title="Normal distributed linear function with linear function of mean value;.">mlnorm&lt;sq_T&gt;</a> ( rvn,rvc ); 
     536<a name="l00704"></a>00704  
     537<a name="l00705"></a>00705         tmp-&gt;set_parameters ( A,mu1-A*mu2,R_n ); 
     538<a name="l00706"></a>00706         <span class="keywordflow">return</span> tmp; 
     539<a name="l00707"></a>00707 } 
     540<a name="l00708"></a>00708  
     541<a name="l00710"></a>00710  
     542<a name="l00711"></a>00711 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     543<a name="l00712"></a>00712 std::ostream &amp;operator&lt;&lt; ( std::ostream &amp;os,  mlnorm&lt;sq_T&gt; &amp;ml ) { 
     544<a name="l00713"></a>00713         os &lt;&lt; <span class="stringliteral">"A:"</span>&lt;&lt; ml.A&lt;&lt;endl; 
     545<a name="l00714"></a>00714         os &lt;&lt; <span class="stringliteral">"mu:"</span>&lt;&lt; ml.mu_const&lt;&lt;endl; 
     546<a name="l00715"></a>00715         os &lt;&lt; <span class="stringliteral">"R:"</span> &lt;&lt; ml.epdf._R().to_mat() &lt;&lt;endl; 
     547<a name="l00716"></a>00716         <span class="keywordflow">return</span> os; 
     548<a name="l00717"></a>00717 }; 
     549<a name="l00718"></a>00718  
     550<a name="l00719"></a>00719 <span class="preprocessor">#endif //EF_H</span> 
    545551</pre></div></div> 
    546 <hr size="1"><address style="text-align: right;"><small>Generated on Wed Nov 12 20:46:06 2008 for mixpp by&nbsp; 
     552<hr size="1"><address style="text-align: right;"><small>Generated on Thu Dec 4 14:42:13 2008 for mixpp by&nbsp; 
    547553<a href="http://www.doxygen.org/index.html"> 
    548554<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address>