-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherror.cpp
35 lines (28 loc) · 927 Bytes
/
error.cpp
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
#include <iostream>
#include <fstream>
using namespace std;
// n = (192, 384, 576, 768, 960)
constexpr int n = 192;
int main()
{
fstream stdfile, copfile;
stdfile.open("naive_matrix/matrix_out_n576", ios::in);
//copfile.open("blocked_matrix/blocked_matrix_out_n576", ios::in);
//copfile.open("vector_matrix/vector_matrix_out_n960", ios::in);
copfile.open("vector_matrixV2/vector_matrix_out_n576", ios::in);
//copfile.open("blocked_cache_matrix/blocked_cache_matrix_out_n192", ios::in);
//copfile.open("blocked_cache_matrixV2/blocked_cache_matrix_out_n960", ios::in);
double avgerr = 0, maxerr = 0, stdans = 0, ans = 0;
for (int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j)
{
stdfile >> stdans;
copfile >> ans;
maxerr = max(maxerr, abs(stdans - ans));
avgerr += abs(stdans - ans);
}
avgerr /= n*n;
cout << "maxerr: " << maxerr << '\n';
cout << "avgerr: " << avgerr << '\n';
return 0;
}