Quatnion update in EKF

Hello @Paul_Riseborough,

  Recently, I saw that delQuat and qNew in https://github.com/priseborough/InertialNav/blob/master/derivations/GenerateEquations22states.m -->#94~#100.   And  I found deltaQuat[0-3] and qUpdated[0-3]  in https://github.com/ArduPilot/PX4Firmware/blob/master/src/modules/ekf_att_pos_estimator/estimator_22states.cpp -->#295~#307.

I thought that the .m file and .cpp are equal, espectially qUpdated=qNew and deltaQuat=delQuat. I can understand .m file, but I don't understand .cpp file , because the deltaQuat ≠ delQuat., I find  the rotationMag in https://github.com/ArduPilot/PX4Firmware/blob/master/src/modules/ekf_att_pos_estimator/estimator_22states.cpp #281....

Is it that deltaQuat[0-3] in .cpp file is optimized on the basis of the delQuat in .m file???