Changeset 8
- Timestamp:
- 01/23/08 11:32:31 (17 years ago)
- Files:
-
- 79 added
- 22 modified
Legend:
- Unmodified
- Added
- Removed
-
Makefile
r7 r8 2 2 CPPFLAGS=-g 3 3 4 all: test KF4 all: testPF 5 5 6 6 test: test0 … … 12 12 test0: test0.cpp libBM.o libDC.o itpp_ext.o 13 13 testKF: 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) 14 testPF: testPF.o libPF.o libBM.o libDC.o itpp_ext.o -
doc/html/annotated.html
r7 r8 22 22 <h1>mixpp Class List</h1>Here are the classes, structs, unions and interfaces with brief descriptions:<table> 23 23 <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< sq_T ></a></td><td class="indexvalue">General exponential family density </td></tr> 24 26 <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> 25 27 <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< sq_T ></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> 28 31 <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> 29 33 <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> 30 36 </table> 31 <hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 20 12:47:332008 for mixpp by 37 <hr size="1"><address style="text-align: right;"><small>Generated on Wed Jan 23 11:30:10 2008 for mixpp by 32 38 <a href="http://www.doxygen.org/index.html"> 33 39 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> -
doc/html/classfnc-members.html
r7 r8 21 21 </div> 22 22 <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:342008 for mixpp by 23 </table><hr size="1"><address style="text-align: right;"><small>Generated on Wed Jan 23 11:30:11 2008 for mixpp by 24 24 <a href="http://www.doxygen.org/index.html"> 25 25 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> -
doc/html/classfnc.html
r7 r8 33 33 Class representing function of variables. <hr>The documentation for this class was generated from the following file:<ul> 34 34 <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:342008 for mixpp by 35 <hr size="1"><address style="text-align: right;"><small>Generated on Wed Jan 23 11:30:11 2008 for mixpp by 36 36 <a href="http://www.doxygen.org/index.html"> 37 37 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> -
doc/html/files.html
r7 r8 17 17 <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> 18 18 <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> 19 20 <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> 20 22 </table> 21 <hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 20 12:47:342008 for mixpp by 23 <hr size="1"><address style="text-align: right;"><small>Generated on Wed Jan 23 11:30:12 2008 for mixpp by 22 24 <a href="http://www.doxygen.org/index.html"> 23 25 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> -
doc/html/index.html
r7 r8 15 15 <h1>mixpp Documentation</h1> 16 16 <p> 17 <h3 align="center">1 </h3><hr size="1"><address style="text-align: right;"><small>Generated on Sun Jan 20 12:47:332008 for mixpp by 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 18 18 <a href="http://www.doxygen.org/index.html"> 19 19 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> -
doc/html/libBM_8h-source.html
r7 r8 33 33 <a name="l00035"></a>00035 <span class="keywordtype">void</span> init ( ivec in_ids, Array<std::string> in_names, ivec in_sizes, ivec in_times, ivec in_obs ); 34 34 <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<std::string> 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 &<a class="code" href="classRV.html#cad6f15535d10437f6690cb4492176a8" title="Printing output e.g. for debugging.">operator<< </a>( std::ostream &os, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &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<std::string> 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 &<a class="code" href="classRV.html#cad6f15535d10437f6690cb4492176a8" title="Printing output e.g. for debugging.">operator<< </a>( std::ostream &os, <span class="keyword">const</span> <a class="code" href="classRV.html" title="Class representing variables, most often random variables.">RV</a> &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 52 50 <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 &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 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 &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 &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 &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 &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 75 85 <a href="http://www.doxygen.org/index.html"> 76 86 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> -
doc/html/libBM_8h.html
r7 r8 42 42 <dl class="author" compact><dt><b>Author:</b></dt><dd>Vaclav Smidl.</dd></dl> 43 43 ----------------------------------- 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:332008 for mixpp by 44 Using 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 45 45 <a href="http://www.doxygen.org/index.html"> 46 46 <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.3 </small></address> -
doc/latex/annotated.tex
r7 r8 2 2 Here are the classes, structs, unions and interfaces with brief descriptions:\begin{CompactList} 3 3 \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}}{} 4 6 \item\contentsline{section}{{\bf epdf} (Probability density function with numerical statistics, e.g. posterior density )}{\pageref{classepdf}}{} 5 7 \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}}{} 8 11 \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}}{} 9 13 \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}}{} 10 16 \end{CompactList} -
doc/latex/doxygen.sty
r7 r8 11 11 \rhead[\fancyplain{}{\bfseries\leftmark}] 12 12 {\fancyplain{}{\bfseries\thepage}} 13 \rfoot[\fancyplain{}{\bfseries\scriptsize Generated on Sun Jan 20 12:47:332008 for mixpp by Doxygen }]{}14 \lfoot[]{\fancyplain{}{\bfseries\scriptsize Generated on Sun Jan 20 12:47:332008 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 }} 15 15 \cfoot{} 16 16 \newenvironment{Code} -
doc/latex/files.tex
r7 r8 4 4 \item\contentsline{section}{work/mixpp/{\bf libBM.h} (Bayesian Models (bm) that use Bayes rule to learn from observations )}{\pageref{libBM_8h}}{} 5 5 \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}}{} 6 7 \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}}{} 7 9 \end{CompactList} -
doc/latex/refman.tex
r7 r8 21 21 {\large Generated by Doxygen 1.5.3}\\ 22 22 \vspace*{0.5cm} 23 {\small Sun Jan 20 12:47:332008}\\23 {\small Wed Jan 23 11:30:10 2008}\\ 24 24 \end{center} 25 25 \end{titlepage} … … 37 37 \chapter{mixpp Class Documentation} 38 38 \input{classBM} 39 \include{classeEF} 40 \include{classenorm} 39 41 \include{classepdf} 40 42 \include{classfnc} 43 \include{classfsqmat} 41 44 \include{classKalman} 42 45 \include{classKalmanFull} 43 46 \include{classmpdf} 47 \include{classPF} 44 48 \include{classRV} 49 \include{classsqmat} 50 \include{classTrivialPF} 45 51 \chapter{mixpp File Documentation} 46 52 \input{libBM_8h} 47 53 \include{libDC_8h} 54 \include{libEF_8h} 48 55 \include{libKF_8h} 56 \include{libPF_8h} 49 57 \printindex 50 58 \end{document} -
libBM.cpp
r5 r8 31 31 } 32 32 33 RV::RV () {}; 34 35 inline int RV::length () {return len;}; 36 33 37 RV::RV ( ivec in_ids ) { 34 38 … … 48 52 } 49 53 54 void RV::t(int delta){ times +=delta;} 55 50 56 RV RV::operator()(ivec ind){ 51 57 return RV(ids(ind), names(to_Arr(ind)), sizes(ind), times(ind), obs(ind)); -
libBM.h
r7 r8 39 39 //! default constructor 40 40 RV ( ivec ids ); 41 //! Empty constructor will be set later 42 RV (); 43 41 44 //! Printing output e.g. for debugging. 42 45 friend std::ostream &operator<< ( std::ostream &os, const RV &rv ); 43 46 47 //! Return length (number of scalars) of the RV. 48 int length(); 44 49 //! Find indexes of another rv in self 45 50 ivec rvfind(RV rv2); … … 52 57 //! Select only variables at indeces ind 53 58 RV operator()(ivec ind); 59 //! Generate new \c RV with \c time shifted by delta. 60 void t(int delta); 54 61 }; 55 62 … … 82 89 public: 83 90 //! 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){}; 85 95 }; 86 96 … … 94 104 95 105 //! 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){}; 97 110 }; 98 111 -
libDC.cpp
r7 r8 115 115 } 116 116 117 void ldmat::mult_ qform( const mat &C, bool trans ) {117 void ldmat::mult_sym( const mat &C, bool trans ) { 118 118 119 119 //TODO better 120 120 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" ); 122 122 mat Ct=C; 123 123 … … 128 128 Ct = C.transpose(); 129 129 Ct *= this->to_mat(); 130 Ct *= C; 131 } 132 133 ldmat Lnew=ldmat( Ct ); 134 L = Lnew.L; 135 D = Lnew.D; 136 } 137 138 void 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(); 130 152 Ct *= C; 131 153 } … … 232 254 kD = 1.0; 233 255 *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." );} 235 258 *Df = 0.0; 236 259 } -
libDC.h
r7 r8 38 38 virtual mat to_mat() =0; 39 39 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'$ 41 41 @param C multiplying matrix, 42 42 @param trans if true, product $V = C'*V*C$ will be computed instead; 43 43 */ 44 virtual void mult_ qform( const mat &C, bool trans=false ) =0;44 virtual void mult_sym( const mat &C, bool trans=true ) =0; 45 45 46 46 47 /*! 47 48 \brief Logarithm of a determinant. … … 80 81 void opupdt( const vec &v, double w ); 81 82 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 ); 83 85 void inv(fsqmat &Inv); 84 86 void clear(); … … 108 110 void opupdt( const vec &v, double w ); 109 111 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 ); 112 113 void add ( const ldmat &ld2, double w=1.0 ); 113 114 double logdet(); … … 124 125 */ 125 126 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 ); 126 134 127 135 ldmat& operator += (const ldmat &ldA); 136 ldmat& operator -= (const ldmat &ldA); 128 137 ldmat& operator *= (double x); 129 138 … … 137 146 138 147 inline ldmat& ldmat::operator += (const ldmat &ldA) {this->add(ldA);return *this;} 148 inline ldmat& ldmat::operator -= (const ldmat &ldA) {this->add(ldA,-1.0);return *this;} 139 149 inline int ldmat::cols(){return L.cols();} 140 150 inline int ldmat::rows(){return L.rows();} -
libKF.h
r7 r8 22 22 23 23 /*! 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! 25 25 */ 26 26 class KalmanFull : public BM { … … 58 58 59 59 //cache 60 mat _K, _yp; 60 mat _K; 61 vec _yp; 61 62 sq_T _Ry,_iRy; 62 63 public: … … 103 104 ll = 0; 104 105 //Fixme should we assign cache?? 106 _iRy = eye(dimy); // needed in inv(_iRy) 105 107 } 106 108 … … 114 116 mu = A*mu + B*u; 115 117 //P = A*P*A.transpose() + Q; in sq_T 116 P.mult_ qform( A );118 P.mult_sym( A ); 117 119 P+=Q; 118 120 119 121 //Data update 120 122 //_Ry = C*P*C.transpose() + R; in sq_T 121 _Ry.mult_ qform( C);123 _Ry.mult_sym( C, P); 122 124 _Ry+=R; 123 125 … … 131 133 132 134 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)); 134 137 } 135 138 }; -
matlab/itsave.m
r7 r8 67 67 68 68 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 binary69 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 71 71 72 72 if ( isreal(v) && is_intbin ) % binary or integer type -
matlab/testKF.m
r7 r8 11 11 12 12 N =1000; 13 mu0 = [0;0]; 14 P0 = 200*eye(2); 13 15 14 16 u = ones(1,N); … … 24 26 25 27 d=[y;u]; 26 itsave('testKF.it',d) 28 itsave('testKF.it',d,A,B,C,D,Q,R,P0,mu0) 29 save testKF 27 30 else 28 31 %!cd ../testKF 29 32 33 load testKF 30 34 % init 31 mu = [0;0]; 32 P = 200*eye(2); 35 mu = mu0; 36 P = P0; 37 EP = [0;0]; 33 38 34 39 for t=2:N … … 41 46 K = P*C'*iRy; 42 47 P = P- K*C*P; % P = P -KCP; 48 EP(:,t) = eig(P); 49 if any(EP<0), keyboard; end 43 50 mu = mu + K*(y(t)-C*mu-D*u(t)); 44 51 Mu(1:2,t)=mu; … … 53 60 hold on 54 61 plot(xth','--'); 62 plot(xth2','+'); 55 63 plot(Mu',':'); 56 64 end -
mixpp.kdevelop.filelist
r7 r8 1 1 # KDevelop Custom Project File List 2 2 Makefile 3 arx.cpp 3 4 doc 4 5 doc/latex … … 6 7 itpp_ext.cpp 7 8 itpp_ext.h 8 doc9 doc/latex10 doc/latex/Makefile11 9 libBM.cpp 12 10 libBM.h 13 11 libDC.cpp 12 libDC.h 13 libEF.h 14 libKF.cpp 15 libKF.h 16 libPF.cpp 17 libPF.h 14 18 test0.cpp 19 testKF.cpp 20 testPF.cpp -
mixpp.tag
r7 r8 15 15 <path>/home/smidl/work/mixpp/</path> 16 16 <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> 18 29 </compound> 19 30 <compound kind="file"> … … 26 37 <class kind="class">Kalman</class> 27 38 </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> 28 49 <compound kind="class"> 29 50 <name>BM</name> … … 43 64 <arglist>(mat Dt)</arglist> 44 65 </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 &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 &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 &rv, vec &mu, sq_T &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 &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 &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 &val)</arglist> 132 </member> 45 133 </compound> 46 134 <compound kind="class"> … … 49 137 <member kind="function" virtualness="virtual"> 50 138 <type>virtual vec</type> 51 <name> moment</name>139 <name>sample</name> 52 140 <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 &val)</arglist> 55 150 </member> 56 151 </compound> … … 60 155 </compound> 61 156 <compound kind="class"> 157 <name>fsqmat</name> 158 <filename>classfsqmat.html</filename> 159 <base protection="private">sqmat</base> 160 </compound> 161 <compound kind="class"> 62 162 <name>Kalman</name> 63 163 <filename>classKalman.html</filename> 164 <templarg>sq_T</templarg> 64 165 <base>BM</base> 65 166 <member kind="function"> … … 67 168 <name>Kalman</name> 68 169 <anchorfile>classKalman.html</anchorfile> 69 <anchor> 04e31a807dae4dea4aef3f0a47ec191a</anchor>70 <arglist>(mat A , mat B, mat C, mat D, mat R, mat Q, matP0, 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> 71 172 </member> 72 173 <member kind="function"> … … 74 175 <name>bayes</name> 75 176 <anchorfile>classKalman.html</anchorfile> 76 <anchor> 398ecc4378c139ef3dabdd210452fd54</anchor>177 <anchor>e945d9205ca14acbd83ba80ea6f72b8e</anchor> 77 178 <arglist>(const vec &dt, bool evalll=true)</arglist> 78 179 </member> … … 81 182 <name>mu</name> 82 183 <anchorfile>classKalman.html</anchorfile> 83 <anchor> 950f5196f688fc0e4e58640d07b11e5d</anchor>184 <anchor>3063a3f58a74cea672ae889971012eed</anchor> 84 185 <arglist></arglist> 85 186 </member> 86 187 <member kind="variable"> 87 <type> mat</type>188 <type>sq_T</type> 88 189 <name>P</name> 89 190 <anchorfile>classKalman.html</anchorfile> 90 <anchor> 4b09f16863a10e0fa17f5106432c6da4</anchor>191 <anchor>188cd5ac1c9e496b1a371eb7c57c97d3</anchor> 91 192 <arglist></arglist> 92 193 </member> … … 114 215 <name>bayes</name> 115 216 <anchorfile>classKalmanFull.html</anchorfile> 116 <anchor> 13a041cd98ff157703766be275a657bb</anchor>117 <arglist>(const vec &dt )</arglist>217 <anchor>048b13739b94c331cda08249b278552b</anchor> 218 <arglist>(const vec &dt, bool evalll=true)</arglist> 118 219 </member> 119 220 <member kind="variable"> … … 129 230 <anchorfile>classKalmanFull.html</anchorfile> 130 231 <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>138 232 <arglist></arglist> 139 233 </member> … … 150 244 <filename>classmpdf.html</filename> 151 245 <member kind="function" virtualness="virtual"> 152 <type>virtual fnc</type>153 <name> moment</name>246 <type>virtual vec</type> 247 <name>samplecond</name> 154 248 <anchorfile>classmpdf.html</anchorfile> 155 <anchor>0863640c439869e8fbbbeb2bd8ea1fc0</anchor> 156 <arglist>(const int order=1)</arglist> 249 <anchor>c20c796f8d0a201f0897299150e45a41</anchor> 250 <arglist>(vec &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 &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> 157 284 </member> 158 285 </compound> … … 175 302 </member> 176 303 <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"> 177 318 <type>ivec</type> 178 319 <name>rvfind</name> … … 208 349 <anchor>28bbcb8873bafdac317bafb7b481cc45</anchor> 209 350 <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> 210 358 </member> 211 359 <member kind="friend"> … … 217 365 </member> 218 366 </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 &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 &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 &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 &</type> 428 <name>operator<<</name> 429 <anchorfile>classsqmat.html</anchorfile> 430 <anchor>c9eb5aa871432ddb9c5a45ddbbb19eab</anchor> 431 <arglist>(std::ostream &os, sqmat &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 &par, mpdf &obs, mpdf &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 &par, mpdf &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 &dt, bool evalll)</arglist> 458 </member> 459 </compound> 219 460 </tagfile> -
testKF.cpp
r7 r8 11 11 int main() { 12 12 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 26 18 it_file fin( "matlab/testKF.it" ); 27 mat Dt; 19 mat Dt, Xt,Xt2; 20 int Ndat; 28 21 29 22 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; 32 36 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 ); 33 44 34 45 Xt.set_col( 0,KF.mu ); 46 Xt2.set_col( 0,KF.mu ); 35 47 for ( int t=1;t<Ndat;t++ ) { 36 48 KF.bayes( Dt.get_col( t )); 49 KF2.bayes( Dt.get_col( t )); 37 50 Xt.set_col(t,KF.mu); 51 Xt2.set_col(t,KF2.mu); 38 52 // Kmu = KF.mu; 39 53 // cout << "t:" <<t<< " " << dt<<" "<<Kmu <<endl; 40 54 cout <<t <<endl; 41 55 } 42 56 43 57 it_file fou( "matlab/testKF_res.it" ); 44 58 fou << Name("xth") << Xt; 59 fou << Name("xth2") << Xt2; 45 60 //Exit program: 46 61 return 0;