-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
54 lines (43 loc) · 943 Bytes
/
main.cpp
File metadata and controls
54 lines (43 loc) · 943 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#include <iostream>
#include <random>
#include "matrix.hpp"
void fillRandomValues(Matrix &A)
{
std::random_device rD;
std::mt19937 gen(rD());
std::uniform_real_distribution<> dist(-1.0, 1.0);
for (int i = 0; i < A.getRows(); i++) {
for (int j = 0; j < A.getCols(); j++) {
A.setValue(i, j, dist(gen));
}
}
}
#if 0
void printMatrix(Matrix &A)
{
std::cout << "Matrix [" << A.getRows() << " x " << A.getCols() << "] :" << std::endl;
for (int i = 0; i < A.getRows(); i++) {
for (int j = 0; j < A.getCols(); j++) {
std::cout << A(i, j) << " ";
}
std::cout << std::endl;
}
}
#endif
int main (int argc, char **argv)
{
// Matrix A(5, 10);
// Matrix B(10, 4);
//Matrix C(5, 4);
Matrix A(5, 5);
Matrix B(5, 5);
Matrix C(5, 5);
// fillRandomValues(A);
// fillRandomValues(B);
A.setIdentity();
B.setIdentity();
C = 2.0*A*B + A;
//printMatrix(C);
C.printMatrix();
return 0;
}