From 48756560ef5293761d3ccad191e6c4dcb33b3eb6 Mon Sep 17 00:00:00 2001 From: Luke Videckis Date: Sun, 1 Dec 2024 04:25:27 -0600 Subject: [PATCH] Use array instead of vector in Matrix (#280) --- content/data-structures/Matrix.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/content/data-structures/Matrix.h b/content/data-structures/Matrix.h index 642ef7ace..d5ee1f35b 100644 --- a/content/data-structures/Matrix.h +++ b/content/data-structures/Matrix.h @@ -6,7 +6,7 @@ * Description: Basic operations on square matrices. * Usage: Matrix A; * A.d = {{{{1,2,3}}, {{4,5,6}}, {{7,8,9}}}}; - * vector vec = {1,2,3}; + * array vec = {1,2,3}; * vec = (A^N) * vec; * Status: tested */ @@ -21,8 +21,8 @@ template struct Matrix { rep(k,0,N) a.d[i][j] += d[i][k]*m.d[k][j]; return a; } - vector operator*(const vector& vec) const { - vector ret(N); + array operator*(const array& vec) const { + array ret{}; rep(i,0,N) rep(j,0,N) ret[i] += d[i][j] * vec[j]; return ret; }