1 | /*! |
---|
2 | \file |
---|
3 | \brief Bayesian Filtering for linear Gaussian models (Kalman Filter) and extensions |
---|
4 | \author Vaclav Smidl. |
---|
5 | |
---|
6 | ----------------------------------- |
---|
7 | BDM++ - C++ library for Bayesian Decision Making under Uncertainty |
---|
8 | |
---|
9 | Using IT++ for numerical operations |
---|
10 | ----------------------------------- |
---|
11 | */ |
---|
12 | |
---|
13 | #ifndef EKF_TEMPLATE_H |
---|
14 | #define EKF_TEMPLATE_H |
---|
15 | |
---|
16 | #include "kalman.h" |
---|
17 | |
---|
18 | namespace bdm { |
---|
19 | |
---|
20 | //!Extended Kalman filter with unknown \c Q and \c R |
---|
21 | class EKFful_unQR : public EKFfull { |
---|
22 | public: |
---|
23 | void condition ( const vec &QR0 ) { |
---|
24 | Q = diag ( QR0 ( 0, dimension() - 1 ) ); |
---|
25 | R = diag ( QR0 ( dimension(), dimension() + dimy - 1 ) ); |
---|
26 | }; |
---|
27 | }; |
---|
28 | |
---|
29 | //!Extended Kalman filter in Choleski form with unknown diagonal \c Q |
---|
30 | class EKFCh_dQ : public EKFCh { |
---|
31 | public: |
---|
32 | root* _copy_() const { |
---|
33 | return new EKFCh_dQ(*this); |
---|
34 | } |
---|
35 | |
---|
36 | //! new bayes, expects cond = [ut, Qt] |
---|
37 | void bayes( const vec &yt , const vec &cond) { |
---|
38 | vec ut=cond.left(dimc-dimension()); |
---|
39 | vec dQt=cond.right(dimension()); |
---|
40 | Q.setD ( dQt, 0 ); |
---|
41 | //from EKF |
---|
42 | preA.set_submatrix ( dimy + dimension(), dimy, Q._Ch() ); |
---|
43 | |
---|
44 | EKFCh::bayes(yt,ut); |
---|
45 | }; |
---|
46 | void validate() { |
---|
47 | EKFCh::validate(); |
---|
48 | dimc += dimension(); |
---|
49 | } |
---|
50 | }; |
---|
51 | |
---|
52 | //!Extended Kalman filter in Choleski form with unknown \c Q |
---|
53 | class EKFCh_chQ : public EKFCh { |
---|
54 | public: |
---|
55 | void condition ( const vec &chQ0 ) { |
---|
56 | Q.setCh ( chQ0 ); |
---|
57 | //from EKF |
---|
58 | preA.set_submatrix ( dimy + dimension(), dimension(), Q._Ch() ); |
---|
59 | }; |
---|
60 | }; |
---|
61 | |
---|
62 | ////!Extended Kalman filter with unknown parameters in \c IM |
---|
63 | // class EKFCh_cond : public EKFCh { |
---|
64 | // public: |
---|
65 | // void condition ( const vec &val ) { |
---|
66 | // pfxu->condition ( val ); |
---|
67 | // }; |
---|
68 | // }; |
---|
69 | |
---|
70 | } |
---|
71 | #endif //EKF_TEMP_H |
---|