Skip to content
Snippets Groups Projects
Commit 02896fda authored by Stéphane Del Pino's avatar Stéphane Del Pino
Browse files

Remove the special case for TinyMatrix<1> output for consistency

It has now the same behavior as TinyVector
parent 206752a2
No related branches found
No related tags found
1 merge request!71Feature/language tiny matrices
...@@ -121,9 +121,6 @@ class [[nodiscard]] TinyMatrix ...@@ -121,9 +121,6 @@ class [[nodiscard]] TinyMatrix
PUGS_INLINE PUGS_INLINE
constexpr friend std::ostream& operator<<(std::ostream& os, const TinyMatrix& A) constexpr friend std::ostream& operator<<(std::ostream& os, const TinyMatrix& A)
{ {
if constexpr (N == 1) {
os << A(0, 0);
} else {
os << '['; os << '[';
for (size_t i = 0; i < N; ++i) { for (size_t i = 0; i < N; ++i) {
os << '(' << A(i, 0); os << '(' << A(i, 0);
...@@ -133,7 +130,7 @@ class [[nodiscard]] TinyMatrix ...@@ -133,7 +130,7 @@ class [[nodiscard]] TinyMatrix
os << ')'; os << ')';
} }
os << ']'; os << ']';
}
return os; return os;
} }
......
...@@ -220,7 +220,7 @@ TEST_CASE("TinyMatrix", "[algebra]") ...@@ -220,7 +220,7 @@ TEST_CASE("TinyMatrix", "[algebra]")
SECTION("checking for matrices output") SECTION("checking for matrices output")
{ {
REQUIRE(Catch::Detail::stringify(A) == "[(1,2,3)(4,5,6)(7,8,9)]"); 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 #ifndef NDEBUG
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment