matrix: add method to check all values are nan (#82)

This commit is contained in:
Martina Rivizzigno
2019-08-26 19:27:58 +02:00
committed by Julian Kent
parent 84b3da227c
commit cc084e0791
2 changed files with 13 additions and 0 deletions
+11
View File
@@ -507,6 +507,17 @@ public:
return min_val;
}
bool isAllNan() const {
const Matrix<float, M, N> &self = *this;
bool result = true;
for (size_t i = 0; i < M; i++) {
for (size_t j = 0; j < N; j++) {
result = result && isnan(self(i, j));
}
}
return result;
}
};
template<typename Type, size_t M, size_t N>