Show
Ignore:
Timestamp:
06/02/09 10:08:06 (16 years ago)
Author:
smidl
Message:

doc

Files:
1 modified

Legend:

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

    r323 r353  
    7777<a name="l00032"></a><a class="code" href="classbdm_1_1PF.html#dc049265b9086cad7071f98d00a2b9af">00032</a>         <a class="code" href="classbdm_1_1eEmp.html" title="Weighted empirical density.">eEmp</a> <a class="code" href="classbdm_1_1PF.html#dc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>; 
    7878<a name="l00034"></a><a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3">00034</a>         vec &amp;<a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a>; 
    79 <a name="l00036"></a><a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1">00036</a>         Array&lt;vec&gt; &amp;<a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a>; 
     79<a name="l00036"></a><a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1">00036</a>         <a class="code" href="classitpp_1_1Array.html">Array&lt;vec&gt;</a> &amp;<a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a>; 
    8080<a name="l00038"></a><a class="code" href="classbdm_1_1PF.html#521e9621d3b5e1274275f323691afdaf">00038</a>         <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> *<a class="code" href="classbdm_1_1PF.html#521e9621d3b5e1274275f323691afdaf" title="Parameter evolution model.">par</a>; 
    8181<a name="l00040"></a><a class="code" href="classbdm_1_1PF.html#d6e7a62fba1e0a0d73c9b87f4fb683ec">00040</a>         <a class="code" href="classbdm_1_1mpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> *<a class="code" href="classbdm_1_1PF.html#d6e7a62fba1e0a0d73c9b87f4fb683ec" title="Observation model.">obs</a>; 
     
    8888<a name="l00053"></a>00053  
    8989<a name="l00054"></a>00054 <span class="keyword">public</span>: 
    90 <a name="l00057"></a>00057         <a class="code" href="classbdm_1_1PF.html" title="Trivial particle filter with proposal density equal to parameter evolution model...">PF</a> ( ) :<a class="code" href="classbdm_1_1PF.html#dc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>(), <a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a> ( <a class="code" href="classbdm_1_1PF.html#dc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>.<a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a>() ),<a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a> ( <a class="code" href="classbdm_1_1PF.html#dc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>.<a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a>() ), <a class="code" href="classbdm_1_1PF.html#98ef9ff80c394fafd28680b7a3f831b1" title="Log all samples.">opt_L_smp</a> ( false ), <a class="code" href="classbdm_1_1PF.html#5a49463a88ee80771a464861df845ff6" title="Log all samples.">opt_L_wei</a> ( false ) {<a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers.">LIDs</a>.set_size ( 5 );}; 
     90<a name="l00057"></a>00057         <a class="code" href="classbdm_1_1PF.html" title="Trivial particle filter with proposal density equal to parameter evolution model...">PF</a> ( ) :<a class="code" href="classbdm_1_1PF.html#dc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>(), <a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a> ( <a class="code" href="classbdm_1_1PF.html#dc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>.<a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a>() ),<a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a> ( <a class="code" href="classbdm_1_1PF.html#dc049265b9086cad7071f98d00a2b9af" title="posterior density">est</a>.<a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a>() ), <a class="code" href="classbdm_1_1PF.html#98ef9ff80c394fafd28680b7a3f831b1" title="Log all samples.">opt_L_smp</a> ( false ), <a class="code" href="classbdm_1_1PF.html#5a49463a88ee80771a464861df845ff6" title="Log all samples.">opt_L_wei</a> ( false ) {<a class="code" href="classbdm_1_1BM.html#109c1a626a69031658e3a44e9e500cca" title="IDs of storages in loggers 4:[1=mean,2=lb,3=ub,4=ll].">LIDs</a>.set_size ( 5 );}; 
    9191<a name="l00058"></a>00058         <span class="comment">/*      PF ( mpdf *par0, mpdf *obs0, epdf *epdf0, int n0 ) :</span> 
    9292<a name="l00059"></a>00059 <span class="comment">                                est ( ),_w ( est._w() ),_samples ( est._samples() ),opt_L_smp(false), opt_L_wei(false)</span> 
     
    107107<a name="l00083"></a>00083 <span class="keyword">template</span>&lt;<span class="keyword">class</span> BM_T&gt; 
    108108<a name="l00084"></a><a class="code" href="classbdm_1_1MPF.html">00084</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1MPF.html" title="Marginalized Particle filter.">MPF</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1PF.html" title="Trivial particle filter with proposal density equal to parameter evolution model...">PF</a> { 
    109 <a name="l00085"></a>00085         Array&lt;BM_T*&gt; BMs; 
     109<a name="l00085"></a>00085         <a class="code" href="classitpp_1_1Array.html">Array&lt;BM_T*&gt;</a> BMs; 
    110110<a name="l00086"></a>00086  
    111111<a name="l00088"></a>00088  
     
    114114<a name="l00091"></a>00091                 <a class="code" href="classbdm_1_1eEmp.html" title="Weighted empirical density.">eEmp</a> &amp;E; 
    115115<a name="l00092"></a>00092                 vec &amp;<a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a>; 
    116 <a name="l00093"></a>00093                 Array&lt;const epdf*&gt; Coms; 
     116<a name="l00093"></a>00093                 <a class="code" href="classitpp_1_1Array.html">Array&lt;const epdf*&gt;</a> Coms; 
    117117<a name="l00094"></a>00094         <span class="keyword">public</span>: 
    118118<a name="l00095"></a>00095                 mpfepdf ( <a class="code" href="classbdm_1_1eEmp.html" title="Weighted empirical density.">eEmp</a> &amp;E0 ) : 
     
    120120<a name="l00097"></a>00097                                 Coms ( <a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a>.length() ) { 
    121121<a name="l00098"></a>00098                 }; 
    122 <a name="l00100"></a>00100                 <span class="keywordtype">void</span> read_statistics ( Array&lt;BM_T*&gt; &amp;A ) { 
     122<a name="l00100"></a>00100                 <span class="keywordtype">void</span> read_statistics ( <a class="code" href="classitpp_1_1Array.html">Array&lt;BM_T*&gt;</a> &amp;A ) { 
    123123<a name="l00101"></a>00101                         dim = E.dimension() +A ( 0 )-&gt;posterior().dimension(); 
    124124<a name="l00102"></a>00102                         <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0; i&lt;<a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a>.length() ;i++ ) {Coms ( i ) = A ( i )-&gt;_e();} 
     
    131131<a name="l00110"></a>00110                         Coms.set_length ( n ); 
    132132<a name="l00111"></a>00111                 } 
    133 <a name="l00112"></a>00112                 vec mean()<span class="keyword"> const </span>{ 
     133<a name="l00112"></a>00112                 vec <a class="code" href="group__statistics.html#gc370b4cfdc6baa037b7442ae6e2c4b5c" title="The mean value.">mean</a>()<span class="keyword"> const </span>{ 
    134134<a name="l00113"></a>00113                         <span class="comment">// ugly</span> 
    135 <a name="l00114"></a>00114                         vec pom=zeros ( Coms ( 0 )-&gt;dimension() ); 
     135<a name="l00114"></a>00114                         vec pom=<a class="code" href="group__specmat.html#g10723ecada06221cbe64fe2736a59de1" title="A Double (rows,cols)-matrix of zeros.">zeros</a> ( Coms ( 0 )-&gt;dimension() ); 
    136136<a name="l00115"></a>00115                         <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0; i&lt;<a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a>.length(); i++ ) {pom += Coms ( i )-&gt;mean() * <a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a> ( i );} 
    137137<a name="l00116"></a>00116                         <span class="keywordflow">return</span> concat ( E.mean(),pom ); 
    138138<a name="l00117"></a>00117                 } 
    139 <a name="l00118"></a>00118                 vec variance()<span class="keyword"> const </span>{ 
     139<a name="l00118"></a>00118                 vec <a class="code" href="group__statistics.html#g7a4799948ff9779eaeecabde0ce5fcbb" title="The variance of the elements in the vector. Normalized with N-1 to be unbiased.">variance</a>()<span class="keyword"> const </span>{ 
    140140<a name="l00119"></a>00119                         <span class="comment">// ugly</span> 
    141 <a name="l00120"></a>00120                         vec pom=zeros ( Coms ( 0 )-&gt;dimension() ); 
    142 <a name="l00121"></a>00121                         vec pom2=zeros ( Coms ( 0 )-&gt;dimension() ); 
     141<a name="l00120"></a>00120                         vec pom=<a class="code" href="group__specmat.html#g10723ecada06221cbe64fe2736a59de1" title="A Double (rows,cols)-matrix of zeros.">zeros</a> ( Coms ( 0 )-&gt;dimension() ); 
     142<a name="l00121"></a>00121                         vec pom2=<a class="code" href="group__specmat.html#g10723ecada06221cbe64fe2736a59de1" title="A Double (rows,cols)-matrix of zeros.">zeros</a> ( Coms ( 0 )-&gt;dimension() ); 
    143143<a name="l00122"></a>00122                         <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0; i&lt;<a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a>.length(); i++ ) { 
    144144<a name="l00123"></a>00123                                 pom += Coms ( i )-&gt;mean() * <a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a> ( i ); 
    145 <a name="l00124"></a>00124                                 pom2 += ( Coms ( i )-&gt;variance() + pow ( Coms ( i )-&gt;mean(),2 ) ) * <a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a> ( i ); 
     145<a name="l00124"></a>00124                                 pom2 += ( Coms ( i )-&gt;variance() + <a class="code" href="group__logexpfunc.html#g40f48a75172e7f8bc8e58ed54262a04d" title="Calculates x to the power of y (x^y).">pow</a> ( Coms ( i )-&gt;<a class="code" href="group__statistics.html#gc370b4cfdc6baa037b7442ae6e2c4b5c" title="The mean value.">mean</a>(),2 ) ) * <a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a> ( i ); 
    146146<a name="l00125"></a>00125                         } 
    147 <a name="l00126"></a>00126                         <span class="keywordflow">return</span> concat ( E.variance(),pom2-pow ( pom,2 ) ); 
     147<a name="l00126"></a>00126                         <span class="keywordflow">return</span> concat ( E.variance(),pom2-<a class="code" href="group__logexpfunc.html#g40f48a75172e7f8bc8e58ed54262a04d" title="Calculates x to the power of y (x^y).">pow</a> ( pom,2 ) ); 
    148148<a name="l00127"></a>00127                 } 
    149149<a name="l00128"></a>00128                 <span class="keywordtype">void</span> qbounds ( vec &amp;lb, vec &amp;ub, <span class="keywordtype">double</span> perc=0.95 )<span class="keyword"> const </span>{ 
     
    177177<a name="l00156"></a>00156                 } 
    178178<a name="l00157"></a>00157  
    179 <a name="l00158"></a>00158                 vec sample()<span class="keyword"> const </span>{it_error ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> 0;} 
     179<a name="l00158"></a>00158                 vec sample()<span class="keyword"> const </span>{<a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a> ( <span class="stringliteral">"Not implemented"</span> );<span class="keywordflow">return</span> 0;} 
    180180<a name="l00159"></a>00159  
    181 <a name="l00160"></a>00160                 <span class="keywordtype">double</span> evallog ( <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;} 
     181<a name="l00160"></a>00160                 <span class="keywordtype">double</span> evallog ( <span class="keyword">const</span> vec &amp;val )<span class="keyword"> const </span>{<a class="code" href="group__errorhandlingfunc.html#g22d38e98332f9edff88cc501463eedce" title="Abort unconditionally.">it_error</a> ( <span class="stringliteral">"not implemented"</span> ); <span class="keywordflow">return</span> 0.0;} 
    182182<a name="l00161"></a>00161         }; 
    183183<a name="l00162"></a>00162  
     
    191191<a name="l00173"></a>00173                 PF::set_parameters ( par0, obs0, n0, rm ); 
    192192<a name="l00174"></a>00174                 jest.set_parameters ( n0 );<span class="comment">//duplication of rm</span> 
    193 <a name="l00175"></a>00175                 BMs.set_length ( n0 ); 
     193<a name="l00175"></a>00175                 BMs.<a class="code" href="classitpp_1_1Array.html#3709407656d26aae2c5d3e844316d4e0" title="Resizing an Array&amp;lt;T&amp;gt;.">set_length</a> ( n0 ); 
    194194<a name="l00176"></a>00176         } 
    195195<a name="l00177"></a>00177         <span class="keywordtype">void</span> set_statistics ( epdf *epdf0, <span class="keyword">const</span> BM_T* BMcond0 ) { 
    196196<a name="l00178"></a>00178  
    197 <a name="l00179"></a>00179                 PF::set_statistics ( ones ( <a class="code" href="classbdm_1_1PF.html#eeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a> ) /<a class="code" href="classbdm_1_1PF.html#eeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a>, epdf0 ); 
     197<a name="l00179"></a>00179                 PF::set_statistics ( <a class="code" href="group__specmat.html#gdc0f3edbf58bced9e82d8b260d395cac" title="A float (rows,cols)-matrix of ones.">ones</a> ( <a class="code" href="classbdm_1_1PF.html#eeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a> ) /<a class="code" href="classbdm_1_1PF.html#eeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a>, epdf0 ); 
    198198<a name="l00180"></a>00180                 <span class="comment">// copy</span> 
    199199<a name="l00181"></a>00181                 <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i=0;i&lt;<a class="code" href="classbdm_1_1PF.html#eeafaf9b8ad75fe62ee9fd6369e3f7fe" title="number of particles;">n</a>;i++ ) { BMs ( i ) = <span class="keyword">new</span> BM_T ( *BMcond0 ); BMs ( i )-&gt;condition ( <a class="code" href="classbdm_1_1PF.html#914bd66025692c4018dbd482cb3c47c1" title="pointer into eEmp ">_samples</a> ( i ) );} 
     
    243243<a name="l00227"></a>00227 <span class="preprocessor">#pragma omp parallel for</span> 
    244244<a name="l00228"></a>00228 <span class="preprocessor"></span>        <span class="keywordflow">for</span> ( i=0;i&lt;n;i++ ) { 
    245 <a name="l00229"></a>00229                 <a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a> ( i ) *= exp ( lls ( i ) - mlls ); <span class="comment">// multiply w by likelihood</span> 
     245<a name="l00229"></a>00229                 <a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a> ( i ) *= <a class="code" href="group__logexpfunc.html#g7a3da29d4e6a8c814237453086793335" title="Exp of the elements of a complex matrix m.">exp</a> ( lls ( i ) - mlls ); <span class="comment">// multiply w by likelihood</span> 
    246246<a name="l00230"></a>00230                 sum_w+=<a class="code" href="classbdm_1_1PF.html#f5149d5522d1095d39240c4c607f61a3" title="pointer into eEmp ">_w</a> ( i ); 
    247247<a name="l00231"></a>00231         } 
     
    283283<a name="l00267"></a>00267  
    284284</pre></div></div> 
    285 <hr size="1"><address style="text-align: right;"><small>Generated on Thu Apr 23 21:06:42 2009 for mixpp by&nbsp; 
     285<hr size="1"><address style="text-align: right;"><small>Generated on Tue Jun 2 10:02:12 2009 for mixpp by&nbsp; 
    286286<a href="http://www.doxygen.org/index.html"> 
    287287<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.8 </small></address>