Go to the documentation of this file.00001
00009 #ifndef KALMANTOOLS_HPP_
00010 #define KALMANTOOLS_HPP_
00011
00012 #include "kernel/jafarDebug.hpp"
00013
00014 #include "jmath/jblas.hpp"
00015 #include "jmath/indirectArray.hpp"
00016 #include "rtslam/innovation.hpp"
00017
00018 namespace jafar {
00019 namespace rtslam {
00020 namespace kalman {
00021 using namespace jblas;
00022
00023 template<class SM, class MJ, class MK>
00024 void computeKalmanGain(const SM & P, const ind_array & ia_x, Innovation & inn, const MJ & INN_x1, const ind_array & ia_x1, MK & K){
00025 JFR_ASSERT(P.size1() >= ia_x.size(), "indirect indexing too large for matrix P");
00026 JFR_ASSERT(INN_x1.size1() == inn.size(), "sizes mismatch: INN_x1 and inn");
00027 JFR_ASSERT(INN_x1.size2() == ia_x1.size(), "sizes mismatch: INN_x1 and ia_x1");
00028 JFR_ASSERT(K.size1() == ia_x.size(), "sizes mismatch: K and ia_x");
00029 JFR_ASSERT(K.size2() == inn.size(), "sizes mismatch: K and inn");
00030
00031 inn.invertCov();
00032 ublas::noalias(K) = - prod(prod<mat>(project(P, ia_x, ia_x1), trans(INN_x1)), inn.iP_);
00033 }
00034
00035 }
00036 }
00037 }
00038
00039
00040 #endif