diff --git a/src/algebra/TinyMatrix.hpp b/src/algebra/TinyMatrix.hpp index c92a2855dfe968c1f56145cee00559708c1eefbf..bc64d550979c76055c2669b0555679daa5d351b5 100644 --- a/src/algebra/TinyMatrix.hpp +++ b/src/algebra/TinyMatrix.hpp @@ -121,19 +121,16 @@ class [[nodiscard]] TinyMatrix PUGS_INLINE constexpr friend std::ostream& operator<<(std::ostream& os, const TinyMatrix& A) { - if constexpr (N == 1) { - os << A(0, 0); - } else { - os << '['; - for (size_t i = 0; i < N; ++i) { - os << '(' << A(i, 0); - for (size_t j = 1; j < N; ++j) { - os << ',' << A(i, j); - } - os << ')'; + os << '['; + for (size_t i = 0; i < N; ++i) { + os << '(' << A(i, 0); + for (size_t j = 1; j < N; ++j) { + os << ',' << A(i, j); } - os << ']'; + os << ')'; } + os << ']'; + return os; } diff --git a/tests/test_TinyMatrix.cpp b/tests/test_TinyMatrix.cpp index 40ef0f50b24afc4860d057fba3eb36978df19bc8..ca5a12fbddb68e01324158c14ef42546b27ddec1 100644 --- a/tests/test_TinyMatrix.cpp +++ b/tests/test_TinyMatrix.cpp @@ -220,7 +220,7 @@ TEST_CASE("TinyMatrix", "[algebra]") SECTION("checking for matrices output") { REQUIRE(Catch::Detail::stringify(A) == "[(1,2,3)(4,5,6)(7,8,9)]"); - REQUIRE(Catch::Detail::stringify(TinyMatrix<1, int>(7)) == "7"); + REQUIRE(Catch::Detail::stringify(TinyMatrix<1, int>(7)) == "[(7)]"); } #ifndef NDEBUG