Home > Back-end > Why release VS2015 mode calculation results more accurate than the debug? How to achieve consistent
Why release VS2015 mode calculation results more accurate than the debug? How to achieve consistent
Time:11-18
I was writing a kalman filter for initial alignment of inertial navigation program, there are a large number of matrix floating-point calculations, the release mode of convergence, repeated the experiment result is also stable precision, but in the debug mode will gradually spread, the result error is very big, is this why?? Current problems locating in the measurement update section of the kalman filter, this part involves the division, matrix are stored in two dimensional array, and this matter? How to make the debug mode has become like the release?
Try can refer to these two articles (sorry I for a long time used vs, conditions did not build environment validation), said the main two points: (1) the compiler optimization level try to set up (2) the same floating point/fp option is set,
CodePudding user response:
Thank you very much, but I have set up or not, my wrong code here Void CKalman: : MeasUpdate (double fading=1.0) { Ek=Zk - (Hk * Xk); Pk Py0=Hk * * (Hk) ~; for(int i=0; i{ Hi=Hk. Chooserc (' R ', I); Select the ith row// Pk Pxz=* (~ Hi); Double Pzz=(* Pxz (Hi) (0)) + (fairly Rk (I, I)); ASSERT (Pzz!=0); Kk=Pxz * (1.0/Pzz); Xk=Xk + Kk * ((Zk) (I) - (* Xk (Hi) (0))); Pk=Pk - Kk * * Hi Pk. }
Beta=beta/(beta + b); If (fading> 1.0) Pk=Pk * fading; } This is the measurement update, which involves the matrix elements are double