#pragma once #include "math.hpp" namespace matrix { template int kalman_correct( const Matrix & P, const Matrix & C, const Matrix & R, const Matrix &r, Matrix & dx, Matrix & dP, Type & beta ) { SquareMatrix S_I = SquareMatrix(C*P*C.T() + R).I(); Matrix K = P*C.T()*S_I; dx = K*r; beta = Scalar(r.T()*S_I*r); dP = K*C*P*(-1); return 0; } } // namespace matrix