[120] | 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 | |
---|
[384] | 13 | #ifndef EKF_TEMPLATE_H |
---|
| 14 | #define EKF_TEMPLATE_H |
---|
[120] | 15 | |
---|
[384] | 16 | #include "kalman.h" |
---|
[120] | 17 | |
---|
[477] | 18 | namespace bdm { |
---|
[120] | 19 | |
---|
| 20 | //!Extended Kalman filter with unknown \c Q and \c R |
---|
[283] | 21 | class EKFful_unQR : public EKFfull { |
---|
[120] | 22 | public: |
---|
| 23 | void condition ( const vec &QR0 ) { |
---|
[744] | 24 | Q = diag ( QR0 ( 0, dimension() - 1 ) ); |
---|
| 25 | R = diag ( QR0 ( dimension(), dimension() + dimy - 1 ) ); |
---|
[120] | 26 | }; |
---|
| 27 | }; |
---|
| 28 | |
---|
[294] | 29 | //!Extended Kalman filter in Choleski form with unknown diagonal \c Q |
---|
| 30 | class EKFCh_dQ : public EKFCh { |
---|
[229] | 31 | public: |
---|
[766] | 32 | root* _copy_() const { |
---|
| 33 | return new EKFCh_dQ(*this); |
---|
| 34 | } |
---|
| 35 | |
---|
[744] | 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 ); |
---|
[229] | 41 | //from EKF |
---|
[744] | 42 | preA.set_submatrix ( dimy + dimension(), dimy, Q._Ch() ); |
---|
| 43 | |
---|
| 44 | EKFCh::bayes(yt,ut); |
---|
[229] | 45 | }; |
---|
[744] | 46 | void validate() { |
---|
| 47 | EKFCh::validate(); |
---|
| 48 | dimc += dimension(); |
---|
| 49 | } |
---|
[229] | 50 | }; |
---|
[120] | 51 | |
---|
[294] | 52 | //!Extended Kalman filter in Choleski form with unknown \c Q |
---|
| 53 | class EKFCh_chQ : public EKFCh { |
---|
[477] | 54 | public: |
---|
| 55 | void condition ( const vec &chQ0 ) { |
---|
| 56 | Q.setCh ( chQ0 ); |
---|
[294] | 57 | //from EKF |
---|
[744] | 58 | preA.set_submatrix ( dimy + dimension(), dimension(), Q._Ch() ); |
---|
[477] | 59 | }; |
---|
[294] | 60 | }; |
---|
| 61 | |
---|
[797] | 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 | // }; |
---|
[231] | 69 | |
---|
[254] | 70 | } |
---|
[141] | 71 | #endif //EKF_TEMP_H |
---|