EKF: Eliminate use of power function to square numbers

Use of the power function to square a number can be very inefficient depending on processor and compiler. Replace with an inlined function  that multiplies the number by itself. This has not been put into the maths library because the use of the sq() function is peculiar to the autocode generated for the EKF and an inlined function was desired.
This commit is contained in:
Paul Riseborough
2016-02-08 11:11:59 +11:00
parent 42a943b37e
commit 2c8c6efb45
2 changed files with 6 additions and 4 deletions
-2
View File
@@ -44,8 +44,6 @@
#include <math.h>
#include <mathlib/mathlib.h>
#define sq(_arg) powf(_arg, 2.0f)
void Ekf::initialiseCovariance()
{
for (unsigned i = 0; i < _k_num_states; i++) {