00001 #ifndef INDII_ML_FILTER_PARTICLESMOOTHERMODEL_HPP 00002 #define INDII_ML_FILTER_PARTICLESMOOTHERMODEL_HPP 00003 00004 #include "../aux/matrix.hpp" 00005 #include "../aux/DiracMixturePdf.hpp" 00006 #include "ParticleFilterModel.hpp" 00007 00008 namespace indii { 00009 namespace ml { 00010 namespace filter { 00011 00012 /** 00013 * ParticleSmoother compatible model. 00014 * 00015 * @author Lawrence Murray <lawrence@indii.org> 00016 * @version $Rev: 437 $ 00017 * @date $Date: 2008-04-28 00:23:52 +0100 (Mon, 28 Apr 2008) $ 00018 * 00019 * @param T The type of time. 00020 * 00021 * @see indii::ml::filter for general usage guidelines. 00022 */ 00023 template <class T = unsigned int> 00024 class ParticleSmootherModel : public virtual ParticleFilterModel<T> { 00025 public: 00026 /** 00027 * Destructor. 00028 */ 00029 virtual ~ParticleSmootherModel() = 0; 00030 00031 /** 00032 * Calculates the matrix \f$\alpha(t)\f$. \f$\alpha^{(j,i)}(t) = 00033 * p\big(\mathbf{s}^{(j)}(t + \Delta 00034 * t)\,|\,\mathbf{s}^{(i)}(t)\big)\f$, where \f$\mathbf{s}^{(j)}(t + 00035 * \Delta t)\f$ is the \f$j\f$th particle at time \f$t + \Delta t\f$ 00036 * and \f$\mathbf{s}^{(i)}(t)\f$ is the \f$i\f$th particle at time 00037 * \f$t\f$. 00038 * 00039 * @param p_xtn_ytn \f$P\big(\mathbf{x}(t_n)\, | 00040 * \,\mathbf{y}(t_1),\ldots,\mathbf{y}(t_n)\big)\f$. 00041 * @param p_xtnp1_ytnp1 \f$P\big(\mathbf{x}(t_{n+1})\, | 00042 * \,\mathbf{y}(t_1),\ldots,\mathbf{y}(t_{n+1})\big)\f$. 00043 * @param start \f$t_n\f$; start time. 00044 * @param delta \f$\Delta t = t_{n+1} - t_n\f$; change in time. 00045 * 00046 * @return \f$\alpha(t)\f$. 00047 * 00048 * Particles for the distributions may be obtained with calls to 00049 * indii::ml::aux::DiracMixturePdf::getComponents(). 00050 * 00051 * @note The implementation should not assume that there are \f$P\f$ 00052 * particles in @c p_xtn_ytn and @c p_xtnp1_ytnp1. Instead, use 00053 * indii::ml::aux::DiracMixturePdf::getNumComponents() to determine 00054 * this. This is particularly important when working in a parallel 00055 * environment, where particles are divided up amongst multiple 00056 * calls to this method. 00057 */ 00058 virtual indii::ml::aux::sparse_matrix alpha( 00059 const indii::ml::aux::DiracMixturePdf& p_xtn_ytn, 00060 const indii::ml::aux::DiracMixturePdf& p_xtnp1_ytnp1, 00061 const T start, const T delta) = 0; 00062 00063 /** 00064 * Perform precalculations for \f$\alpha\f$ matrix. 00065 * 00066 * In a parallel environment, each smoothing step may require 00067 * multiple calls to the alpha() method of the model with the same 00068 * first argument. To allow for precalculations based on this first 00069 * argument, the alphaPrecalculate() method is called before each 00070 * change to the argument. 00071 * 00072 * For example, in the case of a model with simple Gaussian additive 00073 * noise, this method could be used to propagate each of the 00074 * particles at time \f$t_n\f$ to time \f$t_{n+1}\f$ without noise, 00075 * obtaining the mean of a Gaussian with covariance equivalent to 00076 * the system noise. Within the alpha() method, these Gaussians can 00077 * then be used to quickly calculate densities without having to 00078 * transition particles again during each call to alpha(). 00079 * 00080 * There is no requirement for this method to do anything at all, or 00081 * even to be implemented in derived classes. It exists purely for 00082 * optimisation, and is not required for correctness. 00083 * 00084 * @param p_xtn_ytn As p_xtn_ytn of alpha(). 00085 * @param start As start of alpha(). 00086 * @param delta As delta of alpha(). 00087 */ 00088 virtual void alphaPrecalculate( 00089 const indii::ml::aux::DiracMixturePdf& p_xtn_ytn, const T start, 00090 const T delta); 00091 00092 }; 00093 00094 } 00095 } 00096 } 00097 00098 template <class T> 00099 indii::ml::filter::ParticleSmootherModel<T>::~ParticleSmootherModel() { 00100 // 00101 } 00102 00103 template <class T> 00104 void indii::ml::filter::ParticleSmootherModel<T>::alphaPrecalculate( 00105 const indii::ml::aux::DiracMixturePdf& p_xtn_ytn, const T start, 00106 const T delta) { 00107 // 00108 } 00109 00110 #endif
1.5.3