From 034a5fddfb292f22659f293d72ceb576f5c61d82 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Thu, 3 Aug 2023 16:18:00 +0200 Subject: A5: code complete --- a5/imatrix.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'a5/imatrix.h') diff --git a/a5/imatrix.h b/a5/imatrix.h index f96cb0c..b13f60d 100644 --- a/a5/imatrix.h +++ b/a5/imatrix.h @@ -119,7 +119,7 @@ public: out.m(i,j) = 0; for(std::size_t k = 0; k < other.w; ++k) { - out.m(i,j) += m(i, j) * other.m(k, j); + out.m(i,j) += m(i,k) * other.m(k,j); } } } @@ -147,7 +147,7 @@ public: out.m(i,j) = 0; for(std::size_t k = 0; k < other.w; ++k) { - out.m(i,j) += m(i, j) / other.m(k, j); + out.m(i,j) += m(i,k) / other.m(k,j); } } } @@ -201,4 +201,6 @@ private: std::valarray data; // default initialized to empty std::size_t w{}; // default initialized to 0 std::size_t h{}; // default initialized to 0 + + friend std::ostream& operator<<(std::ostream& s, const Imatrix& m); }; -- cgit v1.2.3