forked from MolSSI-Education/MM_2017_SSS_Team2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
matrix_make.cpp
59 lines (50 loc) · 1.63 KB
/
matrix_make.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <lawrap/blas.h>
using namespace std;
//void read_file(cost std::string &filename, double* matrix) {
//}
int main()
{ std::vector<double> mat(49);
std::vector<double>mat_s(49);
std::vector<double>mat_ds(49);
std::vector<double> D(49);
std::vector<double>D_new(49);
// for (int i = 0; i < 49; i++);
std::ifstream stream1("C.data");
std::ifstream stream2("S.data");
std::ifstream stream3("D.data");
if(!stream1)
{
cout << "While opening a file an error is encountered" << endl;
}
else
{
for (int i = 0; i <49; i++)
{
stream1 >> mat[i];
stream2 >> mat_s[i];
stream3 >> D_new[i];
}
}
{
for (int k = 0; k <49; k++)
cout << mat[k] << endl;
}
LAWrap :: gemm('T','N',7,7,5,2,(double* )mat.data(),7,(double* )mat.data(),7,0.0,(double* )D.data(),7);
LAWrap :: gemm('N','N',7,7,7,1,(double*)D.data(),7,(double*)mat_s.data(),7,0.0,(double*)mat_ds.data(),7);
{
for (int m = 0; m <49; m++)
cout << D[m] << endl;
}
double trace=0;
for (int k = 0; k < 49; k+=8)
{
trace += mat_ds[k];
// cout << trace << " "<< mat_ds[k]<< " "<< k <<endl;
}
cout << trace << endl;
return 0 ;
}