diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2014-09-20 12:46:28 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2014-09-20 12:46:28 -0400 |
commit | 3a72d2085795dd87fbd6a15f8dd06f32794616b7 (patch) | |
tree | 9390ddc0db3b9379f93a6e04725242eb20a7d210 | |
parent | a90472a1caf5b871792c5a568ee3d0b389a47643 (diff) | |
download | gpsd-3a72d2085795dd87fbd6a15f8dd06f32794616b7.tar.gz |
Check for vanishing determunant in the tests.
-rw-r--r-- | test_matrix.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/test_matrix.c b/test_matrix.c index 0f8f17d1..2548db1d 100644 --- a/test_matrix.c +++ b/test_matrix.c @@ -33,6 +33,13 @@ static struct { .mat = {{10,0,0,0}, {0,10,0,0}, {0,0,10,0}, {0,0,0,10}}, .inv = {{0.1,0,0,0}, {0,0.1,0,0}, {0,0,0.1,0}, {0,0,0,0.1}}, }, +#ifdef __UNUSED__ + /* random values */ + { + .mat = {{1,-1,-1,0}, {1,-2,3,0}, {1,1,4,0}, {0,0,10}}, + .inv = {{0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}}, + }, +#endif /* __UNUSED__ */ }; static void dump(const char *label, double m[4][4]) @@ -70,7 +77,9 @@ int main(int argc UNUSED, char *argv[] UNUSED) for (i = 0; i < sizeof(inverses) / sizeof(inverses[0]); i++) { double inverse[4][4]; - matrix_invert(inverses[i].mat, inverse); + if (!matrix_invert(inverses[i].mat, inverse)) { + printf("Vanishing determinant in test %zd\n", i); + } if (!check_diag(i, inverse, inverses[i].inv)) break; } |