00001 #ifndef _BAYES_FILTER_UNSCENTED
00002 #define _BAYES_FILTER_UNSCENTED
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #include "bayesFlt.hpp"
00036
00037
00038 namespace Bayesian_filter
00039 {
00040
00041 class Unscented_predict_model : public Predict_model_base
00042
00043
00044
00045
00046
00047
00048
00049 {
00050 public:
00051 Unscented_predict_model (std::size_t q_size)
00052 {
00053 q_unscented = q_size;
00054 }
00055
00056 virtual const FM::Vec& f(const FM::Vec& x) const = 0;
00057
00058
00059
00060 virtual const FM::SymMatrix& Q(const FM::Vec& x) const = 0;
00061
00062
00063 private:
00064 friend class Unscented_filter;
00065 std::size_t q_unscented;
00066 };
00067
00068
00069 class Unscented_scheme : public Linrz_kalman_filter, public Functional_filter
00070 {
00071 private:
00072 std::size_t q_max;
00073 public:
00074 FM::ColMatrix XX;
00075 Float kappa;
00076
00077 Unscented_scheme (std::size_t x_size, std::size_t z_initialsize = 0);
00078 Unscented_scheme& operator= (const Unscented_scheme&);
00079
00080
00081 void init ();
00082 void init_XX ();
00083 void update ();
00084 void update_XX (Float kappa);
00085
00086 void predict (Unscented_predict_model& f);
00087
00088 void predict (Functional_predict_model& f);
00089 void predict (Addative_predict_model& f);
00090 Float predict (Linrz_predict_model& f)
00091 {
00092 predict(static_cast<Addative_predict_model&>(f));
00093 return 1.;
00094 }
00095
00096 Float observe (Uncorrelated_addative_observe_model& h, const FM::Vec& z);
00097 Float observe (Correlated_addative_observe_model& h, const FM::Vec& z);
00098
00099
00100 Float observe (Linrz_uncorrelated_observe_model& h, const FM::Vec& z)
00101 {
00102 return observe (static_cast<Uncorrelated_addative_observe_model&>(h),z);
00103 }
00104 Float observe (Linrz_correlated_observe_model& h, const FM::Vec& z)
00105 {
00106 return observe (static_cast<Correlated_addative_observe_model&>(h),z);
00107 }
00108
00109 public:
00110 FM::Vec s;
00111 FM::SymMatrix S, SI;
00112
00113 protected:
00114 virtual Float predict_Kappa (std::size_t size) const;
00115 virtual Float observe_Kappa (std::size_t size) const;
00116
00117
00118
00119
00120 protected:
00121 std::size_t last_z_size;
00122 void observe_size (std::size_t z_size);
00123
00124 private:
00125 void unscented (FM::ColMatrix& XX, const FM::Vec& x, const FM::SymMatrix& X, Float scale);
00126
00127 std::size_t x_size;
00128 std::size_t XX_size;
00129
00130 protected:
00131 FM::ColMatrix fXX;
00132 };
00133
00134
00135 }
00136 #endif