Show
Ignore:
Timestamp:
02/16/08 15:12:24 (17 years ago)
Author:
smidl
Message:

Switch to CMake

Files:
1 modified

Legend:

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

    r8 r19  
    11<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
    22<html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> 
    3 <title>mixpp: work/mixpp/libEF.h Source File</title> 
     3<title>mixpp: work/mixpp/bdm/stat/libEF.h Source File</title> 
    44<link href="doxygen.css" rel="stylesheet" type="text/css"> 
    55<link href="tabs.css" rel="stylesheet" type="text/css"> 
     
    1313  </ul> 
    1414</div> 
    15 <h1>work/mixpp/libEF.h</h1><a href="libEF_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001  
     15<h1>work/mixpp/bdm/stat/libEF.h</h1><a href="libEF_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001  
    1616<a name="l00013"></a>00013 <span class="preprocessor">#ifndef EF_H</span> 
    1717<a name="l00014"></a>00014 <span class="preprocessor"></span><span class="preprocessor">#define EF_H</span> 
    1818<a name="l00015"></a>00015 <span class="preprocessor"></span> 
    1919<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;itpp/itbase.h&gt;</span> 
    20 <a name="l00017"></a>00017 <span class="comment">//#include &lt;std&gt;</span> 
    21 <a name="l00018"></a>00018  
    22 <a name="l00019"></a>00019 <span class="keyword">using namespace </span>itpp; 
     20<a name="l00017"></a>00017 <span class="preprocessor">#include "../math/libDC.h"</span> 
     21<a name="l00018"></a>00018 <span class="preprocessor">#include "<a class="code" href="libBM_8h.html" title="Bayesian Models (bm) that use Bayes rule to learn from observations.">libBM.h</a>"</span> 
     22<a name="l00019"></a>00019 <span class="comment">//#include &lt;std&gt;</span> 
    2323<a name="l00020"></a>00020  
    24 <a name="l00026"></a><a class="code" href="classeEF.html">00026</a> <span class="keyword">class </span><a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</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> { 
    25 <a name="l00027"></a>00027  
    26 <a name="l00028"></a>00028 <span class="keyword">public</span>: 
    27 <a name="l00029"></a>00029         <span class="keyword">virtual</span> <span class="keywordtype">void</span> tupdate( <span class="keywordtype">double</span> phi, mat &amp;vbar, <span class="keywordtype">double</span> nubar ){}; 
    28 <a name="l00030"></a>00030         <span class="keyword">virtual</span> <span class="keywordtype">void</span> dupdate( mat &amp;v,<span class="keywordtype">double</span> nu=1.0 ){}; 
    29 <a name="l00031"></a>00031 }; 
    30 <a name="l00032"></a>00032  
    31 <a name="l00033"></a>00033 <span class="keyword">class </span>mEF :<span class="keyword">public</span> <a class="code" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> { 
     24<a name="l00021"></a>00021 <span class="keyword">using namespace </span>itpp; 
     25<a name="l00022"></a>00022  
     26<a name="l00028"></a><a class="code" href="classeEF.html">00028</a> <span class="keyword">class </span><a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</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> { 
     27<a name="l00029"></a>00029  
     28<a name="l00030"></a>00030 <span class="keyword">public</span>: 
     29<a name="l00031"></a>00031         <span class="keyword">virtual</span> <span class="keywordtype">void</span> tupdate( <span class="keywordtype">double</span> phi, mat &amp;vbar, <span class="keywordtype">double</span> nubar ) {}; 
     30<a name="l00032"></a>00032         <span class="keyword">virtual</span> <span class="keywordtype">void</span> dupdate( mat &amp;v,<span class="keywordtype">double</span> nu=1.0 ) {}; 
     31<a name="l00033"></a>00033 }; 
    3232<a name="l00034"></a>00034  
    33 <a name="l00035"></a>00035 <span class="keyword">public</span>: 
     33<a name="l00035"></a>00035 <span class="keyword">class </span>mEF : <span class="keyword">public</span> <a class="code" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> { 
    3434<a name="l00036"></a>00036  
    35 <a name="l00037"></a>00037 }; 
     35<a name="l00037"></a>00037 <span class="keyword">public</span>: 
    3636<a name="l00038"></a>00038  
    37 <a name="l00044"></a>00044 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    38 <a name="l00045"></a><a class="code" href="classenorm.html">00045</a> <span class="keyword">class </span><a class="code" href="classenorm.html" title="General exponential family density.">enorm</a> : <span class="keyword">public</span> <a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> { 
    39 <a name="l00046"></a>00046         vec mu; 
    40 <a name="l00047"></a>00047         sq_T R; 
    41 <a name="l00048"></a>00048 <span class="keyword">public</span>: 
    42 <a name="l00049"></a>00049         <a class="code" href="classenorm.html" title="General exponential family density.">enorm</a>( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv, vec &amp;mu, sq_T &amp;R ); 
    43 <a name="l00050"></a>00050         <a class="code" href="classenorm.html" title="General exponential family density.">enorm</a>(); 
    44 <a name="l00051"></a>00051         <span class="keywordtype">void</span> tupdate( <span class="keywordtype">double</span> phi, mat &amp;vbar, <span class="keywordtype">double</span> nubar ); 
    45 <a name="l00052"></a>00052         <span class="keywordtype">void</span> dupdate( mat &amp;v,<span class="keywordtype">double</span> nu=1.0 ); 
    46 <a name="l00053"></a>00053         vec <a class="code" href="classenorm.html#6020bcd89db2c9584bd8871001bd2023" title="Returns the required moment of the epdf.">sample</a>(); 
    47 <a name="l00054"></a>00054         <span class="keywordtype">double</span> eval( <span class="keyword">const</span> vec &amp;val ); 
    48 <a name="l00055"></a>00055  
    49 <a name="l00056"></a>00056 }; 
    50 <a name="l00057"></a>00057  
    51 <a name="l00061"></a>00061 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    52 <a name="l00062"></a>00062 <span class="keyword">class </span>mlnorm : <span class="keyword">public</span> mEF { 
    53 <a name="l00063"></a>00063         <a class="code" href="classenorm.html" title="General exponential family density.">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>; 
    54 <a name="l00064"></a>00064         mat A; 
    55 <a name="l00065"></a>00065 <span class="keyword">public</span>: 
    56 <a name="l00067"></a>00067         mlnorm( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv,<a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvc, mat &amp;A, sq_T &amp;R ); 
    57 <a name="l00069"></a>00069         vec samplecond( vec &amp;cond, <span class="keywordtype">double</span> &amp;lik ); 
    58 <a name="l00070"></a>00070         mat samplecond( vec &amp;cond, vec &amp;lik, <span class="keywordtype">int</span> n ); 
    59 <a name="l00071"></a>00071         <span class="keywordtype">void</span> condition( vec &amp;cond ); 
    60 <a name="l00072"></a>00072 }; 
    61 <a name="l00073"></a>00073  
    62 <a name="l00075"></a>00075  
    63 <a name="l00076"></a>00076 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    64 <a name="l00077"></a>00077 <a class="code" href="classenorm.html" title="General exponential family density.">enorm&lt;sq_T&gt;::enorm</a>( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv, vec &amp;mu0, sq_T &amp;R0 ) { 
    65 <a name="l00078"></a>00078         mu = mu0; 
    66 <a name="l00079"></a>00079         R = R0; 
    67 <a name="l00080"></a>00080 }; 
    68 <a name="l00081"></a>00081  
    69 <a name="l00082"></a>00082 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    70 <a name="l00083"></a>00083 <span class="keywordtype">void</span> <a class="code" href="classenorm.html" title="General exponential family density.">enorm&lt;sq_T&gt;::dupdate</a>( mat &amp;v, <span class="keywordtype">double</span> nu ) { 
    71 <a name="l00084"></a>00084         <span class="comment">//</span> 
     37<a name="l00039"></a>00039 }; 
     38<a name="l00040"></a>00040  
     39<a name="l00046"></a>00046 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     40<a name="l00047"></a><a class="code" href="classenorm.html">00047</a> <span class="keyword">class </span><a class="code" href="classenorm.html" title="General exponential family density.">enorm</a> : <span class="keyword">public</span> <a class="code" href="classeEF.html" title="General conjugate exponential family posterior density.">eEF</a> { 
     41<a name="l00048"></a>00048         <span class="keywordtype">int</span> dim; 
     42<a name="l00049"></a>00049         vec mu; 
     43<a name="l00050"></a>00050         sq_T R; 
     44<a name="l00051"></a>00051 <span class="keyword">public</span>: 
     45<a name="l00052"></a>00052         <a class="code" href="classenorm.html" title="General exponential family density.">enorm</a>( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv, vec &amp;mu, sq_T &amp;R ); 
     46<a name="l00053"></a>00053         <a class="code" href="classenorm.html" title="General exponential family density.">enorm</a>(); 
     47<a name="l00054"></a>00054         <span class="keywordtype">void</span> tupdate( <span class="keywordtype">double</span> phi, mat &amp;vbar, <span class="keywordtype">double</span> nubar ); 
     48<a name="l00055"></a>00055         <span class="keywordtype">void</span> dupdate( mat &amp;v,<span class="keywordtype">double</span> nu=1.0 ); 
     49<a name="l00056"></a>00056         vec <a class="code" href="classenorm.html#6020bcd89db2c9584bd8871001bd2023" title="Returns the required moment of the epdf.">sample</a>(); 
     50<a name="l00057"></a>00057         mat <a class="code" href="classenorm.html#6020bcd89db2c9584bd8871001bd2023" title="Returns the required moment of the epdf.">sample</a>(<span class="keywordtype">int</span> N); 
     51<a name="l00058"></a>00058         <span class="keywordtype">double</span> eval( <span class="keyword">const</span> vec &amp;val ); 
     52<a name="l00059"></a>00059         Normal_RNG RNG; 
     53<a name="l00060"></a>00060 }; 
     54<a name="l00061"></a>00061  
     55<a name="l00065"></a>00065 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     56<a name="l00066"></a>00066 <span class="keyword">class </span>mlnorm : <span class="keyword">public</span> mEF { 
     57<a name="l00067"></a>00067         <a class="code" href="classenorm.html" title="General exponential family density.">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>; 
     58<a name="l00068"></a>00068         mat A; 
     59<a name="l00069"></a>00069 <span class="keyword">public</span>: 
     60<a name="l00071"></a>00071         mlnorm( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv,<a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvc, mat &amp;A, sq_T &amp;R ); 
     61<a name="l00073"></a>00073         vec samplecond( vec &amp;cond, <span class="keywordtype">double</span> &amp;lik ); 
     62<a name="l00074"></a>00074         mat samplecond( vec &amp;cond, vec &amp;lik, <span class="keywordtype">int</span> n ); 
     63<a name="l00075"></a>00075         <span class="keywordtype">void</span> condition( vec &amp;cond ); 
     64<a name="l00076"></a>00076 }; 
     65<a name="l00077"></a>00077  
     66<a name="l00079"></a>00079  
     67<a name="l00080"></a>00080 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     68<a name="l00081"></a>00081 <a class="code" href="classenorm.html" title="General exponential family density.">enorm&lt;sq_T&gt;::enorm</a>( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv, vec &amp;mu0, sq_T &amp;R0 ) { 
     69<a name="l00082"></a>00082         dim = rv.<a class="code" href="classRV.html#9dcaca7b87cfb0e24a19260067d62f04" title="Return length (number of scalars) of the RV.">count</a>(); 
     70<a name="l00083"></a>00083         mu = mu0; 
     71<a name="l00084"></a>00084         R = R0; 
    7272<a name="l00085"></a>00085 }; 
    7373<a name="l00086"></a>00086  
    7474<a name="l00087"></a>00087 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    75 <a name="l00088"></a>00088 <span class="keywordtype">void</span> <a class="code" href="classenorm.html" title="General exponential family density.">enorm&lt;sq_T&gt;::tupdate</a>( <span class="keywordtype">double</span> phi, mat &amp;vbar, <span class="keywordtype">double</span> nubar ) { 
     75<a name="l00088"></a>00088 <span class="keywordtype">void</span> <a class="code" href="classenorm.html" title="General exponential family density.">enorm&lt;sq_T&gt;::dupdate</a>( mat &amp;v, <span class="keywordtype">double</span> nu ) { 
    7676<a name="l00089"></a>00089         <span class="comment">//</span> 
    7777<a name="l00090"></a>00090 }; 
    7878<a name="l00091"></a>00091  
    7979<a name="l00092"></a>00092 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    80 <a name="l00093"></a><a class="code" href="classenorm.html#6020bcd89db2c9584bd8871001bd2023">00093</a> vec <a class="code" href="classenorm.html#6020bcd89db2c9584bd8871001bd2023" title="Returns the required moment of the epdf.">enorm&lt;sq_T&gt;::sample</a>() { 
     80<a name="l00093"></a>00093 <span class="keywordtype">void</span> <a class="code" href="classenorm.html" title="General exponential family density.">enorm&lt;sq_T&gt;::tupdate</a>( <span class="keywordtype">double</span> phi, mat &amp;vbar, <span class="keywordtype">double</span> nubar ) { 
    8181<a name="l00094"></a>00094         <span class="comment">//</span> 
    8282<a name="l00095"></a>00095 }; 
    8383<a name="l00096"></a>00096  
    8484<a name="l00097"></a>00097 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    85 <a name="l00098"></a>00098 <span class="keywordtype">double</span> <a class="code" href="classenorm.html" title="General exponential family density.">enorm&lt;sq_T&gt;::eval</a>( <span class="keyword">const</span> vec &amp;val ) { 
    86 <a name="l00099"></a>00099         <span class="comment">//</span> 
    87 <a name="l00100"></a>00100 }; 
    88 <a name="l00101"></a>00101  
     85<a name="l00098"></a><a class="code" href="classenorm.html#6020bcd89db2c9584bd8871001bd2023">00098</a> vec <a class="code" href="classenorm.html#6020bcd89db2c9584bd8871001bd2023" title="Returns the required moment of the epdf.">enorm&lt;sq_T&gt;::sample</a>() { 
     86<a name="l00099"></a>00099         vec x( dim ); 
     87<a name="l00100"></a>00100         RNG.sample_vector( dim,x ); 
     88<a name="l00101"></a>00101         vec smp = R.sqrt_mult( x ); 
    8989<a name="l00102"></a>00102  
    90 <a name="l00103"></a>00103 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    91 <a name="l00104"></a>00104 <a class="code" href="classenorm.html" title="General exponential family density.">enorm&lt;sq_T&gt;::enorm</a>() {}; 
    92 <a name="l00105"></a>00105  
    93 <a name="l00106"></a>00106 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    94 <a name="l00107"></a>00107 mlnorm&lt;sq_T&gt;::mlnorm( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv,<a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvc, mat &amp;A, sq_T &amp;R ) { 
    95 <a name="l00108"></a>00108         <span class="keywordtype">int</span> dim = rv.<a class="code" href="classRV.html#a764092415291a0e6452a3711749d18e" title="Return length (number of scalars) of the RV.">length</a>(); 
    96 <a name="l00109"></a>00109         vec mu( dim ); 
    97 <a name="l00110"></a>00110  
    98 <a name="l00111"></a>00111         <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" title="General exponential family density.">enorm&lt;sq_T&gt;</a>( rv,mu,R ); 
    99 <a name="l00112"></a>00112 } 
    100 <a name="l00113"></a>00113  
    101 <a name="l00114"></a>00114 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    102 <a name="l00115"></a>00115 vec mlnorm&lt;sq_T&gt;::samplecond( vec &amp;cond, <span class="keywordtype">double</span> &amp;lik ) { 
    103 <a name="l00116"></a>00116         this-&gt;condition( cond ); 
    104 <a name="l00117"></a>00117         vec smp = <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.sample(); 
    105 <a name="l00118"></a>00118         lik = <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.eval(smp); 
    106 <a name="l00119"></a>00119         <span class="keywordflow">return</span> smp; 
    107 <a name="l00120"></a>00120 } 
     90<a name="l00103"></a>00103         smp += mu; 
     91<a name="l00104"></a>00104         <span class="keywordflow">return</span> smp; 
     92<a name="l00105"></a>00105 }; 
     93<a name="l00106"></a>00106  
     94<a name="l00107"></a>00107 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     95<a name="l00108"></a>00108 mat <a class="code" href="classenorm.html#6020bcd89db2c9584bd8871001bd2023" title="Returns the required moment of the epdf.">enorm&lt;sq_T&gt;::sample</a>( <span class="keywordtype">int</span> N ) { 
     96<a name="l00109"></a>00109         mat X( dim,N ); 
     97<a name="l00110"></a>00110         vec x( dim ); 
     98<a name="l00111"></a>00111         vec pom; 
     99<a name="l00112"></a>00112         <span class="keywordtype">int</span> i; 
     100<a name="l00113"></a>00113         <span class="keywordflow">for</span> ( i=0;i&lt;N;i++ ) { 
     101<a name="l00114"></a>00114                 RNG.sample_vector( dim,x ); 
     102<a name="l00115"></a>00115                 pom = R.sqrt_mult( x ); 
     103<a name="l00116"></a>00116                 pom +=mu; 
     104<a name="l00117"></a>00117                 X.set_col( i, pom); 
     105<a name="l00118"></a>00118         } 
     106<a name="l00119"></a>00119         <span class="keywordflow">return</span> X; 
     107<a name="l00120"></a>00120 }; 
    108108<a name="l00121"></a>00121  
    109109<a name="l00122"></a>00122 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    110 <a name="l00123"></a>00123 mat mlnorm&lt;sq_T&gt;::samplecond( vec &amp;cond, vec &amp;lik, <span class="keywordtype">int</span> n ) { 
    111 <a name="l00124"></a>00124         <span class="keywordtype">int</span> i; 
    112 <a name="l00125"></a>00125         <span class="keywordtype">int</span> dim = rv.<a class="code" href="classRV.html#a764092415291a0e6452a3711749d18e" title="Return length (number of scalars) of the RV.">length</a>(); 
    113 <a name="l00126"></a>00126         mat Smp( dim,n ); 
    114 <a name="l00127"></a>00127         vec smp( dim); 
    115 <a name="l00128"></a>00128         this-&gt;condition( cond ); 
    116 <a name="l00129"></a>00129         <span class="keywordflow">for</span> ( i=0; i&lt;dim; i++ ) { 
    117 <a name="l00130"></a>00130                 smp = <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.sample(); 
    118 <a name="l00131"></a>00131                 lik(i) = <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.eval(smp); 
    119 <a name="l00132"></a>00132                 Smp.set_col( i ,smp); 
    120 <a name="l00133"></a>00133         } 
    121 <a name="l00134"></a>00134         <span class="keywordflow">return</span> Smp; 
    122 <a name="l00135"></a>00135 } 
    123 <a name="l00136"></a>00136  
    124 <a name="l00137"></a>00137 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
    125 <a name="l00138"></a>00138 <span class="keywordtype">void</span> mlnorm&lt;sq_T&gt;::condition( vec &amp;cond) { 
    126 <a name="l00139"></a>00139 } 
    127 <a name="l00140"></a>00140  
    128 <a name="l00141"></a>00141 <span class="preprocessor">#endif //EF_H</span> 
    129 </pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Wed Jan 23 11:30:10 2008 for mixpp by&nbsp; 
     110<a name="l00123"></a>00123 <span class="keywordtype">double</span> <a class="code" href="classenorm.html" title="General exponential family density.">enorm&lt;sq_T&gt;::eval</a>( <span class="keyword">const</span> vec &amp;val ) { 
     111<a name="l00124"></a>00124         <span class="comment">//</span> 
     112<a name="l00125"></a>00125 }; 
     113<a name="l00126"></a>00126  
     114<a name="l00127"></a>00127  
     115<a name="l00128"></a>00128 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     116<a name="l00129"></a>00129 <a class="code" href="classenorm.html" title="General exponential family density.">enorm&lt;sq_T&gt;::enorm</a>() {}; 
     117<a name="l00130"></a>00130  
     118<a name="l00131"></a>00131 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     119<a name="l00132"></a>00132 mlnorm&lt;sq_T&gt;::mlnorm( <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv,<a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rvc, mat &amp;A, sq_T &amp;R ) { 
     120<a name="l00133"></a>00133         <span class="keywordtype">int</span> dim = rv.<a class="code" href="classRV.html#9dcaca7b87cfb0e24a19260067d62f04" title="Return length (number of scalars) of the RV.">count</a>(); 
     121<a name="l00134"></a>00134         vec mu( dim ); 
     122<a name="l00135"></a>00135  
     123<a name="l00136"></a>00136         <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" title="General exponential family density.">enorm&lt;sq_T&gt;</a>( rv,mu,R ); 
     124<a name="l00137"></a>00137 } 
     125<a name="l00138"></a>00138  
     126<a name="l00139"></a>00139 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     127<a name="l00140"></a>00140 vec mlnorm&lt;sq_T&gt;::samplecond( vec &amp;cond, <span class="keywordtype">double</span> &amp;lik ) { 
     128<a name="l00141"></a>00141         this-&gt;condition( cond ); 
     129<a name="l00142"></a>00142         vec smp = <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.sample(); 
     130<a name="l00143"></a>00143         lik = <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.eval( smp ); 
     131<a name="l00144"></a>00144         <span class="keywordflow">return</span> smp; 
     132<a name="l00145"></a>00145 } 
     133<a name="l00146"></a>00146  
     134<a name="l00147"></a>00147 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     135<a name="l00148"></a>00148 mat mlnorm&lt;sq_T&gt;::samplecond( vec &amp;cond, vec &amp;lik, <span class="keywordtype">int</span> n ) { 
     136<a name="l00149"></a>00149         <span class="keywordtype">int</span> i; 
     137<a name="l00150"></a>00150         <span class="keywordtype">int</span> dim = rv.<a class="code" href="classRV.html#9dcaca7b87cfb0e24a19260067d62f04" title="Return length (number of scalars) of the RV.">count</a>(); 
     138<a name="l00151"></a>00151         mat Smp( dim,n ); 
     139<a name="l00152"></a>00152         vec smp( dim ); 
     140<a name="l00153"></a>00153         this-&gt;condition( cond ); 
     141<a name="l00154"></a>00154         <span class="keywordflow">for</span> ( i=0; i&lt;dim; i++ ) { 
     142<a name="l00155"></a>00155                 smp = <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.sample(); 
     143<a name="l00156"></a>00156                 lik( i ) = <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.eval( smp ); 
     144<a name="l00157"></a>00157                 Smp.set_col( i ,smp ); 
     145<a name="l00158"></a>00158         } 
     146<a name="l00159"></a>00159         <span class="keywordflow">return</span> Smp; 
     147<a name="l00160"></a>00160 } 
     148<a name="l00161"></a>00161  
     149<a name="l00162"></a>00162 <span class="keyword">template</span>&lt;<span class="keyword">class</span> sq_T&gt; 
     150<a name="l00163"></a>00163 <span class="keywordtype">void</span> mlnorm&lt;sq_T&gt;::condition( vec &amp;cond ) { 
     151<a name="l00164"></a>00164         <a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a>.mu = A*cond; 
     152<a name="l00165"></a>00165 <span class="comment">//R is already assigned;</span> 
     153<a name="l00166"></a>00166 } 
     154<a name="l00167"></a>00167  
     155<a name="l00168"></a>00168 <span class="preprocessor">#endif //EF_H</span> 
     156</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Fri Feb 15 18:57:37 2008 for mixpp by&nbsp; 
    130157<a href="http://www.doxygen.org/index.html"> 
    131158<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address>