AP_Math: Matrix: Change deallocator to match allocator used

This commit is contained in:
Murilo Belluzzo 2016-08-02 18:15:01 -03:00 committed by Lucas De Marchi
parent e17fdb2aa9
commit 70942472d3

View File

@ -177,7 +177,7 @@ static void mat_LU_decompose(float* A, float* L, float* U, float *P, uint8_t n)
} }
} }
} }
free(APrime); delete[] APrime;
} }
/* /*
@ -208,8 +208,8 @@ static bool mat_inverse(float* A, float* inv, uint8_t n)
mat_back_sub(U,U_inv,n); mat_back_sub(U,U_inv,n);
// decomposed matrices no longer required // decomposed matrices no longer required
free(L); delete[] L;
free(U); delete[] U;
float *inv_unpivoted = mat_mul(U_inv,L_inv,n); float *inv_unpivoted = mat_mul(U_inv,L_inv,n);
float *inv_pivoted = mat_mul(inv_unpivoted, P, n); float *inv_pivoted = mat_mul(inv_unpivoted, P, n);
@ -225,11 +225,11 @@ static bool mat_inverse(float* A, float* inv, uint8_t n)
memcpy(inv,inv_pivoted,n*n*sizeof(float)); memcpy(inv,inv_pivoted,n*n*sizeof(float));
//free memory //free memory
free(inv_pivoted); delete[] inv_pivoted;
free(inv_unpivoted); delete[] inv_unpivoted;
free(P); delete[] P;
free(U_inv); delete[] U_inv;
free(L_inv); delete[] L_inv;
return ret; return ret;
} }