eigen/bench/benchmarkXcwise.cpp
Benoit Jacob ab4046970b * Add fixed-size template versions of corner(), start(), end().
* Use them to write an unrolled path in echelon.cpp, as an
  experiment before I do this LU module.
* For floating-point types, make ei_random() use an amplitude
  of 1.
2008-04-12 17:37:27 +00:00

35 lines
640 B
C++

// g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX
#include <Eigen/Core>
using namespace std;
USING_PART_OF_NAMESPACE_EIGEN
#ifndef MATTYPE
#define MATTYPE MatrixXLd
#endif
#ifndef MATSIZE
#define MATSIZE 1000000
#endif
#ifndef REPEAT
#define REPEAT 1000
#endif
int main(int argc, char *argv[])
{
MATTYPE I = MATTYPE::ones(MATSIZE,1);
MATTYPE m(MATSIZE,1);
for(int i = 0; i < MATSIZE; i++) for(int j = 0; j < 1; j++)
{
m(i,j) = 0.1 * (i+j+1)/MATSIZE/MATSIZE;
}
for(int a = 0; a < REPEAT; a++)
{
m = MATTYPE::ones(MATSIZE,1) + 0.00005 * (m.cwiseProduct(m) + m/4);
}
cout << m(0,0) << endl;
return 0;
}