eigen/doc/benchmark.cpp
Benoit Jacob 89a134ba0b big architecture change dissociating "actual" dimensions from "maximum possible"
dimension. The advantage is that evaluating a dynamic-sized block in a fixed-size
matrix no longer causes a dynamic memory allocation. Other new thing:
IntAtRunTimeIfDynamic allows storing an integer at zero cost if it is known at
compile time.
2008-01-13 19:55:23 +00:00

24 lines
410 B
C++

// g++ -O3 -DNDEBUG benchmark.cpp -o benchmark && time ./benchmark
#include <Eigen/Core>
using namespace std;
USING_PART_OF_NAMESPACE_EIGEN
int main(int argc, char *argv[])
{
Matrix3d I;
Matrix3d m;
for(int i = 0; i < 3; i++) for(int j = 0; j < 3; j++)
{
I(i,j) = (i==j);
m(i,j) = (i+3*j);
}
for(int a = 0; a < 400000000; a++)
{
m = I + 0.00005 * (m + m*m);
}
cout << m << endl;
return 0;
}