-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
28 lines (24 loc) · 737 Bytes
/
test.cpp
File metadata and controls
28 lines (24 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <cstdio>
#include <cmath>
#include "Matrix.hpp"
int main(void) {
Matrix<int> mat(4,4);
mat(0,0)=3; mat(0,1)=1; mat(0,2)=1; mat(0,3)=2;
mat(1,0)=5; mat(1,1)=1; mat(1,2)=3; mat(1,3)=4;
mat(2,0)=2; mat(2,1)=0; mat(2,2)=1; mat(2,3)=0;
mat(3,0)=1; mat(3,1)=3; mat(3,2)=2; mat(3,3)=1;
puts("mat");
for (unsigned int i = 0; i < mat.row_size(); i++) {
for (unsigned int j = 0; j < mat.col_size(); j++)
printf("%5d ", mat(i,j));
puts("");
}
mat = mat * 2;
puts("mat * 2");
for (unsigned int i = 0; i < mat.row_size(); i++) {
for (unsigned int j = 0; j < mat.col_size(); j++)
printf("%5d ", mat(i,j));
puts("");
}
return 0;
}