Changeset 5807 in ntrip for trunk/BNC/src/bncmodel.cpp
- Timestamp:
- Aug 6, 2014, 11:09:26 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/src/bncmodel.cpp
r5805 r5807 906 906 } 907 907 908 //909 //////////////////////////////////////////////////////////////////////////////910 void bncModel::kalman(const Matrix& AA, const ColumnVector& ll,911 const DiagonalMatrix& PP,912 SymmetricMatrix& QQ, ColumnVector& dx) {913 914 Tracer tracer("bncModel::kalman");915 916 int nPar = AA.Ncols();917 #if 1918 int nObs = AA.Nrows();919 UpperTriangularMatrix SS = Cholesky(QQ).t();920 921 Matrix SA = SS*AA.t();922 Matrix SRF(nObs+nPar, nObs+nPar); SRF = 0;923 for (int ii = 1; ii <= nObs; ++ii) {924 SRF(ii,ii) = 1.0 / sqrt(PP(ii,ii));925 }926 927 SRF.SubMatrix (nObs+1, nObs+nPar, 1, nObs) = SA;928 SRF.SymSubMatrix(nObs+1, nObs+nPar) = SS;929 930 UpperTriangularMatrix UU;931 QRZ(SRF, UU);932 933 SS = UU.SymSubMatrix(nObs+1, nObs+nPar);934 UpperTriangularMatrix SH_rt = UU.SymSubMatrix(1, nObs);935 Matrix YY = UU.SubMatrix(1, nObs, nObs+1, nObs+nPar);936 937 UpperTriangularMatrix SHi = SH_rt.i();938 939 Matrix KT = SHi * YY;940 SymmetricMatrix Hi; Hi << SHi * SHi.t();941 942 dx = KT.t() * ll;943 QQ << (SS.t() * SS);944 #else945 DiagonalMatrix Ql = PP.i();946 Matrix DD = QQ * AA.t();947 SymmetricMatrix SM(nPar); SM << AA * DD + Ql;948 UpperTriangularMatrix UU = Cholesky(SM).t();949 UpperTriangularMatrix Ui = UU.i();950 Matrix EE = DD * Ui;951 Matrix KK = EE * Ui.t();952 QQ << QQ - EE * EE.t();953 dx = KK * ll;954 #endif955 }956 957 908 // Phase Wind-Up Correction 958 909 ///////////////////////////////////////////////////////////////////////////
Note:
See TracChangeset
for help on using the changeset viewer.