aboutsummaryrefslogtreecommitdiffhomepage
path: root/bench/benchmarkX.cpp
blob: 89452b435e841fc5ab4b7a6c32ca34cec98e1544 (plain)
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
// g++ -fopenmp -I .. -O3 -DNDEBUG -finline-limit=1000 benchmarkX.cpp -o b && time ./b
#include <Eigen/Core>

using namespace std;
using namespace Eigen;

#ifndef MATTYPE
#define MATTYPE MatrixXLd
#endif

#ifndef MATSIZE
#define MATSIZE 400
#endif

#ifndef REPEAT
#define REPEAT 100
#endif

int main(int argc, char *argv[])
{
	MATTYPE I = MATTYPE::Ones(MATSIZE,MATSIZE);
	MATTYPE m(MATSIZE,MATSIZE);
	for(int i = 0; i < MATSIZE; i++) for(int j = 0; j < MATSIZE; j++)
	{
		m(i,j) = (i+j+1)/(MATSIZE*MATSIZE);
	}
	for(int a = 0; a < REPEAT; a++)
	{
		m = I + 0.0001 * (m + m*m);
	}
	cout << m(0,0) << endl;
	return 0;
}