mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 16:48:52 +08:00
Matrix: print full matrix already if only one element is not symmetric
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
This commit is contained in:
committed by
Daniel Agar
parent
8ad93464c7
commit
5dd76332ba
@@ -402,6 +402,7 @@ public:
|
||||
}
|
||||
|
||||
const Matrix<Type, M, N> &self = *this;
|
||||
bool is_prev_symmetric = true; // assume symmetric until one element is not
|
||||
|
||||
for (unsigned i = 0; i < M; i++) {
|
||||
printf("%2u|", i); // print row numbering
|
||||
@@ -410,7 +411,7 @@ public:
|
||||
double d = static_cast<double>(self(i, j));
|
||||
|
||||
// if symmetric don't print upper triangular elements
|
||||
if ((M == N) && (j > i) && (i < N) && (j < M)
|
||||
if (is_prev_symmetric && (M == N) && (j > i) && (i < N) && (j < M)
|
||||
&& (fabs(d - static_cast<double>(self(j, i))) < (double)eps)
|
||||
) {
|
||||
// print empty space
|
||||
@@ -428,6 +429,8 @@ public:
|
||||
} else {
|
||||
printf("% 6.5f ", d);
|
||||
}
|
||||
|
||||
is_prev_symmetric = false; // not symmetric if once inside here
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user