Bayes++ Bayesian Filtering Classes Release 2014.5 - Copyright (c) 2003,2004,2005,2006,2011,2012,2014 Michael Stevens
UDFlt.hpp
Go to the documentation of this file.
1#ifndef _BAYES_FILTER_UD
2#define _BAYES_FILTER_UD
3/*
4 * Bayes++ the Bayesian Filtering Library
5 * Copyright (c) 2002 Michael Stevens
6 * See accompanying Bayes++.htm for terms and conditions of use.
7 *
8 * $Id$
9 */
10
11/*
12 * UdU' Factorisation of covariance Filter Scheme.
13 * Implementation of a 'Square-root' linearised Kalman filter
14 *
15 * Bierman's UD factorisatised update algorithm using Agee-Turner UdU' factorisation rank 1 update
16 * Thornton's MWG-S factorisation predict algorithm
17 * References
18 * [1] "Factorisation Methods for Discrete Sequential Estimation" Gerald J. Bierman ISBN 0-12-097350-2
19 * [2] "Kalman Filtering, Theory and Practice", Mohinder S. Grewal, Angus P. Andrews ISBN 0-13-211335-X
20 *
21 * A initial observation size may also be specified for efficiency.
22 *
23 * The filter is operated by performing a
24 * predict, observe
25 * cycle defined by the base class
26 */
27#include "bayesFlt.hpp"
28
29/* Filter namespace */
30namespace Bayesian_filter
31{
32
34{
35public:
36 UD_sequential_observe_model (std::size_t x_size, std::size_t z_size) :
37 Linrz_uncorrelated_observe_model(x_size, z_size), Hx_o(x_size)
38 {}
39 virtual const FM::Vec& ho (const FM::Vec& x, const std::size_t o) = 0;
40 /* Supplied model (h) for observation using state x, z allows normalisation and model variation
41 Fast model of a single element (o) in observation model
42 Precondition: Hx_o is conformantly dimensioned
43 Postcondition:
44 z(k|k-1) = h(x(k|k-1)
45 Hx_o(x(k-1|k-1) = Jacobian of h with respect to state x (row o)
46 */
48};
49
50
52{
53private:
54 std::size_t q_max; // Maxiumum size allocated for noise model, constructed before UD
55public:
56 FM::Matrix UD; // UDU factorisation of X with D on diagonal
57 // Lower triangle used as workspace
58 FM::Vec s; // Innovation
59 FM::Vec Sd; // Innovation Covariance
60
61 UD_scheme (std::size_t x_size, std::size_t q_maxsize, std::size_t z_initialsize = 0);
63 // Optimise copy assignment to only copy filter state
64
65 void init ();
66 void update ();
68
70 /* No solution for Correlated noise and Linrz model */
72 /* General observe */
73
75 /* Special Linear observe for correlated Z, fast Z decorrelation */
77 /* Special Linrz observe using fast sequential model */
78
79protected:
80 Float predictGq (const FM::Matrix& Fx, const FM::Matrix& G, const FM::Vec& q);
81 FM::Vec d, dv, v; // predictGQ temporaries
82 Float observeUD (FM::Vec& gain, Float& alpha, const FM::Vec& h, const Float r);
83 FM::Vec a, b; // observeUD temporaries
84 // Observation temporaies
85 void observe_size (std::size_t z_size);
86 std::size_t last_z_size;
87 FM::Vec h1; // Single Observation model
88 FM::Vec w; // Single Gain
89 FM::Vec znorm; // Normalised innovation
90 FM::Vec zpdecol; // Decorrelated zp
91 FM::Matrix Gz; // Z coupling
92 FM::Matrix GIHx; // Modified Model for linear decorrelation
93};
94
95
96}//namespace
97#endif
Definition bayesFlt.hpp:589
Definition bayesFlt.hpp:183
Definition UDFlt.hpp:52
FM::Matrix Gz
Definition UDFlt.hpp:91
Float predictGq(const FM::Matrix &Fx, const FM::Matrix &G, const FM::Vec &q)
Definition UDFlt.cpp:111
FM::Vec Sd
Definition UDFlt.hpp:59
Float observe(Linrz_correlated_observe_model &h, const FM::Vec &z)
Definition UDFlt.cpp:309
FM::Vec a
Definition UDFlt.hpp:83
FM::Vec znorm
Definition UDFlt.hpp:89
void init()
Definition UDFlt.cpp:60
FM::Matrix GIHx
Definition UDFlt.hpp:92
FM::Vec b
Definition UDFlt.hpp:83
FM::Vec v
Definition UDFlt.hpp:81
FM::Vec d
Definition UDFlt.hpp:81
FM::Matrix UD
Definition UDFlt.hpp:56
FM::Vec h1
Definition UDFlt.hpp:87
UD_scheme & operator=(const UD_scheme &)
Definition UDFlt.cpp:47
std::size_t last_z_size
Definition UDFlt.hpp:86
Float predict(Linrz_predict_model &f)
Definition UDFlt.cpp:92
void update()
Definition UDFlt.cpp:79
void observe_size(std::size_t z_size)
Definition UDFlt.cpp:250
FM::Vec dv
Definition UDFlt.hpp:81
FM::Vec s
Definition UDFlt.hpp:58
FM::Vec w
Definition UDFlt.hpp:88
FM::Vec zpdecol
Definition UDFlt.hpp:90
Float observeUD(FM::Vec &gain, Float &alpha, const FM::Vec &h, const Float r)
Definition UDFlt.cpp:443
virtual const FM::Vec & ho(const FM::Vec &x, const std::size_t o)=0
FM::Vec Hx_o
Definition UDFlt.hpp:47
UD_sequential_observe_model(std::size_t x_size, std::size_t z_size)
Definition UDFlt.hpp:36
FMVec< detail::BaseVector > Vec
Definition uBLASmatrix.hpp:323
RowMatrix Matrix
Definition uBLASmatrix.hpp:325
double Float
Definition matSupSub.hpp:55
Definition bayesException.hpp:21