diff --git a/matrix/Matrix.hpp b/matrix/Matrix.hpp index 22d26a8018..0172669a5b 100644 --- a/matrix/Matrix.hpp +++ b/matrix/Matrix.hpp @@ -587,9 +587,13 @@ Type min(const Type x, const Type y) { bool x_is_nan = isnan(x); bool y_is_nan = isnan(y); // z > nan for z != nan is required by C the standard - if(x_is_nan || y_is_nan) { - if(x_is_nan && !y_is_nan) return y; - if(!x_is_nan && y_is_nan) return x; + if (x_is_nan || y_is_nan) { + if (x_is_nan && !y_is_nan) { + return y; + } + if (!x_is_nan && y_is_nan) { + return x; + } return x; } return (x < y) ? x : y; @@ -599,16 +603,20 @@ Type max(const Type x, const Type y) { bool x_is_nan = isnan(x); bool y_is_nan = isnan(y); // z > nan for z != nan is required by C the standard - if(x_is_nan || y_is_nan) { - if(x_is_nan && !y_is_nan) return y; - if(!x_is_nan && y_is_nan) return x; + if (x_is_nan || y_is_nan) { + if (x_is_nan && !y_is_nan) { + return y; + } + if (!x_is_nan && y_is_nan) { + return x; + } return x; } return (x > y) ? x : y; } template Type constrain(const Type x, const Type lower_bound, const Type upper_bound) { - if(lower_bound > upper_bound) { + if (lower_bound > upper_bound) { return NAN; } else if(isnan(x)) { return NAN; @@ -677,7 +685,7 @@ Matrix constrain(const Matrix &x, const Type scalar_lower_bound, const Type scalar_upper_bound) { Matrix m; - if(scalar_lower_bound > scalar_upper_bound) { + if (scalar_lower_bound > scalar_upper_bound) { m.setNaN(); } else { for (size_t i = 0; i < M; i++) { diff --git a/matrix/SquareMatrix.hpp b/matrix/SquareMatrix.hpp index aaface6627..175a3e40a7 100644 --- a/matrix/SquareMatrix.hpp +++ b/matrix/SquareMatrix.hpp @@ -65,7 +65,7 @@ public: inline SquareMatrix I() const { SquareMatrix i; - if(inv(*this, i)) { + if (inv(*this, i)) { return i; } else { i.setZero(); @@ -289,7 +289,7 @@ template SquareMatrix inv(const SquareMatrix & A) { SquareMatrix i; - if(inv(A, i)) { + if (inv(A, i)) { return i; } else { i.setZero();