1 // g++ -O3 -DNDEBUG -DMATSIZE=<x> benchmark.cpp -o benchmark && time ./benchmark
12 using namespace Eigen
;
15 #define REPEAT 40000000
22 int main(int argc
, char *argv
[])
24 Matrix
<SCALAR
,MATSIZE
,MATSIZE
> I
= Matrix
<SCALAR
,MATSIZE
,MATSIZE
>::Ones();
25 Matrix
<SCALAR
,MATSIZE
,MATSIZE
> m
;
26 for(int i
= 0; i
< MATSIZE
; i
++)
27 for(int j
= 0; j
< MATSIZE
; j
++)
29 m(i
,j
) = (i
+MATSIZE
*j
);
32 for(int a
= 0; a
< REPEAT
; a
++)
34 m
= Matrix
<SCALAR
,MATSIZE
,MATSIZE
>::Ones() + 0.00005 * (m
+ (m
*m
));