indii/ml/filter/Smoother.hpp

00001 #ifndef INDII_ML_FILTER_SMOOTHER_HPP
00002 #define INDII_ML_FILTER_SMOOTHER_HPP
00003 
00004 #include "../aux/GaussianPdf.hpp"
00005 
00006 namespace indii {
00007   namespace ml {
00008     namespace filter {
00009 
00010 /**
00011  * Abstract smoother.
00012  *
00013  * @author Lawrence Murray <lawrence@indii.org>
00014  * @version $Rev: 544 $
00015  * @date $Date: 2008-09-01 15:04:39 +0100 (Mon, 01 Sep 2008) $
00016  *
00017  * @param T The type of time.
00018  * @param P The type of probability distribution used to represent the
00019  * system state.
00020  * 
00021  * @see indii::ml::filter for general usage guidelines.
00022  */
00023 template <class T = unsigned int, class P = indii::ml::aux::GaussianPdf>
00024 class Smoother {
00025 public:
00026   /**
00027    * Constructor.
00028    *
00029    * @param tT \f$t_T\f$; starting time.
00030    * @param p_xT \f$p(\mathbf{x}_T)\f$; prior over the state at time
00031    * \f$t_T\f$.
00032    */
00033   Smoother(const T tT, const P& p_xT);
00034 
00035   /**
00036    * Destructor.
00037    */
00038   virtual ~Smoother();
00039 
00040   /**
00041    * Get the current time.
00042    *
00043    * @return \f$t_n\f$; the current time.
00044    */
00045   T getTime() const;
00046 
00047   /**
00048    * Set the current time.
00049    *
00050    * @param tn \f$t_n\f$; the current time.
00051    */
00052   void setTime(const T tn);
00053 
00054   /**
00055    * Get distribution over the state at the current time given all
00056    * measurements.
00057    *
00058    * @return \f$P\big(\mathbf{x}(t_n)\, |
00059    * \,\mathbf{y}(t_1),\ldots,\mathbf{y}(t_T)\big)\f$; distribution
00060    * over the current state given all measurements.
00061    */
00062   P& getSmoothedState();
00063 
00064   /**
00065    * Set the distribution over the state at the current time given
00066    * all measurements.
00067    *
00068    * @param p_xtn_ytT \f$P\big(\mathbf{x}(t_n)\, |
00069    * \,\mathbf{y}(t_1),\ldots,\mathbf{y}(t_T)\big)\f$; distribution
00070    * over the current state given all measurements.
00071    */
00072   void setSmoothedState(const P& p_xtn_ytT);
00073 
00074   /**
00075    * Apply the measurement function to the current smoothed state to
00076    * obtain an estimated measurement.
00077    *
00078    * @return The estimated measurement.
00079    */
00080   virtual P smoothedMeasure() = 0;
00081  
00082 protected:
00083   /**
00084    * \f$t_n\f$; the current time.
00085    */
00086   T tn;
00087 
00088   /**
00089    * \f$p(\mathbf{x}_n\,|\,\mathbf{y}_{1:T})\f$; smoothed density at the
00090    * current time.
00091    */
00092   P p_xtn_ytT;
00093 
00094 };
00095 
00096     }
00097   }
00098 }
00099 
00100 template <class T, class P>
00101 indii::ml::filter::Smoother<T,P>::Smoother(const T tT, const P& p_xT) :
00102     tn(tT), p_xtn_ytT(p_xT) {
00103   //
00104 }
00105 
00106 template <class T, class P>
00107 indii::ml::filter::Smoother<T,P>::~Smoother() {
00108   //
00109 }
00110 
00111 template <class T, class P>
00112 inline T indii::ml::filter::Smoother<T,P>::getTime() const {
00113   return this->tn;
00114 }
00115 
00116 template <class T, class P>
00117 void indii::ml::filter::Smoother<T,P>::setTime(const T tn) {
00118   this->tn = tn;
00119 }
00120 
00121 template <class T, class P>
00122 inline P& indii::ml::filter::Smoother<T,P>::getSmoothedState() {
00123   return this->p_xtn_ytT;
00124 }
00125 
00126 template <class T, class P>
00127 void indii::ml::filter::Smoother<T,P>::setSmoothedState(
00128     const P& p_xtn_ytT) {
00129   this->p_xtn_ytT = p_xtn_ytT;
00130 }
00131 
00132 #endif
00133 

Generated on Wed Dec 17 15:11:57 2008 for dysii Dynamical Systems Library by  doxygen 1.5.3