Changeset 8

Show
Ignore:
Timestamp:
01/23/08 11:32:31 (16 years ago)
Author:
smidl
Message:

Kalmany funkci, PF nefunkci

Files:
79 added
22 modified

Legend:

Unmodified
Added
Removed
  • Makefile

    r7 r8  
    22CPPFLAGS=-g 
    33 
    4 all: testKF 
     4all: testPF 
    55 
    66test: test0 
     
    1212test0: test0.cpp libBM.o libDC.o itpp_ext.o 
    1313testKF: testKF.o libKF.o libBM.o libDC.o itpp_ext.o 
    14         g++ -o $@ testKF.o libKF.o libBM.o libDC.o itpp_ext.o $(LDFLAGS) 
     14testPF: testPF.o libPF.o libBM.o libDC.o itpp_ext.o 
  • doc/html/annotated.html

    r7 r8  
    2222<h1>mixpp Class List</h1>Here are the classes, structs, unions and interfaces with brief descriptions:<table> 
    2323  <tr><td class="indexkey"><a class="el" href="classBM.html">BM</a></td><td class="indexvalue">Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities </td></tr> 
     24  <tr><td class="indexkey"><a class="el" href="classeEF.html">eEF</a></td><td class="indexvalue">General conjugate exponential family posterior density </td></tr> 
     25  <tr><td class="indexkey"><a class="el" href="classenorm.html">enorm&lt; sq_T &gt;</a></td><td class="indexvalue">General exponential family density </td></tr> 
    2426  <tr><td class="indexkey"><a class="el" href="classepdf.html">epdf</a></td><td class="indexvalue">Probability density function with numerical statistics, e.g. posterior density </td></tr> 
    2527  <tr><td class="indexkey"><a class="el" href="classfnc.html">fnc</a></td><td class="indexvalue">Class representing function of variables </td></tr> 
    26   <tr><td class="indexkey"><a class="el" href="classKalman.html">Kalman</a></td><td class="indexvalue"><a class="el" href="classKalman.html" title="Kalman filter with covaraince matrices in square root form.">Kalman</a> filter with covaraince matrices in square root form </td></tr> 
    27   <tr><td class="indexkey"><a class="el" href="classKalmanFull.html">KalmanFull</a></td><td class="indexvalue">Basic <a class="el" href="classKalman.html" title="Kalman filter with covaraince matrices in square root form.">Kalman</a> filter with full matrices (education purpose only)! </td></tr> 
     28  <tr><td class="indexkey"><a class="el" href="classfsqmat.html">fsqmat</a></td><td class="indexvalue">Fake <a class="el" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a>. This class maps <a class="el" href="classsqmat.html" title="Virtual class for representation of double symmetric matrices in square-root form...">sqmat</a> operations to operations on full matrix </td></tr> 
     29  <tr><td class="indexkey"><a class="el" href="classKalman.html">Kalman&lt; sq_T &gt;</a></td><td class="indexvalue"><a class="el" href="classKalman.html" title="Kalman filter with covaraince matrices in square root form.">Kalman</a> filter with covaraince matrices in square root form </td></tr> 
     30  <tr><td class="indexkey"><a class="el" href="classKalmanFull.html">KalmanFull</a></td><td class="indexvalue">Basic <a class="el" href="classKalman.html" title="Kalman filter with covaraince matrices in square root form.">Kalman</a> filter with full matrices (education purpose only)! Will be deleted soon! </td></tr> 
    2831  <tr><td class="indexkey"><a class="el" href="classmpdf.html">mpdf</a></td><td class="indexvalue">Conditional probability density, e.g. modeling some dependencies </td></tr> 
     32  <tr><td class="indexkey"><a class="el" href="classPF.html">PF</a></td><td class="indexvalue">A Particle Filter prototype </td></tr> 
    2933  <tr><td class="indexkey"><a class="el" href="classRV.html">RV</a></td><td class="indexvalue">Class representing variables, most often random variables </td></tr> 
     34  <tr><td class="indexkey"><a class="el" href="classsqmat.html">sqmat</a></td><td class="indexvalue">Virtual class for representation of double symmetric matrices in square-root form </td></tr> 
     35  <tr><td class="indexkey"><a class="el" href="classTrivialPF.html">TrivialPF</a></td><td class="indexvalue">Trivial particle filter with proposal density that is not conditioned on the data </td></tr> 
    3036</table> 
    31 <hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 20 12:47:33 2008 for mixpp by&nbsp; 
     37<hr size="1"><address style="text-align: right;"><small>Generated on Wed Jan 23 11:30:10 2008 for mixpp by&nbsp; 
    3238<a href="http://www.doxygen.org/index.html"> 
    3339<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> 
  • doc/html/classfnc-members.html

    r7 r8  
    2121</div> 
    2222<h1>fnc Member List</h1>This is the complete list of members for <a class="el" href="classfnc.html">fnc</a>, including all inherited members.<p><table> 
    23 </table><hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 20 12:47:34 2008 for mixpp by&nbsp; 
     23</table><hr size="1"><address style="text-align: right;"><small>Generated on Wed Jan 23 11:30:11 2008 for mixpp by&nbsp; 
    2424<a href="http://www.doxygen.org/index.html"> 
    2525<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> 
  • doc/html/classfnc.html

    r7 r8  
    3333Class representing function of variables. <hr>The documentation for this class was generated from the following file:<ul> 
    3434<li>work/mixpp/<a class="el" href="libBM_8h-source.html">libBM.h</a></ul> 
    35 <hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 20 12:47:34 2008 for mixpp by&nbsp; 
     35<hr size="1"><address style="text-align: right;"><small>Generated on Wed Jan 23 11:30:11 2008 for mixpp by&nbsp; 
    3636<a href="http://www.doxygen.org/index.html"> 
    3737<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> 
  • doc/html/files.html

    r7 r8  
    1717  <tr><td class="indexkey">work/mixpp/<a class="el" href="libBM_8h.html">libBM.h</a> <a href="libBM_8h-source.html">[code]</a></td><td class="indexvalue">Bayesian Models (bm) that use Bayes rule to learn from observations </td></tr> 
    1818  <tr><td class="indexkey">work/mixpp/<a class="el" href="libDC_8h.html">libDC.h</a> <a href="libDC_8h-source.html">[code]</a></td><td class="indexvalue">Matrices in decomposed forms (LDL', LU, UDU', etc) </td></tr> 
     19  <tr><td class="indexkey">work/mixpp/<a class="el" href="libEF_8h.html">libEF.h</a> <a href="libEF_8h-source.html">[code]</a></td><td class="indexvalue">Probability distributions for Exponential Family models </td></tr> 
    1920  <tr><td class="indexkey">work/mixpp/<a class="el" href="libKF_8h.html">libKF.h</a> <a href="libKF_8h-source.html">[code]</a></td><td class="indexvalue">Bayesian Filtering for linear Gaussian models (<a class="el" href="classKalman.html" title="Kalman filter with covaraince matrices in square root form.">Kalman</a> Filter) and extensions </td></tr> 
     21  <tr><td class="indexkey">work/mixpp/<a class="el" href="libPF_8h.html">libPF.h</a> <a href="libPF_8h-source.html">[code]</a></td><td class="indexvalue">Bayesian Filtering using stochastic sampling (Particle Filters) </td></tr> 
    2022</table> 
    21 <hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 20 12:47:34 2008 for mixpp by&nbsp; 
     23<hr size="1"><address style="text-align: right;"><small>Generated on Wed Jan 23 11:30:12 2008 for mixpp by&nbsp; 
    2224<a href="http://www.doxygen.org/index.html"> 
    2325<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> 
  • doc/html/index.html

    r7 r8  
    1515<h1>mixpp Documentation</h1> 
    1616<p> 
    17 <h3 align="center">1 </h3><hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 20 12:47:33 2008 for mixpp by&nbsp; 
     17<h3 align="center">1 </h3><hr size="1"><address style="text-align: right;"><small>Generated on Wed Jan 23 11:30:10 2008 for mixpp by&nbsp; 
    1818<a href="http://www.doxygen.org/index.html"> 
    1919<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> 
  • doc/html/libBM_8h-source.html

    r7 r8  
    3333<a name="l00035"></a>00035         <span class="keywordtype">void</span> init ( ivec in_ids, Array&lt;std::string&gt; in_names, ivec in_sizes, ivec in_times, ivec in_obs ); 
    3434<a name="l00036"></a>00036 <span class="keyword">public</span>: 
    35 <a name="l00038"></a>00038         <a class="code" href="classRV.html#e46882dec2c30b12be282d34b03417b2" title="Full constructor which is called by the others.">RV</a> ( ivec in_ids, Array&lt;std::string&gt; in_names, ivec in_sizes, ivec in_times, ivec in_obs ); 
    36 <a name="l00040"></a>00040         <a class="code" href="classRV.html#e46882dec2c30b12be282d34b03417b2" title="Full constructor which is called by the others.">RV</a> ( ivec ids ); 
    37 <a name="l00042"></a>00042         <span class="keyword">friend</span> std::ostream &amp;<a class="code" href="classRV.html#cad6f15535d10437f6690cb4492176a8" title="Printing output e.g. for debugging.">operator&lt;&lt; </a>( std::ostream &amp;os, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv ); 
    38 <a name="l00043"></a>00043  
    39 <a name="l00045"></a>00045         ivec <a class="code" href="classRV.html#45b869bced40dc3fa0df584aaf8228c0" title="Find indexes of another rv in self.">rvfind</a>(<a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rv2); 
    40 <a name="l00047"></a>00047         <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classRV.html#f47ab0015ebac822da3b2e00f42a8fc6" title="Add (concat) another variable to the current one.">rvadd</a>(<a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rv2); 
    41 <a name="l00049"></a>00049         <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classRV.html#269023ac4d41b21c4e1f7f17db1603b9" title="Subtract another variable from the current one.">rvsubt</a>(<a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rv2); 
    42 <a name="l00051"></a>00051         <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classRV.html#70a53f2bc37929bae899b0b24cda9d8e" title="Select only variables at indeces ind.">rvsubselect</a>(ivec ind); 
    43 <a name="l00053"></a>00053         <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classRV.html#28bbcb8873bafdac317bafb7b481cc45" title="Select only variables at indeces ind.">operator()</a>(ivec ind); 
    44 <a name="l00054"></a>00054 }; 
    45 <a name="l00055"></a>00055  
    46 <a name="l00056"></a>00056  
    47 <a name="l00057"></a>00057  
    48 <a name="l00058"></a>00058  
    49 <a name="l00060"></a><a class="code" href="classfnc.html">00060</a> <span class="keyword">class </span><a class="code" href="classfnc.html" title="Class representing function of variables.">fnc</a> { 
    50 <a name="l00061"></a>00061         <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rv; 
    51 <a name="l00062"></a>00062 }; 
     35<a name="l00038"></a>00038         <a class="code" href="classRV.html#6a22f5c06d6403870d4e414b1993bf9e" title="Empty constructor will be set later.">RV</a> ( ivec in_ids, Array&lt;std::string&gt; in_names, ivec in_sizes, ivec in_times, ivec in_obs ); 
     36<a name="l00040"></a>00040         <a class="code" href="classRV.html#6a22f5c06d6403870d4e414b1993bf9e" title="Empty constructor will be set later.">RV</a> ( ivec ids ); 
     37<a name="l00042"></a>00042         <a class="code" href="classRV.html#6a22f5c06d6403870d4e414b1993bf9e" title="Empty constructor will be set later.">RV</a> (); 
     38<a name="l00043"></a>00043          
     39<a name="l00045"></a>00045         <span class="keyword">friend</span> std::ostream &amp;<a class="code" href="classRV.html#cad6f15535d10437f6690cb4492176a8" title="Printing output e.g. for debugging.">operator&lt;&lt; </a>( std::ostream &amp;os, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &amp;rv ); 
     40<a name="l00046"></a>00046  
     41<a name="l00048"></a>00048         <span class="keywordtype">int</span> <a class="code" href="classRV.html#a764092415291a0e6452a3711749d18e" title="Return length (number of scalars) of the RV.">length</a>(); 
     42<a name="l00050"></a>00050         ivec <a class="code" href="classRV.html#45b869bced40dc3fa0df584aaf8228c0" title="Find indexes of another rv in self.">rvfind</a>(<a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rv2); 
     43<a name="l00052"></a>00052         <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classRV.html#f47ab0015ebac822da3b2e00f42a8fc6" title="Add (concat) another variable to the current one.">rvadd</a>(<a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rv2); 
     44<a name="l00054"></a>00054         <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classRV.html#269023ac4d41b21c4e1f7f17db1603b9" title="Subtract another variable from the current one.">rvsubt</a>(<a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rv2); 
     45<a name="l00056"></a>00056         <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classRV.html#70a53f2bc37929bae899b0b24cda9d8e" title="Select only variables at indeces ind.">rvsubselect</a>(ivec ind); 
     46<a name="l00058"></a>00058         <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> <a class="code" href="classRV.html#28bbcb8873bafdac317bafb7b481cc45" title="Select only variables at indeces ind.">operator()</a>(ivec ind); 
     47<a name="l00060"></a>00060         <span class="keywordtype">void</span> <a class="code" href="classRV.html#e0a158d53ab9430627241f844f4c9a60" title="Generate new RV with time shifted by delta.">t</a>(<span class="keywordtype">int</span> delta); 
     48<a name="l00061"></a>00061 }; 
     49<a name="l00062"></a>00062  
    5250<a name="l00063"></a>00063  
    53 <a name="l00065"></a><a class="code" href="classBM.html">00065</a> <span class="keyword">class </span><a class="code" href="classBM.html" title="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</a> { 
    54 <a name="l00066"></a>00066 <span class="keyword">public</span>: 
    55 <a name="l00071"></a>00071         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBM.html#c52edf4ad6e1dff9bf64b9e1e0cfb1f0" title="Incremental Bayes rule.">bayes</a> ( <span class="keyword">const</span> vec &amp;dt, <span class="keywordtype">bool</span> evall=<span class="keyword">true</span> ) = 0; 
    56 <a name="l00073"></a>00073         <span class="keywordtype">void</span> <a class="code" href="classBM.html#c52edf4ad6e1dff9bf64b9e1e0cfb1f0" title="Incremental Bayes rule.">bayes</a> ( mat Dt ); 
    57 <a name="l00074"></a>00074 }; 
    58 <a name="l00075"></a>00075  
    59 <a name="l00077"></a><a class="code" href="classepdf.html">00077</a> <span class="keyword">class </span><a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> { 
    60 <a name="l00078"></a>00078         <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rv; 
    61 <a name="l00079"></a>00079 <span class="keyword">public</span>: 
    62 <a name="l00081"></a>00081         <span class="keyword">virtual</span> vec <a class="code" href="classepdf.html#545555f9d561555603911f7d3989611f" title="Returns the required moment of the epdf.">moment</a> ( <span class="keyword">const</span> <span class="keywordtype">int</span> order = 1 ); 
    63 <a name="l00082"></a>00082 }; 
    64 <a name="l00083"></a>00083  
    65 <a name="l00085"></a><a class="code" href="classmpdf.html">00085</a> <span class="keyword">class </span><a class="code" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> { 
    66 <a name="l00087"></a>00087         <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rv; 
    67 <a name="l00089"></a>00089         <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rvc; 
    68 <a name="l00090"></a>00090 <span class="keyword">public</span>: 
    69 <a name="l00091"></a>00091  
    70 <a name="l00093"></a>00093         <span class="keyword">virtual</span> <a class="code" href="classfnc.html" title="Class representing function of variables.">fnc</a> <a class="code" href="classmpdf.html#0863640c439869e8fbbbeb2bd8ea1fc0" title="Returns the required moment of the epdf.">moment</a> ( <span class="keyword">const</span> <span class="keywordtype">int</span> order = 1 ); 
    71 <a name="l00094"></a>00094 }; 
    72 <a name="l00095"></a>00095  
    73 <a name="l00096"></a>00096 <span class="preprocessor">#endif // BM_H</span> 
    74 </pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 20 12:47:33 2008 for mixpp by&nbsp; 
     51<a name="l00064"></a>00064  
     52<a name="l00065"></a>00065  
     53<a name="l00067"></a><a class="code" href="classfnc.html">00067</a> <span class="keyword">class </span><a class="code" href="classfnc.html" title="Class representing function of variables.">fnc</a> { 
     54<a name="l00068"></a>00068         <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rv; 
     55<a name="l00069"></a>00069 }; 
     56<a name="l00070"></a>00070  
     57<a name="l00072"></a><a class="code" href="classBM.html">00072</a> <span class="keyword">class </span><a class="code" href="classBM.html" title="Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities.">BM</a> { 
     58<a name="l00073"></a>00073 <span class="keyword">public</span>: 
     59<a name="l00075"></a><a class="code" href="classBM.html#5623fef6572a08c2b53b8c87b82dc979">00075</a>         <span class="keywordtype">double</span> <a class="code" href="classBM.html#5623fef6572a08c2b53b8c87b82dc979" title="Logarithm of marginalized data likelihood.">ll</a>; 
     60<a name="l00076"></a>00076  
     61<a name="l00081"></a>00081         <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classBM.html#c52edf4ad6e1dff9bf64b9e1e0cfb1f0" title="Incremental Bayes rule.">bayes</a> ( <span class="keyword">const</span> vec &amp;dt, <span class="keywordtype">bool</span> evall=<span class="keyword">true</span> ) = 0; 
     62<a name="l00083"></a>00083         <span class="keywordtype">void</span> <a class="code" href="classBM.html#c52edf4ad6e1dff9bf64b9e1e0cfb1f0" title="Incremental Bayes rule.">bayes</a> ( mat Dt ); 
     63<a name="l00084"></a>00084 }; 
     64<a name="l00085"></a>00085  
     65<a name="l00087"></a><a class="code" href="classepdf.html">00087</a> <span class="keyword">class </span><a class="code" href="classepdf.html" title="Probability density function with numerical statistics, e.g. posterior density.">epdf</a> { 
     66<a name="l00088"></a>00088         <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rv; 
     67<a name="l00089"></a>00089 <span class="keyword">public</span>: 
     68<a name="l00091"></a>00091 <span class="comment">//      virtual vec moment ( const int order = 1 );</span> 
     69<a name="l00093"></a><a class="code" href="classepdf.html#e6ce993603a95c2645eb86305ea51396">00093</a> <span class="comment"></span>        <span class="keyword">virtual</span> vec <a class="code" href="classepdf.html#e6ce993603a95c2645eb86305ea51396" title="Returns the required moment of the epdf.">sample</a> (){}; 
     70<a name="l00094"></a>00094         <span class="keyword">virtual</span> <span class="keywordtype">double</span> eval(<span class="keyword">const</span> vec &amp;val){}; 
     71<a name="l00095"></a>00095 }; 
     72<a name="l00096"></a>00096  
     73<a name="l00098"></a><a class="code" href="classmpdf.html">00098</a> <span class="keyword">class </span><a class="code" href="classmpdf.html" title="Conditional probability density, e.g. modeling some dependencies.">mpdf</a> { 
     74<a name="l00100"></a>00100         <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rv; 
     75<a name="l00102"></a>00102         <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> rvc; 
     76<a name="l00103"></a>00103 <span class="keyword">public</span>: 
     77<a name="l00104"></a>00104  
     78<a name="l00106"></a>00106 <span class="comment">//      virtual fnc moment ( const int order = 1 );</span> 
     79<a name="l00108"></a><a class="code" href="classmpdf.html#c20c796f8d0a201f0897299150e45a41">00108</a> <span class="comment"></span>        <span class="keyword">virtual</span> vec <a class="code" href="classmpdf.html#c20c796f8d0a201f0897299150e45a41" title="Returns the required moment of the epdf.">samplecond</a> (vec &amp;cond, <span class="keywordtype">double</span> lik){}; 
     80<a name="l00109"></a>00109         <span class="keyword">virtual</span> <span class="keywordtype">void</span> condition (vec &amp;cond){}; 
     81<a name="l00110"></a>00110 }; 
     82<a name="l00111"></a>00111  
     83<a name="l00112"></a>00112 <span class="preprocessor">#endif // BM_H</span> 
     84</pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Wed Jan 23 11:30:10 2008 for mixpp by&nbsp; 
    7585<a href="http://www.doxygen.org/index.html"> 
    7686<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> 
  • doc/html/libBM_8h.html

    r7 r8  
    4242<dl class="author" compact><dt><b>Author:</b></dt><dd>Vaclav Smidl.</dd></dl> 
    4343----------------------------------- BDM++ - C++ library for Bayesian Decision Making under Uncertainty<p> 
    44 Using IT++ for numerical operations ----------------------------------- <hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 20 12:47:33 2008 for mixpp by&nbsp; 
     44Using IT++ for numerical operations ----------------------------------- <hr size="1"><address style="text-align: right;"><small>Generated on Wed Jan 23 11:30:10 2008 for mixpp by&nbsp; 
    4545<a href="http://www.doxygen.org/index.html"> 
    4646<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> 
  • doc/latex/annotated.tex

    r7 r8  
    22Here are the classes, structs, unions and interfaces with brief descriptions:\begin{CompactList} 
    33\item\contentsline{section}{{\bf BM} (Bayesian Model of the world, i.e. all uncertainty is modeled by probabilities )}{\pageref{classBM}}{} 
     4\item\contentsline{section}{{\bf eEF} (General conjugate exponential family posterior density )}{\pageref{classeEF}}{} 
     5\item\contentsline{section}{{\bf enorm$<$ sq\_\-T $>$} (General exponential family density )}{\pageref{classenorm}}{} 
    46\item\contentsline{section}{{\bf epdf} (Probability density function with numerical statistics, e.g. posterior density )}{\pageref{classepdf}}{} 
    57\item\contentsline{section}{{\bf fnc} (Class representing function of variables )}{\pageref{classfnc}}{} 
    6 \item\contentsline{section}{{\bf Kalman} (\doxyref{Kalman}{p.}{classKalman} filter with covaraince matrices in square root form )}{\pageref{classKalman}}{} 
    7 \item\contentsline{section}{{\bf KalmanFull} (Basic \doxyref{Kalman}{p.}{classKalman} filter with full matrices (education purpose only)! )}{\pageref{classKalmanFull}}{} 
     8\item\contentsline{section}{{\bf fsqmat} (Fake \doxyref{sqmat}{p.}{classsqmat}. This class maps \doxyref{sqmat}{p.}{classsqmat} operations to operations on full matrix )}{\pageref{classfsqmat}}{} 
     9\item\contentsline{section}{{\bf Kalman$<$ sq\_\-T $>$} (\doxyref{Kalman}{p.}{classKalman} filter with covaraince matrices in square root form )}{\pageref{classKalman}}{} 
     10\item\contentsline{section}{{\bf KalmanFull} (Basic \doxyref{Kalman}{p.}{classKalman} filter with full matrices (education purpose only)! Will be deleted soon! )}{\pageref{classKalmanFull}}{} 
    811\item\contentsline{section}{{\bf mpdf} (Conditional probability density, e.g. modeling some dependencies )}{\pageref{classmpdf}}{} 
     12\item\contentsline{section}{{\bf PF} (A Particle Filter prototype )}{\pageref{classPF}}{} 
    913\item\contentsline{section}{{\bf RV} (Class representing variables, most often random variables )}{\pageref{classRV}}{} 
     14\item\contentsline{section}{{\bf sqmat} (Virtual class for representation of double symmetric matrices in square-root form )}{\pageref{classsqmat}}{} 
     15\item\contentsline{section}{{\bf TrivialPF} (Trivial particle filter with proposal density that is not conditioned on the data )}{\pageref{classTrivialPF}}{} 
    1016\end{CompactList} 
  • doc/latex/doxygen.sty

    r7 r8  
    1111\rhead[\fancyplain{}{\bfseries\leftmark}] 
    1212        {\fancyplain{}{\bfseries\thepage}} 
    13 \rfoot[\fancyplain{}{\bfseries\scriptsize Generated on Sun Jan 20 12:47:33 2008 for mixpp by Doxygen }]{} 
    14 \lfoot[]{\fancyplain{}{\bfseries\scriptsize Generated on Sun Jan 20 12:47:33 2008 for mixpp by Doxygen }} 
     13\rfoot[\fancyplain{}{\bfseries\scriptsize Generated on Wed Jan 23 11:30:10 2008 for mixpp by Doxygen }]{} 
     14\lfoot[]{\fancyplain{}{\bfseries\scriptsize Generated on Wed Jan 23 11:30:10 2008 for mixpp by Doxygen }} 
    1515\cfoot{} 
    1616\newenvironment{Code} 
  • doc/latex/files.tex

    r7 r8  
    44\item\contentsline{section}{work/mixpp/{\bf libBM.h} (Bayesian Models (bm) that use Bayes rule to learn from observations )}{\pageref{libBM_8h}}{} 
    55\item\contentsline{section}{work/mixpp/{\bf libDC.h} (Matrices in decomposed forms (LDL', LU, UDU', etc) )}{\pageref{libDC_8h}}{} 
     6\item\contentsline{section}{work/mixpp/{\bf libEF.h} (Probability distributions for Exponential Family models )}{\pageref{libEF_8h}}{} 
    67\item\contentsline{section}{work/mixpp/{\bf libKF.h} (Bayesian Filtering for linear Gaussian models (\doxyref{Kalman}{p.}{classKalman} Filter) and extensions )}{\pageref{libKF_8h}}{} 
     8\item\contentsline{section}{work/mixpp/{\bf libPF.h} (Bayesian Filtering using stochastic sampling (Particle Filters) )}{\pageref{libPF_8h}}{} 
    79\end{CompactList} 
  • doc/latex/refman.tex

    r7 r8  
    2121{\large Generated by Doxygen 1.5.3}\\ 
    2222\vspace*{0.5cm} 
    23 {\small Sun Jan 20 12:47:33 2008}\\ 
     23{\small Wed Jan 23 11:30:10 2008}\\ 
    2424\end{center} 
    2525\end{titlepage} 
     
    3737\chapter{mixpp Class Documentation} 
    3838\input{classBM} 
     39\include{classeEF} 
     40\include{classenorm} 
    3941\include{classepdf} 
    4042\include{classfnc} 
     43\include{classfsqmat} 
    4144\include{classKalman} 
    4245\include{classKalmanFull} 
    4346\include{classmpdf} 
     47\include{classPF} 
    4448\include{classRV} 
     49\include{classsqmat} 
     50\include{classTrivialPF} 
    4551\chapter{mixpp File Documentation} 
    4652\input{libBM_8h} 
    4753\include{libDC_8h} 
     54\include{libEF_8h} 
    4855\include{libKF_8h} 
     56\include{libPF_8h} 
    4957\printindex 
    5058\end{document} 
  • libBM.cpp

    r5 r8  
    3131} 
    3232 
     33RV::RV () {}; 
     34 
     35inline int RV::length () {return len;}; 
     36 
    3337RV::RV ( ivec in_ids ) { 
    3438         
     
    4852} 
    4953 
     54void RV::t(int delta){ times +=delta;} 
     55 
    5056RV RV::operator()(ivec ind){ 
    5157        return RV(ids(ind), names(to_Arr(ind)), sizes(ind), times(ind), obs(ind)); 
  • libBM.h

    r7 r8  
    3939        //! default constructor 
    4040        RV ( ivec ids ); 
     41        //! Empty constructor will be set later 
     42        RV (); 
     43         
    4144        //! Printing output e.g. for debugging. 
    4245        friend std::ostream &operator<< ( std::ostream &os, const RV &rv ); 
    4346 
     47        //! Return length (number of scalars) of the RV. 
     48        int length(); 
    4449        //! Find indexes of another rv in self 
    4550        ivec rvfind(RV rv2); 
     
    5257        //! Select only variables at indeces ind 
    5358        RV operator()(ivec ind); 
     59        //! Generate new \c RV with \c time shifted by delta. 
     60        void t(int delta); 
    5461}; 
    5562 
     
    8289public: 
    8390        //! Returns the required moment of the epdf 
    84         virtual vec moment ( const int order = 1 ); 
     91//      virtual vec moment ( const int order = 1 ); 
     92        //! Returns a sample from the density, $x \sim epdf(rv)$ 
     93        virtual vec sample (){}; 
     94        virtual double eval(const vec &val){}; 
    8595}; 
    8696 
     
    94104 
    95105        //! Returns the required moment of the epdf 
    96         virtual fnc moment ( const int order = 1 ); 
     106//      virtual fnc moment ( const int order = 1 ); 
     107        //! Returns a sample from the density conditioned on \c cond, $x \sim epdf(rv|cond)$ 
     108        virtual vec samplecond (vec &cond, double lik){}; 
     109        virtual void condition (vec &cond){}; 
    97110}; 
    98111 
  • libDC.cpp

    r7 r8  
    115115} 
    116116 
    117 void ldmat::mult_qform( const mat &C, bool trans ) { 
     117void ldmat::mult_sym( const mat &C, bool trans ) { 
    118118 
    119119//TODO better 
    120120 
    121         it_assert_debug( C.cols()==L.cols(), "ldmat::mult_qform wrong input argument" ); 
     121        it_assert_debug( C.cols()==L.cols(), "ldmat::mult_sym wrong input argument" ); 
    122122        mat Ct=C; 
    123123 
     
    128128                Ct = C.transpose(); 
    129129                Ct *= this->to_mat(); 
     130                Ct *= C; 
     131        } 
     132 
     133        ldmat Lnew=ldmat( Ct ); 
     134        L = Lnew.L; 
     135        D = Lnew.D; 
     136} 
     137 
     138void ldmat::mult_sym( const mat &C, ldmat &U, bool trans ) { 
     139 
     140//TODO better 
     141 
     142//TODO input test 
     143 
     144        mat Ct=C; 
     145 
     146        if ( trans==false ) { // return C*this*C' 
     147                Ct *= U.to_mat(); 
     148                Ct *= C.transpose(); 
     149        } else {        // return C'*this*C 
     150                Ct = C.transpose(); 
     151                Ct *= U.to_mat(); 
    130152                Ct *= C; 
    131153        } 
     
    232254                kD = 1.0; 
    233255                *kr = 0.0; 
    234                 if ( *Df < -threshold ) it_warning( "Problem in dydr: subraction of dyad results in negative definitness. Likely mistake in calling function." ); 
     256                if ( *Df < -threshold ) { 
     257                it_warning( "Problem in dydr: subraction of dyad results in negative definitness. Likely mistake in calling function." );} 
    235258                *Df = 0.0; 
    236259        } 
  • libDC.h

    r7 r8  
    3838        virtual mat to_mat() =0; 
    3939 
    40         /*! \brief Inplace multiplication by a matrix $C$ from both sides, i.e. $V = C*V*C'$ 
     40        /*! \brief Inplace symmetric multiplication by a SQUARE matrix $C$, i.e. $V = C*V*C'$ 
    4141        @param C multiplying matrix, 
    4242        @param trans if true, product $V = C'*V*C$ will be computed instead; 
    4343        */ 
    44         virtual void mult_qform( const mat &C, bool trans=false ) =0; 
     44        virtual void mult_sym( const mat &C, bool trans=true ) =0; 
    4545 
     46         
    4647        /*! 
    4748        \brief Logarithm of a determinant. 
     
    8081        void opupdt( const vec &v, double w ); 
    8182        mat to_mat(); 
    82         void mult_qform( const mat &C, bool trans=false ); 
     83        void mult_sym( const mat &C, bool trans=false ); 
     84   void mult_sym( const mat &C, fsqmat &U, bool trans=false ); 
    8385        void inv(fsqmat &Inv); 
    8486        void clear(); 
     
    108110        void opupdt( const vec &v, double w ); 
    109111        mat to_mat(); 
    110         void mult_qform( const mat &C, bool trans=false ); 
    111         void inv(sqmat* Inv); 
     112   void mult_sym( const mat &C, bool trans=false ); 
    112113        void add ( const ldmat &ld2, double w=1.0 ); 
    113114        double logdet(); 
     
    124125        */ 
    125126        virtual void inv(ldmat &Inv); 
     127         
     128        /*! \brief Symmetric multiplication of $U$ by a general matrix $C$, result of which is stored in the current class. 
     129 
     130        @param Inv a space where the inverse is stored. 
     131         
     132        */ 
     133   void mult_sym( const mat &C, ldmat &U, bool trans=false ); 
    126134 
    127135        ldmat& operator += (const ldmat &ldA); 
     136        ldmat& operator -= (const ldmat &ldA); 
    128137        ldmat& operator *= (double x); 
    129138         
     
    137146 
    138147inline ldmat& ldmat::operator += (const ldmat &ldA)  {this->add(ldA);return *this;} 
     148inline ldmat& ldmat::operator -= (const ldmat &ldA)  {this->add(ldA,-1.0);return *this;} 
    139149inline int ldmat::cols(){return L.cols();} 
    140150inline int ldmat::rows(){return L.rows();} 
  • libKF.h

    r7 r8  
    2222 
    2323/*! 
    24 * \brief Basic Kalman filter with full matrices (education purpose only)! 
     24* \brief Basic Kalman filter with full matrices (education purpose only)! Will be deleted soon! 
    2525*/ 
    2626class KalmanFull : public BM {  
     
    5858         
    5959        //cache 
    60         mat _K, _yp; 
     60        mat _K; 
     61        vec _yp; 
    6162        sq_T _Ry,_iRy; 
    6263public: 
     
    103104        ll = 0; 
    104105//Fixme should we assign cache?? 
     106        _iRy = eye(dimy); // needed in inv(_iRy) 
    105107} 
    106108 
     
    114116        mu = A*mu + B*u; 
    115117        //P  = A*P*A.transpose() + Q; in sq_T 
    116         P.mult_qform( A ); 
     118        P.mult_sym( A ); 
    117119        P+=Q; 
    118120 
    119121        //Data update 
    120122        //_Ry = C*P*C.transpose() + R; in sq_T 
    121         _Ry.mult_qform( C ); 
     123        _Ry.mult_sym( C, P); 
    122124        _Ry+=R; 
    123125 
     
    131133         
    132134        if (evalll==true) { 
    133         ll+= -0.5*_Ry.logdet() -0.5*_iRy.qform(_yp); 
     135        ll+= -0.5*(_Ry.cols()*0.79817986835811504957 \ 
     136        +_Ry.logdet() +_iRy.qform(_yp)); 
    134137        } 
    135138}; 
  • matlab/itsave.m

    r7 r8  
    6767 
    6868  is_scalar = all(size(v) == 1); % true if scalar (for future use) 
    69   is_vector = (sum(size(v) > 1) <= 1); % true if a vector (or a scalar) 
    70   is_intbin = min(min(v == round(v))); % true if integer or binary 
     69  is_vector = 0;%(sum(size(v) > 1) <= 1); % true if a vector (or a scalar) 
     70  is_intbin = 0;%min(min(v == round(v))); % true if integer or binary 
    7171 
    7272  if ( isreal(v) && is_intbin ) % binary or integer type 
  • matlab/testKF.m

    r7 r8  
    1111 
    1212N =1000; 
     13mu0 = [0;0]; 
     14P0 = 200*eye(2); 
    1315 
    1416u = ones(1,N); 
     
    2426 
    2527d=[y;u]; 
    26 itsave('testKF.it',d) 
     28itsave('testKF.it',d,A,B,C,D,Q,R,P0,mu0) 
     29save testKF 
    2730else 
    2831%!cd ../testKF 
    2932 
     33load testKF 
    3034% init  
    31 mu = [0;0]; 
    32 P = 200*eye(2); 
     35mu = mu0; 
     36P = P0; 
     37EP = [0;0]; 
    3338 
    3439for t=2:N 
     
    4146        K = P*C'*iRy;  
    4247        P = P- K*C*P; % P = P -KCP; 
     48        EP(:,t) = eig(P);  
     49        if any(EP<0), keyboard; end 
    4350        mu = mu + K*(y(t)-C*mu-D*u(t)); 
    4451        Mu(1:2,t)=mu; 
     
    5360hold on 
    5461plot(xth','--'); 
     62plot(xth2','+'); 
    5563plot(Mu',':'); 
    5664end 
  • mixpp.kdevelop.filelist

    r7 r8  
    11# KDevelop Custom Project File List 
    22Makefile 
     3arx.cpp 
    34doc 
    45doc/latex 
     
    67itpp_ext.cpp 
    78itpp_ext.h 
    8 doc 
    9 doc/latex 
    10 doc/latex/Makefile 
    119libBM.cpp 
    1210libBM.h 
    1311libDC.cpp 
     12libDC.h 
     13libEF.h 
     14libKF.cpp 
     15libKF.h 
     16libPF.cpp 
     17libPF.h 
    1418test0.cpp 
     19testKF.cpp 
     20testPF.cpp 
  • mixpp.tag

    r7 r8  
    1515    <path>/home/smidl/work/mixpp/</path> 
    1616    <filename>libDC_8h</filename> 
    17     <class kind="class">LD</class> 
     17    <class kind="class">sqmat</class> 
     18    <class kind="class">fsqmat</class> 
     19    <class kind="class">ldmat</class> 
     20  </compound> 
     21  <compound kind="file"> 
     22    <name>libEF.h</name> 
     23    <path>/home/smidl/work/mixpp/</path> 
     24    <filename>libEF_8h</filename> 
     25    <class kind="class">eEF</class> 
     26    <class kind="class">mEF</class> 
     27    <class kind="class">enorm</class> 
     28    <class kind="class">mlnorm</class> 
    1829  </compound> 
    1930  <compound kind="file"> 
     
    2637    <class kind="class">Kalman</class> 
    2738  </compound> 
     39  <compound kind="file"> 
     40    <name>libPF.h</name> 
     41    <path>/home/smidl/work/mixpp/</path> 
     42    <filename>libPF_8h</filename> 
     43    <includes id="libBM_8h" name="libBM.h" local="yes" imported="no">libBM.h</includes> 
     44    <includes id="libDC_8h" name="libDC.h" local="yes" imported="no">libDC.h</includes> 
     45    <class kind="class">PF</class> 
     46    <class kind="class">TrivialPF</class> 
     47    <class kind="class">MPF</class> 
     48  </compound> 
    2849  <compound kind="class"> 
    2950    <name>BM</name> 
     
    4364      <arglist>(mat Dt)</arglist> 
    4465    </member> 
     66    <member kind="variable"> 
     67      <type>double</type> 
     68      <name>ll</name> 
     69      <anchorfile>classBM.html</anchorfile> 
     70      <anchor>5623fef6572a08c2b53b8c87b82dc979</anchor> 
     71      <arglist></arglist> 
     72    </member> 
     73  </compound> 
     74  <compound kind="class"> 
     75    <name>eEF</name> 
     76    <filename>classeEF.html</filename> 
     77    <base>epdf</base> 
     78    <member kind="function" virtualness="virtual"> 
     79      <type>virtual void</type> 
     80      <name>tupdate</name> 
     81      <anchorfile>classeEF.html</anchorfile> 
     82      <anchor>fd88bc35550ec8fe9281d358216d0fcf</anchor> 
     83      <arglist>(double phi, mat &amp;vbar, double nubar)</arglist> 
     84    </member> 
     85    <member kind="function" virtualness="virtual"> 
     86      <type>virtual void</type> 
     87      <name>dupdate</name> 
     88      <anchorfile>classeEF.html</anchorfile> 
     89      <anchor>5863718c3b2fb1496dece10c5b745d5c</anchor> 
     90      <arglist>(mat &amp;v, double nu=1.0)</arglist> 
     91    </member> 
     92  </compound> 
     93  <compound kind="class"> 
     94    <name>enorm</name> 
     95    <filename>classenorm.html</filename> 
     96    <templarg>sq_T</templarg> 
     97    <base>eEF</base> 
     98    <member kind="function"> 
     99      <type></type> 
     100      <name>enorm</name> 
     101      <anchorfile>classenorm.html</anchorfile> 
     102      <anchor>183891111686898adef0f6ca292e600d</anchor> 
     103      <arglist>(RV &amp;rv, vec &amp;mu, sq_T &amp;R)</arglist> 
     104    </member> 
     105    <member kind="function"> 
     106      <type>void</type> 
     107      <name>tupdate</name> 
     108      <anchorfile>classenorm.html</anchorfile> 
     109      <anchor>5b5fd142b6b17ea334597960e3fe126a</anchor> 
     110      <arglist>(double phi, mat &amp;vbar, double nubar)</arglist> 
     111    </member> 
     112    <member kind="function"> 
     113      <type>void</type> 
     114      <name>dupdate</name> 
     115      <anchorfile>classenorm.html</anchorfile> 
     116      <anchor>5bf185e31e5954fceb90ada3debd2ff2</anchor> 
     117      <arglist>(mat &amp;v, double nu=1.0)</arglist> 
     118    </member> 
     119    <member kind="function"> 
     120      <type>vec</type> 
     121      <name>sample</name> 
     122      <anchorfile>classenorm.html</anchorfile> 
     123      <anchor>6020bcd89db2c9584bd8871001bd2023</anchor> 
     124      <arglist>()</arglist> 
     125    </member> 
     126    <member kind="function"> 
     127      <type>double</type> 
     128      <name>eval</name> 
     129      <anchorfile>classenorm.html</anchorfile> 
     130      <anchor>93107f05a8e9b34b64853767200121a4</anchor> 
     131      <arglist>(const vec &amp;val)</arglist> 
     132    </member> 
    45133  </compound> 
    46134  <compound kind="class"> 
     
    49137    <member kind="function" virtualness="virtual"> 
    50138      <type>virtual vec</type> 
    51       <name>moment</name> 
     139      <name>sample</name> 
    52140      <anchorfile>classepdf.html</anchorfile> 
    53       <anchor>545555f9d561555603911f7d3989611f</anchor> 
    54       <arglist>(const int order=1)</arglist> 
     141      <anchor>e6ce993603a95c2645eb86305ea51396</anchor> 
     142      <arglist>()</arglist> 
     143    </member> 
     144    <member kind="function" virtualness="virtual"> 
     145      <type>virtual double</type> 
     146      <name>eval</name> 
     147      <anchorfile>classepdf.html</anchorfile> 
     148      <anchor>f333ceeb88ebc37d81fcd4cea4526bfc</anchor> 
     149      <arglist>(const vec &amp;val)</arglist> 
    55150    </member> 
    56151  </compound> 
     
    60155  </compound> 
    61156  <compound kind="class"> 
     157    <name>fsqmat</name> 
     158    <filename>classfsqmat.html</filename> 
     159    <base protection="private">sqmat</base> 
     160  </compound> 
     161  <compound kind="class"> 
    62162    <name>Kalman</name> 
    63163    <filename>classKalman.html</filename> 
     164    <templarg>sq_T</templarg> 
    64165    <base>BM</base> 
    65166    <member kind="function"> 
     
    67168      <name>Kalman</name> 
    68169      <anchorfile>classKalman.html</anchorfile> 
    69       <anchor>04e31a807dae4dea4aef3f0a47ec191a</anchor> 
    70       <arglist>(mat A, mat B, mat C, mat D, mat R, mat Q, mat P0, vec mu0)</arglist> 
     170      <anchor>83118f4bd2ecbc70b03cfd573088ed6f</anchor> 
     171      <arglist>(mat A0, mat B0, mat C0, mat D0, sq_T R0, sq_T Q0, sq_T P0, vec mu0)</arglist> 
    71172    </member> 
    72173    <member kind="function"> 
     
    74175      <name>bayes</name> 
    75176      <anchorfile>classKalman.html</anchorfile> 
    76       <anchor>398ecc4378c139ef3dabdd210452fd54</anchor> 
     177      <anchor>e945d9205ca14acbd83ba80ea6f72b8e</anchor> 
    77178      <arglist>(const vec &amp;dt, bool evalll=true)</arglist> 
    78179    </member> 
     
    81182      <name>mu</name> 
    82183      <anchorfile>classKalman.html</anchorfile> 
    83       <anchor>950f5196f688fc0e4e58640d07b11e5d</anchor> 
     184      <anchor>3063a3f58a74cea672ae889971012eed</anchor> 
    84185      <arglist></arglist> 
    85186    </member> 
    86187    <member kind="variable"> 
    87       <type>mat</type> 
     188      <type>sq_T</type> 
    88189      <name>P</name> 
    89190      <anchorfile>classKalman.html</anchorfile> 
    90       <anchor>4b09f16863a10e0fa17f5106432c6da4</anchor> 
     191      <anchor>188cd5ac1c9e496b1a371eb7c57c97d3</anchor> 
    91192      <arglist></arglist> 
    92193    </member> 
     
    114215      <name>bayes</name> 
    115216      <anchorfile>classKalmanFull.html</anchorfile> 
    116       <anchor>13a041cd98ff157703766be275a657bb</anchor> 
    117       <arglist>(const vec &amp;dt)</arglist> 
     217      <anchor>048b13739b94c331cda08249b278552b</anchor> 
     218      <arglist>(const vec &amp;dt, bool evalll=true)</arglist> 
    118219    </member> 
    119220    <member kind="variable"> 
     
    129230      <anchorfile>classKalmanFull.html</anchorfile> 
    130231      <anchor>b75dc059e84fa8ffc076203b30f926cc</anchor> 
    131       <arglist></arglist> 
    132     </member> 
    133     <member kind="variable"> 
    134       <type>double</type> 
    135       <name>ll</name> 
    136       <anchorfile>classKalmanFull.html</anchorfile> 
    137       <anchor>3aa4bf6128980d0627413dcf9cd07308</anchor> 
    138232      <arglist></arglist> 
    139233    </member> 
     
    150244    <filename>classmpdf.html</filename> 
    151245    <member kind="function" virtualness="virtual"> 
    152       <type>virtual fnc</type> 
    153       <name>moment</name> 
     246      <type>virtual vec</type> 
     247      <name>samplecond</name> 
    154248      <anchorfile>classmpdf.html</anchorfile> 
    155       <anchor>0863640c439869e8fbbbeb2bd8ea1fc0</anchor> 
    156       <arglist>(const int order=1)</arglist> 
     249      <anchor>c20c796f8d0a201f0897299150e45a41</anchor> 
     250      <arglist>(vec &amp;cond, double lik)</arglist> 
     251    </member> 
     252    <member kind="function" virtualness="virtual"> 
     253      <type>virtual void</type> 
     254      <name>condition</name> 
     255      <anchorfile>classmpdf.html</anchorfile> 
     256      <anchor>cfb3dffef7c03598622e414668bb0588</anchor> 
     257      <arglist>(vec &amp;cond)</arglist> 
     258    </member> 
     259  </compound> 
     260  <compound kind="class"> 
     261    <name>PF</name> 
     262    <filename>classPF.html</filename> 
     263    <base>BM</base> 
     264    <member kind="function"> 
     265      <type>ivec</type> 
     266      <name>resample</name> 
     267      <anchorfile>classPF.html</anchorfile> 
     268      <anchor>a0e26b2f6a5884aca49122f3e4f0cf19</anchor> 
     269      <arglist>(RESAMPLING_METHOD method=SYSTEMATIC)</arglist> 
     270    </member> 
     271    <member kind="variable" protection="protected"> 
     272      <type>int</type> 
     273      <name>n</name> 
     274      <anchorfile>classPF.html</anchorfile> 
     275      <anchor>2c2f44ed7a4eaa42e07bdb58d503f280</anchor> 
     276      <arglist></arglist> 
     277    </member> 
     278    <member kind="variable" protection="protected"> 
     279      <type>vec</type> 
     280      <name>w</name> 
     281      <anchorfile>classPF.html</anchorfile> 
     282      <anchor>f6bc92f7979af4513b06b161497ba868</anchor> 
     283      <arglist></arglist> 
    157284    </member> 
    158285  </compound> 
     
    175302    </member> 
    176303    <member kind="function"> 
     304      <type></type> 
     305      <name>RV</name> 
     306      <anchorfile>classRV.html</anchorfile> 
     307      <anchor>6a22f5c06d6403870d4e414b1993bf9e</anchor> 
     308      <arglist>()</arglist> 
     309    </member> 
     310    <member kind="function"> 
     311      <type>int</type> 
     312      <name>length</name> 
     313      <anchorfile>classRV.html</anchorfile> 
     314      <anchor>a764092415291a0e6452a3711749d18e</anchor> 
     315      <arglist>()</arglist> 
     316    </member> 
     317    <member kind="function"> 
    177318      <type>ivec</type> 
    178319      <name>rvfind</name> 
     
    208349      <anchor>28bbcb8873bafdac317bafb7b481cc45</anchor> 
    209350      <arglist>(ivec ind)</arglist> 
     351    </member> 
     352    <member kind="function"> 
     353      <type>void</type> 
     354      <name>t</name> 
     355      <anchorfile>classRV.html</anchorfile> 
     356      <anchor>e0a158d53ab9430627241f844f4c9a60</anchor> 
     357      <arglist>(int delta)</arglist> 
    210358    </member> 
    211359    <member kind="friend"> 
     
    217365    </member> 
    218366  </compound> 
     367  <compound kind="class"> 
     368    <name>sqmat</name> 
     369    <filename>classsqmat.html</filename> 
     370    <member kind="function" virtualness="pure"> 
     371      <type>virtual void</type> 
     372      <name>opupdt</name> 
     373      <anchorfile>classsqmat.html</anchorfile> 
     374      <anchor>b223484796661f2dadb5607a86ce0581</anchor> 
     375      <arglist>(const vec &amp;v, double w)=0</arglist> 
     376    </member> 
     377    <member kind="function" virtualness="pure"> 
     378      <type>virtual mat</type> 
     379      <name>to_mat</name> 
     380      <anchorfile>classsqmat.html</anchorfile> 
     381      <anchor>9a5b6fddfeb42339e1dc9b978a2590fc</anchor> 
     382      <arglist>()=0</arglist> 
     383    </member> 
     384    <member kind="function" virtualness="pure"> 
     385      <type>virtual void</type> 
     386      <name>mult_sym</name> 
     387      <anchorfile>classsqmat.html</anchorfile> 
     388      <anchor>faa3bc90be142adde9cf74f573c70157</anchor> 
     389      <arglist>(const mat &amp;C, bool trans=true)=0</arglist> 
     390    </member> 
     391    <member kind="function" virtualness="pure"> 
     392      <type>virtual double</type> 
     393      <name>logdet</name> 
     394      <anchorfile>classsqmat.html</anchorfile> 
     395      <anchor>5c852819589f74cdaefbd648c0ce8547</anchor> 
     396      <arglist>()=0</arglist> 
     397    </member> 
     398    <member kind="function" virtualness="pure"> 
     399      <type>virtual double</type> 
     400      <name>qform</name> 
     401      <anchorfile>classsqmat.html</anchorfile> 
     402      <anchor>44e079468bc8bfccf634dc85b32ba6be</anchor> 
     403      <arglist>(vec &amp;v)=0</arglist> 
     404    </member> 
     405    <member kind="function" virtualness="pure"> 
     406      <type>virtual void</type> 
     407      <name>clear</name> 
     408      <anchorfile>classsqmat.html</anchorfile> 
     409      <anchor>6fca246f9eabbdeb8cac03030e826b5e</anchor> 
     410      <arglist>()=0</arglist> 
     411    </member> 
     412    <member kind="function" virtualness="pure"> 
     413      <type>virtual int</type> 
     414      <name>cols</name> 
     415      <anchorfile>classsqmat.html</anchorfile> 
     416      <anchor>743d3799d9e73403230c54e14ecf09ed</anchor> 
     417      <arglist>()=0</arglist> 
     418    </member> 
     419    <member kind="function" virtualness="pure"> 
     420      <type>virtual int</type> 
     421      <name>rows</name> 
     422      <anchorfile>classsqmat.html</anchorfile> 
     423      <anchor>f59664a4be09450f8c6ce3f5e5ab2dc7</anchor> 
     424      <arglist>()=0</arglist> 
     425    </member> 
     426    <member kind="friend"> 
     427      <type>friend std::ostream &amp;</type> 
     428      <name>operator&lt;&lt;</name> 
     429      <anchorfile>classsqmat.html</anchorfile> 
     430      <anchor>c9eb5aa871432ddb9c5a45ddbbb19eab</anchor> 
     431      <arglist>(std::ostream &amp;os, sqmat &amp;sq)</arglist> 
     432    </member> 
     433  </compound> 
     434  <compound kind="class"> 
     435    <name>TrivialPF</name> 
     436    <filename>classTrivialPF.html</filename> 
     437    <base>PF</base> 
     438    <member kind="function"> 
     439      <type></type> 
     440      <name>TrivialPF</name> 
     441      <anchorfile>classTrivialPF.html</anchorfile> 
     442      <anchor>e6d9e3506da221a10a517bd5712b5a84</anchor> 
     443      <arglist>(mpdf &amp;par, mpdf &amp;obs, mpdf &amp;prop, int n0)</arglist> 
     444    </member> 
     445    <member kind="function"> 
     446      <type></type> 
     447      <name>TrivialPF</name> 
     448      <anchorfile>classTrivialPF.html</anchorfile> 
     449      <anchor>59fc4c55a2d5fbb6bc9a17a9dd9a2e13</anchor> 
     450      <arglist>(mpdf &amp;par, mpdf &amp;obs, int n0)</arglist> 
     451    </member> 
     452    <member kind="function"> 
     453      <type>void</type> 
     454      <name>bayes</name> 
     455      <anchorfile>classTrivialPF.html</anchorfile> 
     456      <anchor>77a92bf054d763f806d27fc37a058389</anchor> 
     457      <arglist>(const vec &amp;dt, bool evalll)</arglist> 
     458    </member> 
     459  </compound> 
    219460</tagfile> 
  • testKF.cpp

    r7 r8  
    1111int main() { 
    1212 
    13         mat A="1 -0.5; 1 0"; 
    14         mat B="1;0"; 
    15         mat C="1 0"; 
    16         mat D="0"; 
    17         ldmat R=ldmat("0.1"); 
    18         ldmat Q=ldmat("0.2 0 ; 0 0.02"); 
    19  
    20         ldmat P0=Q; P0*=1000.0; //increase P0 
    21         vec mu0="0 0"; 
    22  
    23         Kalman<ldmat> KF( A,B,C,D,R,Q,P0,mu0 ); 
    24 //      cout << KF; 
    25  
     13        // Klaman filter 
     14        mat A, B,C,D,R,Q,P0; 
     15        vec mu0; 
     16        mat Mu0;; 
     17        // input from Matlab 
    2618        it_file fin( "matlab/testKF.it" ); 
    27         mat Dt; 
     19        mat Dt, Xt,Xt2; 
     20        int Ndat; 
    2821 
    2922        fin >> Name( "d" ) >> Dt; 
    30         int Ndat = Dt.cols(); 
    31         mat Xt=zeros( 2,Ndat ); 
     23        fin.seek( "A" );  
     24        fin >> A; 
     25        fin.seek( "B" );  
     26        fin >> B; 
     27        fin.seek( "C" );  
     28        fin >> C; 
     29        fin.seek( "D" );  
     30        fin >> D; 
     31        fin.seek( "R" );  
     32        fin >> R; 
     33        fin.seek( "Q" ); fin >> Q; 
     34        fin.seek( "P0" ); fin >> P0; 
     35        fin.seek( "mu0" ); fin >> Mu0; mu0=Mu0; 
    3236         
     37        Ndat = Dt.cols(); 
     38        Xt=zeros( 2,Ndat ); 
     39        Xt2=zeros( 2,Ndat ); 
     40 
     41        Kalman<ldmat> KF( A,B,C,D,ldmat(R),ldmat(Q),ldmat(P0),mu0 ); 
     42//      cout << KF; 
     43        KalmanFull KF2( A,B,C,D,R,Q,P0,mu0 ); 
    3344 
    3445        Xt.set_col( 0,KF.mu ); 
     46        Xt2.set_col( 0,KF.mu ); 
    3547        for ( int t=1;t<Ndat;t++ ) { 
    3648                KF.bayes( Dt.get_col( t )); 
     49                KF2.bayes( Dt.get_col( t )); 
    3750                Xt.set_col(t,KF.mu); 
     51                Xt2.set_col(t,KF2.mu); 
    3852//              Kmu = KF.mu; 
    3953//              cout <<  "t:" <<t<< "  " << dt<<"  "<<Kmu <<endl; 
    40  
     54                cout <<t <<endl; 
    4155        } 
    4256 
    4357        it_file fou( "matlab/testKF_res.it" ); 
    4458        fou << Name("xth") << Xt; 
     59        fou << Name("xth2") << Xt2; 
    4560        //Exit program: 
    4661        return 0;