From ea0c5badb25c39fee1ec7e3c3b9d83c1916a8173 Mon Sep 17 00:00:00 2001 From: Stephane Del Pino <stephane.delpino44@gmail.com> Date: Thu, 25 Jul 2019 14:13:54 +0200 Subject: [PATCH] Remove useless test in determinant Also add a LCOV_EXCL_LINE marker. lcov produced a false negative probably due to a forced inline. --- src/algebra/TinyMatrix.hpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/algebra/TinyMatrix.hpp b/src/algebra/TinyMatrix.hpp index 38d8c2839..9ca3746c7 100644 --- a/src/algebra/TinyMatrix.hpp +++ b/src/algebra/TinyMatrix.hpp @@ -20,8 +20,7 @@ class TinyMatrix static_assert((N > 0), "TinyMatrix size must be strictly positive"); PUGS_FORCEINLINE - constexpr size_t - _index(const size_t& i, const size_t& j) const noexcept + constexpr size_t _index(const size_t& i, const size_t& j) const noexcept // LCOV_EXCL_LINE (due to forced inline) { return i * N + j; } @@ -343,9 +342,7 @@ det(const TinyMatrix<N, T>& A) determinent *= -1; } } - const size_t I = index[i]; - if (M(I, i) == 0) - return 0; + const size_t I = index[i]; const T inv_Mii = 1. / M(I, i); for (size_t k = i + 1; k < N; ++k) { const size_t K = index[k]; -- GitLab