Skip to content
This repository has been archived by the owner on Nov 17, 2021. It is now read-only.

Commit

Permalink
Fix unit test, create matrix isfinite.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgoppert committed Feb 3, 2017
1 parent 7e3eff7 commit 230e847
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
6 changes: 3 additions & 3 deletions matrix/SquareMatrix.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ bool inv(const SquareMatrix<Type, M> & A, SquareMatrix<Type, M> & inv)
}

//check sanity of results
for (uint8_t i = 0; i < M; i++) {
for (uint8_t j = 0; j < M; j++) {
if (!PX4_ISFINITE(P(i,j))) {
for (size_t i = 0; i < M; i++) {
for (size_t j = 0; j < M; j++) {
if (!isfinite(P(i,j))) {
return false;
}
}
Expand Down
13 changes: 9 additions & 4 deletions matrix/helper_functions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@ namespace matrix
{

template<typename Type>
Type wrap_pi(Type x)
{
bool isfinite(Type x) {
#if defined (__PX4_NUTTX) || defined (__PX4_QURT)
if (!isfinite(x)) {
return PX4_ISFINITE(x);
#else
if (!std::isfinite(x)) {
return std::isfinite(x);
#endif
}

template<typename Type>
Type wrap_pi(Type x)
{
if (!isfinite(x)) {
return x;
}

Expand Down

0 comments on commit 230e847

Please sign in to comment.