Skip to content

Commit 0f8a6aa

Browse files
authored
Use array instead of vector in Matrix (#280)
1 parent bbfaefb commit 0f8a6aa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

content/data-structures/Matrix.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Description: Basic operations on square matrices.
77
* Usage: Matrix<int, 3> A;
88
* A.d = {{{{1,2,3}}, {{4,5,6}}, {{7,8,9}}}};
9-
* vector<int> vec = {1,2,3};
9+
* array<int, 3> vec = {1,2,3};
1010
* vec = (A^N) * vec;
1111
* Status: tested
1212
*/
@@ -21,8 +21,8 @@ template<class T, int N> struct Matrix {
2121
rep(k,0,N) a.d[i][j] += d[i][k]*m.d[k][j];
2222
return a;
2323
}
24-
vector<T> operator*(const vector<T>& vec) const {
25-
vector<T> ret(N);
24+
array<T, N> operator*(const array<T, N>& vec) const {
25+
array<T, N> ret{};
2626
rep(i,0,N) rep(j,0,N) ret[i] += d[i][j] * vec[j];
2727
return ret;
2828
}

0 commit comments

Comments
 (0)