📄 filter.hpp
字号:
#ifndef INDII_ML_FILTER_FILTER_HPP#define INDII_ML_FILTER_FILTER_HPP#include "../aux/vector.hpp"#include "../aux/GaussianPdf.hpp"namespace indii { namespace ml { namespace filter {/** * Abstract %filter. * * @author Lawrence Murray <lawrence@indii.org> * @version $Rev: 344 $ * @date $Date: 2007-11-02 20:21:05 +0000 (Fri, 02 Nov 2007) $ * * @param T The type of time. * @param P The type of probability distribution used to represent the * system state. * * @see indii::ml::filter for general usage guidelines. */template <class T = unsigned int, class P = indii::ml::aux::GaussianPdf>class Filter {public: /** * Constructor. * * @param p_x0 \f$P\big(\mathbf{x}(0)\big)\f$; prior over the initial state * \f$\mathbf{x}(0)\f$. */ Filter(const P& p_x0); /** * Destructor. */ virtual ~Filter(); /** * Get the current time. * * @return \f$t_n\f$; the current time. */ T getTime() const; /** * Set the current time. * * @param tn \f$t_n\f$; the current time. */ void setTime(const T tn); /** * Get distribution over the state at the current time given past * and present measurements. * * @return \f$P\big(\mathbf{x}(t_n)\, | * \,\mathbf{y}(t_1),\ldots,\mathbf{y}(t_n)\big)\f$; distribution * over the current state given past and present measurements. */ P& getFilteredState(); /** * Set the distribution over the state at the current time given * past and present measurements. * * @param p_xtn_ytn \f$P\big(\mathbf{x}(t_n)\, | * \,\mathbf{y}(t_1),\ldots,\mathbf{y}(t_n)\big)\f$; distribution * over the current state given past and present measurements. */ void setFilteredState(const P& p_xtn_ytn); /** * Advance system to time of next measurement. * * @param tnp1 \f$t_{n+1}\f$; the time to which to advance the * system. This must be greater than the current time \f$t_n\f$. * @param ytnp1 \f$\mathbf{y}(t_{n+1})\f$; measurement at time * \f$t_{n+1}\f$. */ virtual void filter(T tnp1, const indii::ml::aux::vector& ytnp1) = 0; /** * Apply the measurement function to the current filtered state to * obtain an estimated measurement. * * @return The estimated measurement. */ virtual P measure() = 0;protected: /** * \f$t_n\f$; the current time. For internal use only. */ T tn; /** * \f$P\big(\mathbf{x}(t_n)\, | * \,\mathbf{y}(t_1),\ldots,\mathbf{y}(t_n)\big)\f$; distribution * over the current state given past and present measurements. For * internal use only. */ P p_xtn_ytn;}; } }}using namespace indii::ml::filter;template <class T, class P>Filter<T,P>::Filter(const P& p_x0) : p_xtn_ytn(p_x0) { this->tn = 0;}template <class T, class P>Filter<T,P>::~Filter() { //}template <class T, class P>T Filter<T,P>::getTime() const { return this->tn;}template <class T, class P>void Filter<T,P>::setTime(const T tn) { this->tn = tn;}template <class T, class P>P& Filter<T,P>::getFilteredState() { return this->p_xtn_ytn;}template <class T, class P>void Filter<T,P>::setFilteredState(const P& p_xtn_ytn) { this->p_xtn_ytn = p_xtn_ytn;}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -