mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 04:03:34 +08:00
define FLT_EPSILON; be descriptive about upper_right_triangle() method
This commit is contained in:
@@ -66,8 +66,8 @@ public:
|
||||
return res;
|
||||
}
|
||||
|
||||
// get matrix upper right triangle
|
||||
Vector<Type, M * (M + 1) / 2> urt() const
|
||||
// get matrix upper right triangle in a row-major vector format
|
||||
Vector<Type, M * (M + 1) / 2> upper_right_triangle() const
|
||||
{
|
||||
Vector<Type, M * (M + 1) / 2> res;
|
||||
const SquareMatrix<Type, M> &self = *this;
|
||||
@@ -149,7 +149,7 @@ bool inv(const SquareMatrix<Type, M> & A, SquareMatrix<Type, M> & inv)
|
||||
for (size_t n = 0; n < M; n++) {
|
||||
|
||||
// if diagonal is zero, swap with row below
|
||||
if (fabs(static_cast<float>(U(n, n))) < __FLT_EPSILON__) {
|
||||
if (fabs(static_cast<float>(U(n, n))) < FLT_EPSILON) {
|
||||
//printf("trying pivot for row %d\n",n);
|
||||
for (size_t i = n + 1; i < M; i++) {
|
||||
|
||||
@@ -174,7 +174,7 @@ bool inv(const SquareMatrix<Type, M> & A, SquareMatrix<Type, M> & inv)
|
||||
#endif
|
||||
|
||||
// failsafe, return zero matrix
|
||||
if (fabs(static_cast<float>(U(n, n))) < __FLT_EPSILON__) {
|
||||
if (fabs(static_cast<float>(U(n, n))) < FLT_EPSILON) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
|
||||
namespace matrix {
|
||||
|
||||
#if !defined(FLT_EPSILON)
|
||||
#define FLT_EPSILON __FLT_EPSILON__
|
||||
#endif
|
||||
|
||||
#if defined(__PX4_NUTTX)
|
||||
/*
|
||||
* NuttX has no usable C++ math library, so we need to provide the needed definitions here manually.
|
||||
|
||||
Reference in New Issue
Block a user