182 | | <a name="l00232"></a>00232 <a class="code" href="classbdm_1_1EKFCh.html#8b3228a594532b6a0db0fdc065bc5b9f" title="Default constructor.">EKFCh</a> (); |
183 | | <a name="l00234"></a>00234 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1EKFCh.html#50f9fbffad721f35e5ccb75d0f6b842a" title="Set nonlinear functions for mean values and covariance matrices.">set_parameters</a> ( <a class="code" href="classbdm_1_1diffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a>* <a class="code" href="classbdm_1_1EKFCh.html#e1e895f994398a55bc425551fc275ba3" title="Internal Model f(x,u).">pfxu</a>, <a class="code" href="classbdm_1_1diffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a>* <a class="code" href="classbdm_1_1EKFCh.html#6b34c69641826322467b704e8252f317" title="Observation Model h(x,u).">phxu</a>, <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> Q0, <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> R0 ); |
184 | | <a name="l00236"></a>00236 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1EKFCh.html#4c8609c37290b158f88a31dae4047225" title="Here dt = [yt;ut] of appropriate dimensions.">bayes</a> ( <span class="keyword">const</span> vec &dt ); |
185 | | <a name="l00237"></a>00237 }; |
186 | | <a name="l00238"></a>00238 |
187 | | <a name="l00243"></a><a class="code" href="classbdm_1_1KFcondQR.html">00243</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1KFcondQR.html" title="Kalman Filter with conditional diagonal matrices R and Q.">KFcondQR</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman</a><ldmat>, <span class="keyword">public</span> <a class="code" href="classbdm_1_1BMcond.html" title="Conditional Bayesian Filter.">BMcond</a> { |
188 | | <a name="l00244"></a>00244 <span class="comment">//protected:</span> |
189 | | <a name="l00245"></a>00245 <span class="keyword">public</span>: |
190 | | <a name="l00247"></a><a class="code" href="classbdm_1_1KFcondQR.html#b586ac962751a6af76b2e0fd7e066194">00247</a> <a class="code" href="classbdm_1_1KFcondQR.html#b586ac962751a6af76b2e0fd7e066194" title="Default constructor.">KFcondQR</a> ( ) : <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman</a><<a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a>> ( ),<a class="code" href="classbdm_1_1BMcond.html" title="Conditional Bayesian Filter.">BMcond</a> ( ) {}; |
191 | | <a name="l00248"></a>00248 |
192 | | <a name="l00249"></a>00249 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1KFcondQR.html#0288d47032757774a525f196ac3da21d" title="Substitute val for rvc.">condition</a> ( <span class="keyword">const</span> vec &RQ ); |
193 | | <a name="l00250"></a>00250 }; |
194 | | <a name="l00251"></a>00251 |
195 | | <a name="l00256"></a><a class="code" href="classbdm_1_1KFcondR.html">00256</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1KFcondR.html" title="Kalman Filter with conditional diagonal matrices R and Q.">KFcondR</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman</a><ldmat>, <span class="keyword">public</span> <a class="code" href="classbdm_1_1BMcond.html" title="Conditional Bayesian Filter.">BMcond</a> { |
196 | | <a name="l00257"></a>00257 <span class="comment">//protected:</span> |
197 | | <a name="l00258"></a>00258 <span class="keyword">public</span>: |
198 | | <a name="l00260"></a><a class="code" href="classbdm_1_1KFcondR.html#f11639d79f10b1e7dad16a0d8233450d">00260</a> <a class="code" href="classbdm_1_1KFcondR.html#f11639d79f10b1e7dad16a0d8233450d" title="Default constructor.">KFcondR</a> ( ) : <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman</a><<a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a>> ( ),<a class="code" href="classbdm_1_1BMcond.html" title="Conditional Bayesian Filter.">BMcond</a> ( ) {}; |
199 | | <a name="l00261"></a>00261 |
200 | | <a name="l00262"></a>00262 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1KFcondR.html#6086f02541f8f3bc8351990abf5cd538" title="Substitute val for rvc.">condition</a> ( <span class="keyword">const</span> vec &<a class="code" href="classbdm_1_1Kalman.html#475b088287cdfbba4dc60a3d027728b7" title="Matrix R in square-root form.">R</a> ); |
201 | | <a name="l00263"></a>00263 }; |
| 182 | <a name="l00232"></a>00232 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1EKFCh.html#50f9fbffad721f35e5ccb75d0f6b842a" title="Set nonlinear functions for mean values and covariance matrices.">set_parameters</a> ( <a class="code" href="classbdm_1_1diffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a>* <a class="code" href="classbdm_1_1EKFCh.html#e1e895f994398a55bc425551fc275ba3" title="Internal Model f(x,u).">pfxu</a>, <a class="code" href="classbdm_1_1diffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a>* <a class="code" href="classbdm_1_1EKFCh.html#6b34c69641826322467b704e8252f317" title="Observation Model h(x,u).">phxu</a>, <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> Q0, <span class="keyword">const</span> <a class="code" href="classchmat.html" title="Symmetric matrix stored in square root decomposition using upper cholesky.">chmat</a> R0 ); |
| 183 | <a name="l00234"></a>00234 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1EKFCh.html#4c8609c37290b158f88a31dae4047225" title="Here dt = [yt;ut] of appropriate dimensions.">bayes</a> ( <span class="keyword">const</span> vec &dt ); |
| 184 | <a name="l00235"></a>00235 }; |
| 185 | <a name="l00236"></a>00236 |
| 186 | <a name="l00241"></a><a class="code" href="classbdm_1_1KFcondQR.html">00241</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1KFcondQR.html" title="Kalman Filter with conditional diagonal matrices R and Q.">KFcondQR</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman</a><ldmat>, <span class="keyword">public</span> <a class="code" href="classbdm_1_1BMcond.html" title="Conditional Bayesian Filter.">BMcond</a> { |
| 187 | <a name="l00242"></a>00242 <span class="comment">//protected:</span> |
| 188 | <a name="l00243"></a>00243 <span class="keyword">public</span>: |
| 189 | <a name="l00245"></a><a class="code" href="classbdm_1_1KFcondQR.html#b586ac962751a6af76b2e0fd7e066194">00245</a> <a class="code" href="classbdm_1_1KFcondQR.html#b586ac962751a6af76b2e0fd7e066194" title="Default constructor.">KFcondQR</a> ( ) : <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman</a><<a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a>> ( ),<a class="code" href="classbdm_1_1BMcond.html" title="Conditional Bayesian Filter.">BMcond</a> ( ) {}; |
| 190 | <a name="l00246"></a>00246 |
| 191 | <a name="l00247"></a>00247 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1KFcondQR.html#0288d47032757774a525f196ac3da21d" title="Substitute val for rvc.">condition</a> ( <span class="keyword">const</span> vec &RQ ); |
| 192 | <a name="l00248"></a>00248 }; |
| 193 | <a name="l00249"></a>00249 |
| 194 | <a name="l00254"></a><a class="code" href="classbdm_1_1KFcondR.html">00254</a> <span class="keyword">class </span><a class="code" href="classbdm_1_1KFcondR.html" title="Kalman Filter with conditional diagonal matrices R and Q.">KFcondR</a> : <span class="keyword">public</span> <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman</a><ldmat>, <span class="keyword">public</span> <a class="code" href="classbdm_1_1BMcond.html" title="Conditional Bayesian Filter.">BMcond</a> { |
| 195 | <a name="l00255"></a>00255 <span class="comment">//protected:</span> |
| 196 | <a name="l00256"></a>00256 <span class="keyword">public</span>: |
| 197 | <a name="l00258"></a><a class="code" href="classbdm_1_1KFcondR.html#f11639d79f10b1e7dad16a0d8233450d">00258</a> <a class="code" href="classbdm_1_1KFcondR.html#f11639d79f10b1e7dad16a0d8233450d" title="Default constructor.">KFcondR</a> ( ) : <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman</a><<a class="code" href="classldmat.html" title="Matrix stored in LD form, (commonly known as UD).">ldmat</a>> ( ),<a class="code" href="classbdm_1_1BMcond.html" title="Conditional Bayesian Filter.">BMcond</a> ( ) {}; |
| 198 | <a name="l00259"></a>00259 |
| 199 | <a name="l00260"></a>00260 <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1KFcondR.html#6086f02541f8f3bc8351990abf5cd538" title="Substitute val for rvc.">condition</a> ( <span class="keyword">const</span> vec &<a class="code" href="classbdm_1_1Kalman.html#475b088287cdfbba4dc60a3d027728b7" title="Matrix R in square-root form.">R</a> ); |
| 200 | <a name="l00261"></a>00261 }; |
| 201 | <a name="l00262"></a>00262 |
203 | | <a name="l00266"></a>00266 |
204 | | <a name="l00267"></a>00267 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
205 | | <a name="l00268"></a><a class="code" href="classbdm_1_1Kalman.html#8b22c45cffa949d70b8e5ac92ed5ce25">00268</a> <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman<sq_T>::Kalman</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman<sq_T></a> &K0 ) : <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> ( ),rvy ( K0.rvy ),rvu ( K0.rvu ), |
206 | | <a name="l00269"></a>00269 dimx ( K0.dimx ), dimy ( K0.dimy ),dimu ( K0.dimu ), |
207 | | <a name="l00270"></a>00270 A ( K0.A ), B ( K0.B ), C ( K0.C ), D ( K0.D ), |
208 | | <a name="l00271"></a>00271 Q(K0.Q), R(K0.R), |
209 | | <a name="l00272"></a>00272 est ( K0.est ), fy ( K0.fy ), _yp(fy._mu()),_Ry(fy._R()), _mu(est._mu()), _P(est._R()) { |
210 | | <a name="l00273"></a>00273 |
211 | | <a name="l00274"></a>00274 <span class="comment">// copy values in pointers</span> |
212 | | <a name="l00275"></a>00275 <span class="comment">// _mu = K0._mu;</span> |
213 | | <a name="l00276"></a>00276 <span class="comment">// _P = K0._P;</span> |
214 | | <a name="l00277"></a>00277 <span class="comment">// _yp = K0._yp;</span> |
215 | | <a name="l00278"></a>00278 <span class="comment">// _Ry = K0._Ry;</span> |
| 203 | <a name="l00265"></a>00265 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 204 | <a name="l00266"></a><a class="code" href="classbdm_1_1Kalman.html#8b22c45cffa949d70b8e5ac92ed5ce25">00266</a> <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman<sq_T>::Kalman</a> ( <span class="keyword">const</span> <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman<sq_T></a> &K0 ) : <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> ( ),rvy ( K0.rvy ),rvu ( K0.rvu ), |
| 205 | <a name="l00267"></a>00267 dimx ( K0.dimx ), dimy ( K0.dimy ),dimu ( K0.dimu ), |
| 206 | <a name="l00268"></a>00268 A ( K0.A ), B ( K0.B ), C ( K0.C ), D ( K0.D ), |
| 207 | <a name="l00269"></a>00269 Q(K0.Q), R(K0.R), |
| 208 | <a name="l00270"></a>00270 est ( K0.est ), fy ( K0.fy ), _yp(fy._mu()),_Ry(fy._R()), _mu(est._mu()), _P(est._R()) { |
| 209 | <a name="l00271"></a>00271 |
| 210 | <a name="l00272"></a>00272 <span class="comment">// copy values in pointers</span> |
| 211 | <a name="l00273"></a>00273 <span class="comment">// _mu = K0._mu;</span> |
| 212 | <a name="l00274"></a>00274 <span class="comment">// _P = K0._P;</span> |
| 213 | <a name="l00275"></a>00275 <span class="comment">// _yp = K0._yp;</span> |
| 214 | <a name="l00276"></a>00276 <span class="comment">// _Ry = K0._Ry;</span> |
| 215 | <a name="l00277"></a>00277 |
| 216 | <a name="l00278"></a>00278 } |
217 | | <a name="l00280"></a>00280 } |
218 | | <a name="l00281"></a>00281 |
219 | | <a name="l00282"></a>00282 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
220 | | <a name="l00283"></a><a class="code" href="classbdm_1_1Kalman.html#025a0196cbcc2e6adb13311f9d3d52b4">00283</a> <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman<sq_T>::Kalman</a> ( ) : <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> (), est ( ), fy (), _yp(fy._mu()), _Ry(fy._R()), _mu(est._mu()), _P(est._R()) { |
221 | | <a name="l00284"></a>00284 }; |
222 | | <a name="l00285"></a>00285 |
223 | | <a name="l00286"></a>00286 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
224 | | <a name="l00287"></a><a class="code" href="classbdm_1_1Kalman.html#3c7fb87fb6b87d08deb6a5a7862da957">00287</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman<sq_T>::set_parameters</a> ( <span class="keyword">const</span> mat &A0,<span class="keyword">const</span> mat &B0, <span class="keyword">const</span> mat &C0, <span class="keyword">const</span> mat &D0, <span class="keyword">const</span> sq_T &Q0, <span class="keyword">const</span> sq_T &R0 ) { |
225 | | <a name="l00288"></a>00288 <a class="code" href="classbdm_1_1Kalman.html#ba7699cdb3b1382a54d3e28b9b7517fa" title="cache of rv.count()">dimx</a> = A0.rows(); |
226 | | <a name="l00289"></a>00289 <a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a> = C0.rows(); |
227 | | <a name="l00290"></a>00290 <a class="code" href="classbdm_1_1Kalman.html#c5136ef617f6ac0e426bea222755d92b" title="cache of rvu.count()">dimu</a> = B0.cols(); |
228 | | <a name="l00291"></a>00291 |
229 | | <a name="l00292"></a>00292 it_assert_debug ( A0.cols() ==<a class="code" href="classbdm_1_1Kalman.html#ba7699cdb3b1382a54d3e28b9b7517fa" title="cache of rv.count()">dimx</a>, <span class="stringliteral">"Kalman: A is not square"</span> ); |
230 | | <a name="l00293"></a>00293 it_assert_debug ( B0.rows() ==<a class="code" href="classbdm_1_1Kalman.html#ba7699cdb3b1382a54d3e28b9b7517fa" title="cache of rv.count()">dimx</a>, <span class="stringliteral">"Kalman: B is not compatible"</span> ); |
231 | | <a name="l00294"></a>00294 it_assert_debug ( C0.cols() ==<a class="code" href="classbdm_1_1Kalman.html#ba7699cdb3b1382a54d3e28b9b7517fa" title="cache of rv.count()">dimx</a>, <span class="stringliteral">"Kalman: C is not square"</span> ); |
232 | | <a name="l00295"></a>00295 it_assert_debug ( ( D0.rows() ==<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a> ) || ( D0.cols() ==<a class="code" href="classbdm_1_1Kalman.html#c5136ef617f6ac0e426bea222755d92b" title="cache of rvu.count()">dimu</a> ), <span class="stringliteral">"Kalman: D is not compatible"</span> ); |
233 | | <a name="l00296"></a>00296 it_assert_debug ( ( R0.cols() ==<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a> ) || ( R0.rows() ==<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a> ), <span class="stringliteral">"Kalman: R is not compatible"</span> ); |
234 | | <a name="l00297"></a>00297 it_assert_debug ( ( Q0.cols() ==<a class="code" href="classbdm_1_1Kalman.html#ba7699cdb3b1382a54d3e28b9b7517fa" title="cache of rv.count()">dimx</a> ) || ( Q0.rows() ==<a class="code" href="classbdm_1_1Kalman.html#ba7699cdb3b1382a54d3e28b9b7517fa" title="cache of rv.count()">dimx</a> ), <span class="stringliteral">"Kalman: Q is not compatible"</span> ); |
235 | | <a name="l00298"></a>00298 |
236 | | <a name="l00299"></a>00299 <a class="code" href="classbdm_1_1Kalman.html#0a2072e2090c10fac74ad30a023a4ace" title="Matrix A.">A</a> = A0; |
237 | | <a name="l00300"></a>00300 <a class="code" href="classbdm_1_1Kalman.html#5977b2c81857948a35105f0e7840203c" title="Matrix B.">B</a> = B0; |
238 | | <a name="l00301"></a>00301 <a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a> = C0; |
239 | | <a name="l00302"></a>00302 <a class="code" href="classbdm_1_1Kalman.html#7b56ac423d0654b5755e4f852a870456" title="Matrix D.">D</a> = D0; |
240 | | <a name="l00303"></a>00303 <a class="code" href="classbdm_1_1Kalman.html#475b088287cdfbba4dc60a3d027728b7" title="Matrix R in square-root form.">R</a> = R0; |
241 | | <a name="l00304"></a>00304 <a class="code" href="classbdm_1_1Kalman.html#70f8bf19e81b532c60fd3a7a152425ee" title="Matrix Q in square-root form.">Q</a> = Q0; |
242 | | <a name="l00305"></a>00305 } |
243 | | <a name="l00306"></a>00306 |
244 | | <a name="l00307"></a>00307 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
245 | | <a name="l00308"></a><a class="code" href="classbdm_1_1Kalman.html#4a39330c14eff8d13179e868a1d1aa8c">00308</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman<sq_T>::bayes</a> ( <span class="keyword">const</span> vec &dt ) { |
246 | | <a name="l00309"></a>00309 it_assert_debug ( dt.length() == ( <a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>+<a class="code" href="classbdm_1_1Kalman.html#c5136ef617f6ac0e426bea222755d92b" title="cache of rvu.count()">dimu</a> ),<span class="stringliteral">"KalmanFull::bayes wrong size of dt"</span> ); |
247 | | <a name="l00310"></a>00310 |
248 | | <a name="l00311"></a>00311 sq_T iRy(<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>); |
249 | | <a name="l00312"></a>00312 vec u = dt.get ( <a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>,<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>+<a class="code" href="classbdm_1_1Kalman.html#c5136ef617f6ac0e426bea222755d92b" title="cache of rvu.count()">dimu</a>-1 ); |
250 | | <a name="l00313"></a>00313 vec y = dt.get ( 0,<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>-1 ); |
251 | | <a name="l00314"></a>00314 <span class="comment">//Time update</span> |
252 | | <a name="l00315"></a>00315 <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a> = <a class="code" href="classbdm_1_1Kalman.html#0a2072e2090c10fac74ad30a023a4ace" title="Matrix A.">A</a>* <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a> + <a class="code" href="classbdm_1_1Kalman.html#5977b2c81857948a35105f0e7840203c" title="Matrix B.">B</a>*u; |
253 | | <a name="l00316"></a>00316 <span class="comment">//P = A*P*A.transpose() + Q; in sq_T</span> |
254 | | <a name="l00317"></a>00317 <a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a>.mult_sym ( <a class="code" href="classbdm_1_1Kalman.html#0a2072e2090c10fac74ad30a023a4ace" title="Matrix A.">A</a> ); |
255 | | <a name="l00318"></a>00318 <a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a> +=<a class="code" href="classbdm_1_1Kalman.html#70f8bf19e81b532c60fd3a7a152425ee" title="Matrix Q in square-root form.">Q</a>; |
256 | | <a name="l00319"></a>00319 |
257 | | <a name="l00320"></a>00320 <span class="comment">//Data update</span> |
258 | | <a name="l00321"></a>00321 <span class="comment">//_Ry = C*P*C.transpose() + R; in sq_T</span> |
259 | | <a name="l00322"></a>00322 <a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a>.mult_sym ( <a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a>, <a class="code" href="classbdm_1_1Kalman.html#2dd268f2d7fbe6382cb8825a1114192a" title="cache of fy.R">_Ry</a> ); |
260 | | <a name="l00323"></a>00323 <a class="code" href="classbdm_1_1Kalman.html#2dd268f2d7fbe6382cb8825a1114192a" title="cache of fy.R">_Ry</a> +=<a class="code" href="classbdm_1_1Kalman.html#475b088287cdfbba4dc60a3d027728b7" title="Matrix R in square-root form.">R</a>; |
| 218 | <a name="l00280"></a>00280 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 219 | <a name="l00281"></a><a class="code" href="classbdm_1_1Kalman.html#025a0196cbcc2e6adb13311f9d3d52b4">00281</a> <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman<sq_T>::Kalman</a> ( ) : <a class="code" href="classbdm_1_1BM.html" title="Bayesian Model of a system, i.e. all uncertainty is modeled by probabilities.">BM</a> (), est ( ), fy (), _yp(fy._mu()), _Ry(fy._R()), _mu(est._mu()), _P(est._R()) { |
| 220 | <a name="l00282"></a>00282 }; |
| 221 | <a name="l00283"></a>00283 |
| 222 | <a name="l00284"></a>00284 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 223 | <a name="l00285"></a><a class="code" href="classbdm_1_1Kalman.html#3c7fb87fb6b87d08deb6a5a7862da957">00285</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman<sq_T>::set_parameters</a> ( <span class="keyword">const</span> mat &A0,<span class="keyword">const</span> mat &B0, <span class="keyword">const</span> mat &C0, <span class="keyword">const</span> mat &D0, <span class="keyword">const</span> sq_T &Q0, <span class="keyword">const</span> sq_T &R0 ) { |
| 224 | <a name="l00286"></a>00286 <a class="code" href="classbdm_1_1Kalman.html#ba7699cdb3b1382a54d3e28b9b7517fa" title="cache of rv.count()">dimx</a> = A0.rows(); |
| 225 | <a name="l00287"></a>00287 <a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a> = C0.rows(); |
| 226 | <a name="l00288"></a>00288 <a class="code" href="classbdm_1_1Kalman.html#c5136ef617f6ac0e426bea222755d92b" title="cache of rvu.count()">dimu</a> = B0.cols(); |
| 227 | <a name="l00289"></a>00289 |
| 228 | <a name="l00290"></a>00290 it_assert_debug ( A0.cols() ==<a class="code" href="classbdm_1_1Kalman.html#ba7699cdb3b1382a54d3e28b9b7517fa" title="cache of rv.count()">dimx</a>, <span class="stringliteral">"Kalman: A is not square"</span> ); |
| 229 | <a name="l00291"></a>00291 it_assert_debug ( B0.rows() ==<a class="code" href="classbdm_1_1Kalman.html#ba7699cdb3b1382a54d3e28b9b7517fa" title="cache of rv.count()">dimx</a>, <span class="stringliteral">"Kalman: B is not compatible"</span> ); |
| 230 | <a name="l00292"></a>00292 it_assert_debug ( C0.cols() ==<a class="code" href="classbdm_1_1Kalman.html#ba7699cdb3b1382a54d3e28b9b7517fa" title="cache of rv.count()">dimx</a>, <span class="stringliteral">"Kalman: C is not square"</span> ); |
| 231 | <a name="l00293"></a>00293 it_assert_debug ( ( D0.rows() ==<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a> ) || ( D0.cols() ==<a class="code" href="classbdm_1_1Kalman.html#c5136ef617f6ac0e426bea222755d92b" title="cache of rvu.count()">dimu</a> ), <span class="stringliteral">"Kalman: D is not compatible"</span> ); |
| 232 | <a name="l00294"></a>00294 it_assert_debug ( ( R0.cols() ==<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a> ) || ( R0.rows() ==<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a> ), <span class="stringliteral">"Kalman: R is not compatible"</span> ); |
| 233 | <a name="l00295"></a>00295 it_assert_debug ( ( Q0.cols() ==<a class="code" href="classbdm_1_1Kalman.html#ba7699cdb3b1382a54d3e28b9b7517fa" title="cache of rv.count()">dimx</a> ) || ( Q0.rows() ==<a class="code" href="classbdm_1_1Kalman.html#ba7699cdb3b1382a54d3e28b9b7517fa" title="cache of rv.count()">dimx</a> ), <span class="stringliteral">"Kalman: Q is not compatible"</span> ); |
| 234 | <a name="l00296"></a>00296 |
| 235 | <a name="l00297"></a>00297 <a class="code" href="classbdm_1_1Kalman.html#0a2072e2090c10fac74ad30a023a4ace" title="Matrix A.">A</a> = A0; |
| 236 | <a name="l00298"></a>00298 <a class="code" href="classbdm_1_1Kalman.html#5977b2c81857948a35105f0e7840203c" title="Matrix B.">B</a> = B0; |
| 237 | <a name="l00299"></a>00299 <a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a> = C0; |
| 238 | <a name="l00300"></a>00300 <a class="code" href="classbdm_1_1Kalman.html#7b56ac423d0654b5755e4f852a870456" title="Matrix D.">D</a> = D0; |
| 239 | <a name="l00301"></a>00301 <a class="code" href="classbdm_1_1Kalman.html#475b088287cdfbba4dc60a3d027728b7" title="Matrix R in square-root form.">R</a> = R0; |
| 240 | <a name="l00302"></a>00302 <a class="code" href="classbdm_1_1Kalman.html#70f8bf19e81b532c60fd3a7a152425ee" title="Matrix Q in square-root form.">Q</a> = Q0; |
| 241 | <a name="l00303"></a>00303 } |
| 242 | <a name="l00304"></a>00304 |
| 243 | <a name="l00305"></a>00305 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 244 | <a name="l00306"></a><a class="code" href="classbdm_1_1Kalman.html#4a39330c14eff8d13179e868a1d1aa8c">00306</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman<sq_T>::bayes</a> ( <span class="keyword">const</span> vec &dt ) { |
| 245 | <a name="l00307"></a>00307 it_assert_debug ( dt.length() == ( <a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>+<a class="code" href="classbdm_1_1Kalman.html#c5136ef617f6ac0e426bea222755d92b" title="cache of rvu.count()">dimu</a> ),<span class="stringliteral">"KalmanFull::bayes wrong size of dt"</span> ); |
| 246 | <a name="l00308"></a>00308 |
| 247 | <a name="l00309"></a>00309 sq_T iRy(<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>); |
| 248 | <a name="l00310"></a>00310 vec u = dt.get ( <a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>,<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>+<a class="code" href="classbdm_1_1Kalman.html#c5136ef617f6ac0e426bea222755d92b" title="cache of rvu.count()">dimu</a>-1 ); |
| 249 | <a name="l00311"></a>00311 vec y = dt.get ( 0,<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>-1 ); |
| 250 | <a name="l00312"></a>00312 <span class="comment">//Time update</span> |
| 251 | <a name="l00313"></a>00313 <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a> = <a class="code" href="classbdm_1_1Kalman.html#0a2072e2090c10fac74ad30a023a4ace" title="Matrix A.">A</a>* <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a> + <a class="code" href="classbdm_1_1Kalman.html#5977b2c81857948a35105f0e7840203c" title="Matrix B.">B</a>*u; |
| 252 | <a name="l00314"></a>00314 <span class="comment">//P = A*P*A.transpose() + Q; in sq_T</span> |
| 253 | <a name="l00315"></a>00315 <a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a>.mult_sym ( <a class="code" href="classbdm_1_1Kalman.html#0a2072e2090c10fac74ad30a023a4ace" title="Matrix A.">A</a> ); |
| 254 | <a name="l00316"></a>00316 <a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a> +=<a class="code" href="classbdm_1_1Kalman.html#70f8bf19e81b532c60fd3a7a152425ee" title="Matrix Q in square-root form.">Q</a>; |
| 255 | <a name="l00317"></a>00317 |
| 256 | <a name="l00318"></a>00318 <span class="comment">//Data update</span> |
| 257 | <a name="l00319"></a>00319 <span class="comment">//_Ry = C*P*C.transpose() + R; in sq_T</span> |
| 258 | <a name="l00320"></a>00320 <a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a>.mult_sym ( <a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a>, <a class="code" href="classbdm_1_1Kalman.html#2dd268f2d7fbe6382cb8825a1114192a" title="cache of fy.R">_Ry</a> ); |
| 259 | <a name="l00321"></a>00321 <a class="code" href="classbdm_1_1Kalman.html#2dd268f2d7fbe6382cb8825a1114192a" title="cache of fy.R">_Ry</a> +=<a class="code" href="classbdm_1_1Kalman.html#475b088287cdfbba4dc60a3d027728b7" title="Matrix R in square-root form.">R</a>; |
| 260 | <a name="l00322"></a>00322 |
| 261 | <a name="l00323"></a>00323 mat Pfull = <a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a>.to_mat(); |
262 | | <a name="l00325"></a>00325 mat Pfull = <a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a>.to_mat(); |
263 | | <a name="l00326"></a>00326 |
264 | | <a name="l00327"></a>00327 <a class="code" href="classbdm_1_1Kalman.html#2dd268f2d7fbe6382cb8825a1114192a" title="cache of fy.R">_Ry</a>.inv ( iRy ); <span class="comment">// result is in _iRy;</span> |
265 | | <a name="l00328"></a>00328 <a class="code" href="classbdm_1_1Kalman.html#bd69dfb802465f22dd84d73a180d5c92" title="placeholder for Kalman gain">_K</a> = Pfull*<a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a>.transpose() * ( iRy.to_mat() ); |
266 | | <a name="l00329"></a>00329 |
267 | | <a name="l00330"></a>00330 sq_T pom ( ( <span class="keywordtype">int</span> ) Pfull.rows() ); |
268 | | <a name="l00331"></a>00331 iRy.mult_sym_t ( <a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a>*Pfull,pom ); |
269 | | <a name="l00332"></a>00332 (<a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a> ) -= pom; <span class="comment">// P = P -PC'iRy*CP;</span> |
270 | | <a name="l00333"></a>00333 (<a class="code" href="classbdm_1_1Kalman.html#c249d45258c8578b13858ad3e7b729b1" title="cache of fy.mu">_yp</a> ) = <a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a>* <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a> +<a class="code" href="classbdm_1_1Kalman.html#7b56ac423d0654b5755e4f852a870456" title="Matrix D.">D</a>*u; <span class="comment">//y prediction</span> |
271 | | <a name="l00334"></a>00334 (<a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a> ) += <a class="code" href="classbdm_1_1Kalman.html#bd69dfb802465f22dd84d73a180d5c92" title="placeholder for Kalman gain">_K</a>* ( y- <a class="code" href="classbdm_1_1Kalman.html#c249d45258c8578b13858ad3e7b729b1" title="cache of fy.mu">_yp</a> ); |
272 | | <a name="l00335"></a>00335 |
273 | | <a name="l00336"></a>00336 |
274 | | <a name="l00337"></a>00337 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>==<span class="keyword">true</span> ) { <span class="comment">//likelihood of observation y</span> |
275 | | <a name="l00338"></a>00338 <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>=<a class="code" href="classbdm_1_1Kalman.html#ba555c394c429f6831c9bbabfa2c944c" title="preditive density on $y_t$">fy</a>.evallog ( y ); |
276 | | <a name="l00339"></a>00339 } |
| 263 | <a name="l00325"></a>00325 <a class="code" href="classbdm_1_1Kalman.html#2dd268f2d7fbe6382cb8825a1114192a" title="cache of fy.R">_Ry</a>.inv ( iRy ); <span class="comment">// result is in _iRy;</span> |
| 264 | <a name="l00326"></a>00326 <a class="code" href="classbdm_1_1Kalman.html#bd69dfb802465f22dd84d73a180d5c92" title="placeholder for Kalman gain">_K</a> = Pfull*<a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a>.transpose() * ( iRy.to_mat() ); |
| 265 | <a name="l00327"></a>00327 |
| 266 | <a name="l00328"></a>00328 sq_T pom ( ( <span class="keywordtype">int</span> ) Pfull.rows() ); |
| 267 | <a name="l00329"></a>00329 iRy.mult_sym_t ( <a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a>*Pfull,pom ); |
| 268 | <a name="l00330"></a>00330 (<a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a> ) -= pom; <span class="comment">// P = P -PC'iRy*CP;</span> |
| 269 | <a name="l00331"></a>00331 (<a class="code" href="classbdm_1_1Kalman.html#c249d45258c8578b13858ad3e7b729b1" title="cache of fy.mu">_yp</a> ) = <a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a>* <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a> +<a class="code" href="classbdm_1_1Kalman.html#7b56ac423d0654b5755e4f852a870456" title="Matrix D.">D</a>*u; <span class="comment">//y prediction</span> |
| 270 | <a name="l00332"></a>00332 (<a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a> ) += <a class="code" href="classbdm_1_1Kalman.html#bd69dfb802465f22dd84d73a180d5c92" title="placeholder for Kalman gain">_K</a>* ( y- <a class="code" href="classbdm_1_1Kalman.html#c249d45258c8578b13858ad3e7b729b1" title="cache of fy.mu">_yp</a> ); |
| 271 | <a name="l00333"></a>00333 |
| 272 | <a name="l00334"></a>00334 |
| 273 | <a name="l00335"></a>00335 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>==<span class="keyword">true</span> ) { <span class="comment">//likelihood of observation y</span> |
| 274 | <a name="l00336"></a>00336 <a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>=<a class="code" href="classbdm_1_1Kalman.html#ba555c394c429f6831c9bbabfa2c944c" title="preditive density on $y_t$">fy</a>.evallog ( y ); |
| 275 | <a name="l00337"></a>00337 } |
| 276 | <a name="l00338"></a>00338 |
| 277 | <a name="l00339"></a>00339 <span class="comment">//cout << "y: " << y-(*_yp) <<" R: " << _Ry->to_mat() << " iR: " << _iRy->to_mat() << " ll: " << ll <<endl;</span> |
284 | | <a name="l00347"></a>00347 <span class="comment">//TODO why not const pointer??</span> |
285 | | <a name="l00348"></a>00348 |
286 | | <a name="l00349"></a>00349 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
287 | | <a name="l00350"></a><a class="code" href="classbdm_1_1EKF.html#d087a8bb408d26ac4f5c542746b81059">00350</a> <a class="code" href="classbdm_1_1EKF.html" title="Extended Kalman Filter.">EKF<sq_T>::EKF</a> ( <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> rvx0, <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> rvy0, <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> rvu0 ) : <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman</a><sq_T> ( rvx0,rvy0,rvu0 ) {} |
288 | | <a name="l00351"></a>00351 |
289 | | <a name="l00352"></a>00352 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
290 | | <a name="l00353"></a><a class="code" href="classbdm_1_1EKF.html#00fec1a0a6a467eb83fb36c65eba7bcb">00353</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1EKF.html" title="Extended Kalman Filter.">EKF<sq_T>::set_parameters</a> ( <a class="code" href="classbdm_1_1diffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a>* pfxu0, <a class="code" href="classbdm_1_1diffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a>* phxu0,<span class="keyword">const</span> sq_T Q0,<span class="keyword">const</span> sq_T R0 ) { |
291 | | <a name="l00354"></a>00354 pfxu = pfxu0; |
292 | | <a name="l00355"></a>00355 phxu = phxu0; |
293 | | <a name="l00356"></a>00356 |
294 | | <a name="l00357"></a>00357 <span class="comment">//initialize matrices A C, later, these will be only updated!</span> |
295 | | <a name="l00358"></a>00358 pfxu-><a class="code" href="classbdm_1_1diffbifn.html#651184f808a35f236dbfea21aca1b6ac" title="Evaluates and writes result into A .">dfdx_cond</a> ( <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a>,zeros ( <a class="code" href="classbdm_1_1Kalman.html#c5136ef617f6ac0e426bea222755d92b" title="cache of rvu.count()">dimu</a> ),<a class="code" href="classbdm_1_1Kalman.html#0a2072e2090c10fac74ad30a023a4ace" title="Matrix A.">A</a>,<span class="keyword">true</span> ); |
296 | | <a name="l00359"></a>00359 <span class="comment">// pfxu->dfdu_cond ( *_mu,zeros ( dimu ),B,true );</span> |
297 | | <a name="l00360"></a>00360 <a class="code" href="classbdm_1_1Kalman.html#5977b2c81857948a35105f0e7840203c" title="Matrix B.">B</a>.clear(); |
298 | | <a name="l00361"></a>00361 phxu-><a class="code" href="classbdm_1_1diffbifn.html#651184f808a35f236dbfea21aca1b6ac" title="Evaluates and writes result into A .">dfdx_cond</a> ( <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a>,zeros ( <a class="code" href="classbdm_1_1Kalman.html#c5136ef617f6ac0e426bea222755d92b" title="cache of rvu.count()">dimu</a> ),<a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a>,<span class="keyword">true</span> ); |
299 | | <a name="l00362"></a>00362 <span class="comment">// phxu->dfdu_cond ( *_mu,zeros ( dimu ),D,true );</span> |
300 | | <a name="l00363"></a>00363 <a class="code" href="classbdm_1_1Kalman.html#7b56ac423d0654b5755e4f852a870456" title="Matrix D.">D</a>.clear(); |
301 | | <a name="l00364"></a>00364 |
302 | | <a name="l00365"></a>00365 <a class="code" href="classbdm_1_1Kalman.html#475b088287cdfbba4dc60a3d027728b7" title="Matrix R in square-root form.">R</a> = R0; |
303 | | <a name="l00366"></a>00366 <a class="code" href="classbdm_1_1Kalman.html#70f8bf19e81b532c60fd3a7a152425ee" title="Matrix Q in square-root form.">Q</a> = Q0; |
304 | | <a name="l00367"></a>00367 } |
305 | | <a name="l00368"></a>00368 |
306 | | <a name="l00369"></a>00369 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
307 | | <a name="l00370"></a><a class="code" href="classbdm_1_1EKF.html#3fb182ecc29b10ca1163cecbf3bcccfa">00370</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1EKF.html" title="Extended Kalman Filter.">EKF<sq_T>::bayes</a> ( <span class="keyword">const</span> vec &dt ) { |
308 | | <a name="l00371"></a>00371 it_assert_debug ( dt.length() == ( <a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>+<a class="code" href="classbdm_1_1Kalman.html#c5136ef617f6ac0e426bea222755d92b" title="cache of rvu.count()">dimu</a> ),<span class="stringliteral">"KalmanFull::bayes wrong size of dt"</span> ); |
309 | | <a name="l00372"></a>00372 |
310 | | <a name="l00373"></a>00373 sq_T iRy(<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>,<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>); |
311 | | <a name="l00374"></a>00374 vec u = dt.get ( <a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>,<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>+<a class="code" href="classbdm_1_1Kalman.html#c5136ef617f6ac0e426bea222755d92b" title="cache of rvu.count()">dimu</a>-1 ); |
312 | | <a name="l00375"></a>00375 vec y = dt.get ( 0,<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>-1 ); |
313 | | <a name="l00376"></a>00376 <span class="comment">//Time update</span> |
314 | | <a name="l00377"></a>00377 <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a> = pfxu-><a class="code" href="classbdm_1_1diffbifn.html#188f31066bd72e1bf0ddacd1eb0e6af3" title="Evaluates (VS: Do we really need common eval? ).">eval</a> ( <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a>, u ); |
315 | | <a name="l00378"></a>00378 pfxu-><a class="code" href="classbdm_1_1diffbifn.html#651184f808a35f236dbfea21aca1b6ac" title="Evaluates and writes result into A .">dfdx_cond</a> ( <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a>,u,<a class="code" href="classbdm_1_1Kalman.html#0a2072e2090c10fac74ad30a023a4ace" title="Matrix A.">A</a>,<span class="keyword">false</span> ); <span class="comment">//update A by a derivative of fx</span> |
316 | | <a name="l00379"></a>00379 |
317 | | <a name="l00380"></a>00380 <span class="comment">//P = A*P*A.transpose() + Q; in sq_T</span> |
318 | | <a name="l00381"></a>00381 <a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a>.<a class="code" href="classfsqmat.html#5530d2756b5d991de755e6121c9a452e" title="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">mult_sym</a> ( <a class="code" href="classbdm_1_1Kalman.html#0a2072e2090c10fac74ad30a023a4ace" title="Matrix A.">A</a> ); |
319 | | <a name="l00382"></a>00382 <a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a> +=<a class="code" href="classbdm_1_1Kalman.html#70f8bf19e81b532c60fd3a7a152425ee" title="Matrix Q in square-root form.">Q</a>; |
320 | | <a name="l00383"></a>00383 |
321 | | <a name="l00384"></a>00384 <span class="comment">//Data update</span> |
322 | | <a name="l00385"></a>00385 phxu-><a class="code" href="classbdm_1_1diffbifn.html#651184f808a35f236dbfea21aca1b6ac" title="Evaluates and writes result into A .">dfdx_cond</a> ( <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a>,u,<a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a>,<span class="keyword">false</span> ); <span class="comment">//update C by a derivative hx</span> |
323 | | <a name="l00386"></a>00386 <span class="comment">//_Ry = C*P*C.transpose() + R; in sq_T</span> |
324 | | <a name="l00387"></a>00387 <a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a>.<a class="code" href="classfsqmat.html#5530d2756b5d991de755e6121c9a452e" title="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">mult_sym</a> ( <a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a>, <a class="code" href="classbdm_1_1Kalman.html#2dd268f2d7fbe6382cb8825a1114192a" title="cache of fy.R">_Ry</a> ); |
325 | | <a name="l00388"></a>00388 ( <a class="code" href="classbdm_1_1Kalman.html#2dd268f2d7fbe6382cb8825a1114192a" title="cache of fy.R">_Ry</a> ) +=<a class="code" href="classbdm_1_1Kalman.html#475b088287cdfbba4dc60a3d027728b7" title="Matrix R in square-root form.">R</a>; |
| 285 | <a name="l00347"></a>00347 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 286 | <a name="l00348"></a><a class="code" href="classbdm_1_1EKF.html#d087a8bb408d26ac4f5c542746b81059">00348</a> <a class="code" href="classbdm_1_1EKF.html" title="Extended Kalman Filter.">EKF<sq_T>::EKF</a> ( <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> rvx0, <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> rvy0, <a class="code" href="classbdm_1_1RV.html" title="Class representing variables, most often random variables.">RV</a> rvu0 ) : <a class="code" href="classbdm_1_1Kalman.html" title="Kalman filter with covariance matrices in square root form.">Kalman</a><sq_T> ( rvx0,rvy0,rvu0 ) {} |
| 287 | <a name="l00349"></a>00349 |
| 288 | <a name="l00350"></a>00350 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 289 | <a name="l00351"></a><a class="code" href="classbdm_1_1EKF.html#00fec1a0a6a467eb83fb36c65eba7bcb">00351</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1EKF.html" title="Extended Kalman Filter.">EKF<sq_T>::set_parameters</a> ( <a class="code" href="classbdm_1_1diffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a>* pfxu0, <a class="code" href="classbdm_1_1diffbifn.html" title="Class representing a differentiable function of two variables .">diffbifn</a>* phxu0,<span class="keyword">const</span> sq_T Q0,<span class="keyword">const</span> sq_T R0 ) { |
| 290 | <a name="l00352"></a>00352 pfxu = pfxu0; |
| 291 | <a name="l00353"></a>00353 phxu = phxu0; |
| 292 | <a name="l00354"></a>00354 |
| 293 | <a name="l00355"></a>00355 <span class="comment">//initialize matrices A C, later, these will be only updated!</span> |
| 294 | <a name="l00356"></a>00356 pfxu-><a class="code" href="classbdm_1_1diffbifn.html#651184f808a35f236dbfea21aca1b6ac" title="Evaluates and writes result into A .">dfdx_cond</a> ( <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a>,zeros ( <a class="code" href="classbdm_1_1Kalman.html#c5136ef617f6ac0e426bea222755d92b" title="cache of rvu.count()">dimu</a> ),<a class="code" href="classbdm_1_1Kalman.html#0a2072e2090c10fac74ad30a023a4ace" title="Matrix A.">A</a>,<span class="keyword">true</span> ); |
| 295 | <a name="l00357"></a>00357 <span class="comment">// pfxu->dfdu_cond ( *_mu,zeros ( dimu ),B,true );</span> |
| 296 | <a name="l00358"></a>00358 <a class="code" href="classbdm_1_1Kalman.html#5977b2c81857948a35105f0e7840203c" title="Matrix B.">B</a>.clear(); |
| 297 | <a name="l00359"></a>00359 phxu-><a class="code" href="classbdm_1_1diffbifn.html#651184f808a35f236dbfea21aca1b6ac" title="Evaluates and writes result into A .">dfdx_cond</a> ( <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a>,zeros ( <a class="code" href="classbdm_1_1Kalman.html#c5136ef617f6ac0e426bea222755d92b" title="cache of rvu.count()">dimu</a> ),<a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a>,<span class="keyword">true</span> ); |
| 298 | <a name="l00360"></a>00360 <span class="comment">// phxu->dfdu_cond ( *_mu,zeros ( dimu ),D,true );</span> |
| 299 | <a name="l00361"></a>00361 <a class="code" href="classbdm_1_1Kalman.html#7b56ac423d0654b5755e4f852a870456" title="Matrix D.">D</a>.clear(); |
| 300 | <a name="l00362"></a>00362 |
| 301 | <a name="l00363"></a>00363 <a class="code" href="classbdm_1_1Kalman.html#475b088287cdfbba4dc60a3d027728b7" title="Matrix R in square-root form.">R</a> = R0; |
| 302 | <a name="l00364"></a>00364 <a class="code" href="classbdm_1_1Kalman.html#70f8bf19e81b532c60fd3a7a152425ee" title="Matrix Q in square-root form.">Q</a> = Q0; |
| 303 | <a name="l00365"></a>00365 } |
| 304 | <a name="l00366"></a>00366 |
| 305 | <a name="l00367"></a>00367 <span class="keyword">template</span><<span class="keyword">class</span> sq_T> |
| 306 | <a name="l00368"></a><a class="code" href="classbdm_1_1EKF.html#3fb182ecc29b10ca1163cecbf3bcccfa">00368</a> <span class="keywordtype">void</span> <a class="code" href="classbdm_1_1EKF.html" title="Extended Kalman Filter.">EKF<sq_T>::bayes</a> ( <span class="keyword">const</span> vec &dt ) { |
| 307 | <a name="l00369"></a>00369 it_assert_debug ( dt.length() == ( <a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>+<a class="code" href="classbdm_1_1Kalman.html#c5136ef617f6ac0e426bea222755d92b" title="cache of rvu.count()">dimu</a> ),<span class="stringliteral">"KalmanFull::bayes wrong size of dt"</span> ); |
| 308 | <a name="l00370"></a>00370 |
| 309 | <a name="l00371"></a>00371 sq_T iRy(<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>,<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>); |
| 310 | <a name="l00372"></a>00372 vec u = dt.get ( <a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>,<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>+<a class="code" href="classbdm_1_1Kalman.html#c5136ef617f6ac0e426bea222755d92b" title="cache of rvu.count()">dimu</a>-1 ); |
| 311 | <a name="l00373"></a>00373 vec y = dt.get ( 0,<a class="code" href="classbdm_1_1Kalman.html#d2c36ba01760bf207b985bf321b7817f" title="cache of rvy.count()">dimy</a>-1 ); |
| 312 | <a name="l00374"></a>00374 <span class="comment">//Time update</span> |
| 313 | <a name="l00375"></a>00375 <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a> = pfxu-><a class="code" href="classbdm_1_1diffbifn.html#188f31066bd72e1bf0ddacd1eb0e6af3" title="Evaluates (VS: Do we really need common eval? ).">eval</a> ( <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a>, u ); |
| 314 | <a name="l00376"></a>00376 pfxu-><a class="code" href="classbdm_1_1diffbifn.html#651184f808a35f236dbfea21aca1b6ac" title="Evaluates and writes result into A .">dfdx_cond</a> ( <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a>,u,<a class="code" href="classbdm_1_1Kalman.html#0a2072e2090c10fac74ad30a023a4ace" title="Matrix A.">A</a>,<span class="keyword">false</span> ); <span class="comment">//update A by a derivative of fx</span> |
| 315 | <a name="l00377"></a>00377 |
| 316 | <a name="l00378"></a>00378 <span class="comment">//P = A*P*A.transpose() + Q; in sq_T</span> |
| 317 | <a name="l00379"></a>00379 <a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a>.<a class="code" href="classfsqmat.html#5530d2756b5d991de755e6121c9a452e" title="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">mult_sym</a> ( <a class="code" href="classbdm_1_1Kalman.html#0a2072e2090c10fac74ad30a023a4ace" title="Matrix A.">A</a> ); |
| 318 | <a name="l00380"></a>00380 <a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a> +=<a class="code" href="classbdm_1_1Kalman.html#70f8bf19e81b532c60fd3a7a152425ee" title="Matrix Q in square-root form.">Q</a>; |
| 319 | <a name="l00381"></a>00381 |
| 320 | <a name="l00382"></a>00382 <span class="comment">//Data update</span> |
| 321 | <a name="l00383"></a>00383 phxu-><a class="code" href="classbdm_1_1diffbifn.html#651184f808a35f236dbfea21aca1b6ac" title="Evaluates and writes result into A .">dfdx_cond</a> ( <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a>,u,<a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a>,<span class="keyword">false</span> ); <span class="comment">//update C by a derivative hx</span> |
| 322 | <a name="l00384"></a>00384 <span class="comment">//_Ry = C*P*C.transpose() + R; in sq_T</span> |
| 323 | <a name="l00385"></a>00385 <a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a>.<a class="code" href="classfsqmat.html#5530d2756b5d991de755e6121c9a452e" title="Inplace symmetric multiplication by a SQUARE matrix , i.e. .">mult_sym</a> ( <a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a>, <a class="code" href="classbdm_1_1Kalman.html#2dd268f2d7fbe6382cb8825a1114192a" title="cache of fy.R">_Ry</a> ); |
| 324 | <a name="l00386"></a>00386 ( <a class="code" href="classbdm_1_1Kalman.html#2dd268f2d7fbe6382cb8825a1114192a" title="cache of fy.R">_Ry</a> ) +=<a class="code" href="classbdm_1_1Kalman.html#475b088287cdfbba4dc60a3d027728b7" title="Matrix R in square-root form.">R</a>; |
| 325 | <a name="l00387"></a>00387 |
| 326 | <a name="l00388"></a>00388 mat Pfull = <a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a>.<a class="code" href="classfsqmat.html#f54fc955e8e3b43d15afa92124bc24b3" title="Conversion to full matrix.">to_mat</a>(); |
327 | | <a name="l00390"></a>00390 mat Pfull = <a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a>.<a class="code" href="classfsqmat.html#f54fc955e8e3b43d15afa92124bc24b3" title="Conversion to full matrix.">to_mat</a>(); |
328 | | <a name="l00391"></a>00391 |
329 | | <a name="l00392"></a>00392 <a class="code" href="classbdm_1_1Kalman.html#2dd268f2d7fbe6382cb8825a1114192a" title="cache of fy.R">_Ry</a>.<a class="code" href="classfsqmat.html#9fa853e1ca28f2a1a1c43377e798ecb1" title="Matrix inversion preserving the chosen form.">inv</a> ( iRy ); <span class="comment">// result is in _iRy;</span> |
330 | | <a name="l00393"></a>00393 <a class="code" href="classbdm_1_1Kalman.html#bd69dfb802465f22dd84d73a180d5c92" title="placeholder for Kalman gain">_K</a> = Pfull*<a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a>.transpose() * ( iRy.to_mat() ); |
331 | | <a name="l00394"></a>00394 |
332 | | <a name="l00395"></a>00395 sq_T pom ( ( <span class="keywordtype">int</span> ) Pfull.rows() ); |
333 | | <a name="l00396"></a>00396 iRy.mult_sym_t ( <a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a>*Pfull,pom ); |
334 | | <a name="l00397"></a>00397 (<a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a> ) -= pom; <span class="comment">// P = P -PC'iRy*CP;</span> |
335 | | <a name="l00398"></a>00398 <a class="code" href="classbdm_1_1Kalman.html#c249d45258c8578b13858ad3e7b729b1" title="cache of fy.mu">_yp</a> = phxu-><a class="code" href="classbdm_1_1diffbifn.html#188f31066bd72e1bf0ddacd1eb0e6af3" title="Evaluates (VS: Do we really need common eval? ).">eval</a> ( <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a>,u ); <span class="comment">//y prediction</span> |
336 | | <a name="l00399"></a>00399 ( <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a> ) += <a class="code" href="classbdm_1_1Kalman.html#bd69dfb802465f22dd84d73a180d5c92" title="placeholder for Kalman gain">_K</a>* ( y-<a class="code" href="classbdm_1_1Kalman.html#c249d45258c8578b13858ad3e7b729b1" title="cache of fy.mu">_yp</a> ); |
337 | | <a name="l00400"></a>00400 |
338 | | <a name="l00401"></a>00401 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>==<span class="keyword">true</span> ) {<a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>+=<a class="code" href="classbdm_1_1Kalman.html#ba555c394c429f6831c9bbabfa2c944c" title="preditive density on $y_t$">fy</a>.<a class="code" href="classbdm_1_1eEF.html#a36d06ecdd6f4c79dc122510eaccc692" title="Evaluate normalized log-probability.">evallog</a> ( y );} |
339 | | <a name="l00402"></a>00402 }; |
340 | | <a name="l00403"></a>00403 |
341 | | <a name="l00404"></a>00404 |
342 | | <a name="l00405"></a>00405 } |
343 | | <a name="l00406"></a>00406 <span class="preprocessor">#endif // KF_H</span> |
344 | | <a name="l00407"></a>00407 <span class="preprocessor"></span> |
345 | | <a name="l00408"></a>00408 |
| 328 | <a name="l00390"></a>00390 <a class="code" href="classbdm_1_1Kalman.html#2dd268f2d7fbe6382cb8825a1114192a" title="cache of fy.R">_Ry</a>.<a class="code" href="classfsqmat.html#9fa853e1ca28f2a1a1c43377e798ecb1" title="Matrix inversion preserving the chosen form.">inv</a> ( iRy ); <span class="comment">// result is in _iRy;</span> |
| 329 | <a name="l00391"></a>00391 <a class="code" href="classbdm_1_1Kalman.html#bd69dfb802465f22dd84d73a180d5c92" title="placeholder for Kalman gain">_K</a> = Pfull*<a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a>.transpose() * ( iRy.to_mat() ); |
| 330 | <a name="l00392"></a>00392 |
| 331 | <a name="l00393"></a>00393 sq_T pom ( ( <span class="keywordtype">int</span> ) Pfull.rows() ); |
| 332 | <a name="l00394"></a>00394 iRy.mult_sym_t ( <a class="code" href="classbdm_1_1Kalman.html#818eba63a23972786a4579ad30294177" title="Matrix C.">C</a>*Pfull,pom ); |
| 333 | <a name="l00395"></a>00395 (<a class="code" href="classbdm_1_1Kalman.html#00c27b0bf324f0018497921ca23c71ed" title="cache of est.R">_P</a> ) -= pom; <span class="comment">// P = P -PC'iRy*CP;</span> |
| 334 | <a name="l00396"></a>00396 <a class="code" href="classbdm_1_1Kalman.html#c249d45258c8578b13858ad3e7b729b1" title="cache of fy.mu">_yp</a> = phxu-><a class="code" href="classbdm_1_1diffbifn.html#188f31066bd72e1bf0ddacd1eb0e6af3" title="Evaluates (VS: Do we really need common eval? ).">eval</a> ( <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a>,u ); <span class="comment">//y prediction</span> |
| 335 | <a name="l00397"></a>00397 ( <a class="code" href="classbdm_1_1Kalman.html#fa172078091e45561343fa513dd573b0" title="cache of est.mu">_mu</a> ) += <a class="code" href="classbdm_1_1Kalman.html#bd69dfb802465f22dd84d73a180d5c92" title="placeholder for Kalman gain">_K</a>* ( y-<a class="code" href="classbdm_1_1Kalman.html#c249d45258c8578b13858ad3e7b729b1" title="cache of fy.mu">_yp</a> ); |
| 336 | <a name="l00398"></a>00398 |
| 337 | <a name="l00399"></a>00399 <span class="keywordflow">if</span> ( <a class="code" href="classbdm_1_1BM.html#faff0ad12556fe7dc0e2807d4fd938ee" title="If true, the filter will compute likelihood of the data record and store it in ll...">evalll</a>==<span class="keyword">true</span> ) {<a class="code" href="classbdm_1_1BM.html#4064b6559d962633e4372b12f4cd204a" title="Logarithm of marginalized data likelihood.">ll</a>+=<a class="code" href="classbdm_1_1Kalman.html#ba555c394c429f6831c9bbabfa2c944c" title="preditive density on $y_t$">fy</a>.<a class="code" href="classbdm_1_1eEF.html#a36d06ecdd6f4c79dc122510eaccc692" title="Evaluate normalized log-probability.">evallog</a> ( y );} |
| 338 | <a name="l00400"></a>00400 }; |
| 339 | <a name="l00401"></a>00401 |
| 340 | <a name="l00402"></a>00402 |
| 341 | <a name="l00403"></a>00403 } |
| 342 | <a name="l00404"></a>00404 <span class="preprocessor">#endif // KF_H</span> |
| 343 | <a name="l00405"></a>00405 <span class="preprocessor"></span> |
| 344 | <a name="l00406"></a>00406 |