indii/ml/filter/UnscentedKalmanSmootherBackwardTransitionAdaptor.hpp

00001 #ifndef INDII_ML_FILTER_UNSCENTEDKALMANSMOOTHERBACKWARDTRANSITIONADAPTOR_HPP
00002 #define INDII_ML_FILTER_UNSCENTEDKALMANSMOOTHERBACKWARDTRANSITIONADAPTOR_HPP
00003 
00004 #include "UnscentedTransformationModel.hpp"
00005 
00006 namespace indii {
00007   namespace ml {
00008     namespace filter {
00009 
00010   template <class T> class UnscentedTransformation;
00011 
00012 /**
00013  * Adaptor mapping UnscentedTransformationModel interface to method calls in
00014  * UnscentedKalmanSmootherModel.
00015  * 
00016  * @author Lawrence Murray <lawrence@indii.org>
00017  * @version $Rev: 544 $
00018  * @date $Date: 2008-09-01 15:04:39 +0100 (Mon, 01 Sep 2008) $
00019  *
00020  * @param T The type of time.
00021  *
00022  * For internal use only.
00023  */
00024 template <class T = unsigned int>
00025 class UnscentedKalmanSmootherBackwardTransitionAdaptor :
00026     public UnscentedTransformationModel<T> {
00027 
00028   friend class UnscentedTransformation<T>;
00029   friend class UnscentedKalmanSmoother<T>;
00030 
00031 private:
00032   /**
00033    * Constructor.
00034    * 
00035    * @param smoother UnscentedKalmanSmoother for which to map calls.
00036    */
00037   UnscentedKalmanSmootherBackwardTransitionAdaptor(
00038       UnscentedKalmanSmootherModel<T>* model);
00039 
00040   /**
00041    * Maps call to UnscentedKalmanSmootherModel::backwardTransition.
00042    */
00043   virtual indii::ml::aux::vector propagate(const indii::ml::aux::vector& x,
00044       const T delta = 0);
00045 
00046   /**
00047    * Smoother for which to act as adaptor.
00048    */
00049   UnscentedKalmanSmootherModel<T>* model;
00050 
00051 };
00052 
00053     }
00054   }
00055 }
00056 
00057 #include "UnscentedKalmanSmootherModel.hpp"
00058 
00059 template <class T>
00060 indii::ml::filter::UnscentedKalmanSmootherBackwardTransitionAdaptor<T>::UnscentedKalmanSmootherBackwardTransitionAdaptor(
00061     UnscentedKalmanSmootherModel<T>* model) : model(model) {
00062   //
00063 }
00064 
00065 template <class T>
00066 indii::ml::aux::vector
00067     indii::ml::filter::UnscentedKalmanSmootherBackwardTransitionAdaptor<T>::propagate(
00068     const indii::ml::aux::vector& X, T delta) {
00069   namespace aux = indii::ml::aux;
00070   namespace ublas = boost::numeric::ublas;
00071     
00072   const unsigned int N = model->getStateSize();
00073   const unsigned int W = model->getSystemNoise().getDimensions();
00074 
00075   aux::vector x(project(X, ublas::range(0,N)));
00076   aux::vector w(project(X, ublas::range(N,N+W)));
00077 
00078   return model->backwardTransition(x, w, delta);
00079 }
00080 
00081 #endif

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