forked from Archive/PX4-Autopilot
matrix: adjust printing for if symmetric (lower triangular only)
This commit is contained in:
parent
64f28c4c07
commit
c3ae7b28c0
|
@ -365,7 +365,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void print(float eps = 0.00001f) const
|
||||
void print(float eps = 1e-9) const
|
||||
{
|
||||
// print column numbering
|
||||
if (N > 1) {
|
||||
|
@ -393,6 +393,14 @@ public:
|
|||
printf("\033[1m");
|
||||
}
|
||||
|
||||
// if symmetric don't print upper triangular elements
|
||||
if ((M == N) && (j > i) && (i < N) && (j < M)
|
||||
&& (fabs(d - static_cast<double>(self(j, i))) < (double)eps)
|
||||
) {
|
||||
// print empty space
|
||||
printf(" ");
|
||||
|
||||
} else {
|
||||
// avoid -0.0 for display
|
||||
if (fabs(d - 0.0) < (double)eps) {
|
||||
// print fixed width zero
|
||||
|
@ -404,6 +412,7 @@ public:
|
|||
} else {
|
||||
printf("% 6.5f ", d);
|
||||
}
|
||||
}
|
||||
|
||||
// Matrix diagonal elements
|
||||
if (N > 1 && M > 1 && i == j) {
|
||||
|
|
Loading…
Reference in New Issue