00001 #ifndef _BAYES_FILTER_INFORMATION 00002 #define _BAYES_FILTER_INFORMATION 00003 00004 /* 00005 * Bayes++ the Bayesian Filtering Library 00006 * Copyright (c) 2002 Michael Stevens 00007 * See accompanying Bayes++.htm for terms and conditions of use. 00008 * 00009 * $Id: infFlt.hpp 562 2006-04-05 20:46:23 +0200 (Wed, 05 Apr 2006) mistevens $ 00010 */ 00011 00012 /* 00013 * Information Filter Scheme. 00014 * A possibly non-linear Information filter 00015 * 00016 * References 00017 * [1] "Stochastic Models, Estimation, and Control} Peter S Maybeck, Academic Press, ISBN 0-12-480701-1 00018 * Section 5.7 00019 * [2] "Kalman Filtering, Theory and Practice", Mohinder S. Grewal, Angus P. Andrews ISBN 0-13-211335-X 00020 * To work with with Linear and Linrz models 00021 * a) a seperate state and information (via covariance) predict is used. 00022 * b) a EIF modified innovation update algorithm is used. 00023 * 00024 * Two alternative algorithms are used for predict functions: 00025 * For linrz models an extended predict form is used so information state 'y' is predicted via the 00026 * non-linear function. This requires that X, and Y are invertable so 'x' can be computed. 00027 * For linear invertable models predict can be done directly without computing x 00028 * Discontinous observe models require that predict is normailised with 00029 * respect to the observation. 00030 * NUMERICS 00031 * The state x is respresented by prod(X,y). This may be illconditioned if the product is 00032 * illconditioned. At present only the conditioning of X if checked, if y has a large range the product 00033 * may be illconditioned. This is not checked 00034 * 00035 * The filter is operated by performing a 00036 * predict, observe 00037 * cycle defined by the base class 00038 */ 00039 #include "bayesFlt.hpp" 00040 00041 /* Filter namespace */ 00042 namespace Bayesian_filter 00043 { 00044 00045 class Information_scheme : public Extended_kalman_filter, virtual public Information_state_filter 00046 { 00047 public: 00048 Information_scheme (std::size_t x_size, std::size_t z_initialsize = 0); 00049 Information_scheme& operator= (const Information_scheme&); 00050 // Optimise copy assignment to only copy filter state 00051 00052 struct Linear_predict_byproducts 00053 { 00054 Linear_predict_byproducts (std::size_t x_size, std::size_t q_size); 00055 FM::SymMatrix A; 00056 FM::Matrix tempG; 00057 FM::SymMatrix B; 00058 FM::Vec y; 00059 }; 00060 00061 00062 void init (); 00063 void update (); 00064 void init_yY (); 00065 void update_yY (); 00066 // Covariance and information form state interface 00067 00068 Float predict (Linear_invertable_predict_model& f, Linear_predict_byproducts& b); 00069 // Linear Prediction in information form as in Ref[2] 00070 Float predict (Linear_invertable_predict_model& f) 00071 { 00072 Linear_predict_byproducts b(f.Fx.size1(),f.q.size()); 00073 return predict (f, b); 00074 } 00075 00076 Float predict (Linrz_predict_model& f); 00077 // Extended Prediction via state 00078 00079 Float observe_innovation (Linrz_uncorrelated_observe_model& h, const FM::Vec& s); 00080 Float observe_innovation (Linrz_correlated_observe_model& h, const FM::Vec& s); 00081 00082 protected: 00083 bool update_required; // Postcondition of update is not met 00084 00085 protected: // Permenantly allocated temps 00086 FM::RowMatrix tempX; 00087 FM::Vec i; 00088 FM::SymMatrix I; 00089 // allow fast operation if z_size remains constant 00090 FM::SymMatrix ZI; 00091 std::size_t last_z_size; 00092 void observe_size (std::size_t z_size); 00093 }; 00094 00095 00096 }//namespace 00097 #endif
1.4.6