reduce float warnings (comparisons and implicit conversions)

This commit is contained in:
Erik Schultheis
2022-01-26 18:16:19 +00:00
committed by Rasmus Munk Larsen
parent 51311ec651
commit d271a7d545
41 changed files with 152 additions and 133 deletions

View File

@@ -13,24 +13,20 @@
template<typename MatrixType>
bool equalsIdentity(const MatrixType& A)
{
typedef typename MatrixType::Scalar Scalar;
Scalar zero = static_cast<Scalar>(0);
bool offDiagOK = true;
for (Index i = 0; i < A.rows(); ++i) {
for (Index j = i+1; j < A.cols(); ++j) {
offDiagOK = offDiagOK && (A(i,j) == zero);
offDiagOK = offDiagOK && numext::is_exactly_zero(A(i, j));
}
}
for (Index i = 0; i < A.rows(); ++i) {
for (Index j = 0; j < (std::min)(i, A.cols()); ++j) {
offDiagOK = offDiagOK && (A(i,j) == zero);
offDiagOK = offDiagOK && numext::is_exactly_zero(A(i, j));
}
}
bool diagOK = (A.diagonal().array() == 1).all();
return offDiagOK && diagOK;
}
template<typename VectorType>