diff --git a/matrix/Matrix.hpp b/matrix/Matrix.hpp index d7e57e37ef..bc9dbfc7a5 100644 --- a/matrix/Matrix.hpp +++ b/matrix/Matrix.hpp @@ -605,7 +605,7 @@ Matrix operator*(Type scalar, const Matrix &other) template bool isEqual(const Matrix &x, - const Matrix &y, const Type eps=1e-4f) { + const Matrix &y, const Type eps=Type(1e-4f)) { for (size_t i = 0; i < M; i++) { for (size_t j = 0; j < N; j++) { if (!isEqualF(x(i,j), y(i,j), eps)) { diff --git a/matrix/SquareMatrix.hpp b/matrix/SquareMatrix.hpp index ba2721879b..827eb497b0 100644 --- a/matrix/SquareMatrix.hpp +++ b/matrix/SquareMatrix.hpp @@ -223,7 +223,7 @@ public: // checks if block diagonal is symmetric template - bool isBlockSymmetric(size_t first, const Type eps = 1e-8f) + bool isBlockSymmetric(size_t first, const Type eps = Type(1e-8f)) { static_assert(Width <= M, "Width bigger than matrix"); assert(first + Width <= M); @@ -243,7 +243,7 @@ public: // checks if rows and columns are symmetric template - bool isRowColSymmetric(size_t first, const Type eps = 1e-8f) + bool isRowColSymmetric(size_t first, const Type eps = Type(1e-8f)) { static_assert(Width <= M, "Width bigger than matrix"); assert(first + Width <= M); @@ -324,7 +324,7 @@ bool inv(const SquareMatrix & A, SquareMatrix & inv, size_t ra for (size_t i = n + 1; i < rank; i++) { //printf("\ttrying row %d\n",i); - if (fabs(static_cast(U(i, n))) > 1e-8f) { + if (fabs(static_cast(U(i, n))) > Type(1e-8f)) { //printf("swapped %d\n",i); U.swapRows(i, n); P.swapRows(i, n); diff --git a/matrix/helper_functions.hpp b/matrix/helper_functions.hpp index 37d2191f94..191ff12228 100644 --- a/matrix/helper_functions.hpp +++ b/matrix/helper_functions.hpp @@ -32,7 +32,7 @@ bool is_finite(Type x) { * @return true if the two values are considered equal, false otherwise */ template -bool isEqualF(const Type x, const Type y, const Type eps = 1e-4f) +bool isEqualF(const Type x, const Type y, const Type eps = Type(1e-4f)) { return (matrix::fabs(x - y) <= eps) || (isnan(x) && isnan(y))