benchmarkXcwise.cpp
Go to the documentation of this file.
00001 // g++ -O3 -DNDEBUG benchmarkX.cpp -o benchmarkX && time ./benchmarkX
00002 
00003 #include <iostream>
00004 #include <Eigen/Core>
00005 
00006 using namespace std;
00007 using namespace Eigen;
00008 
00009 #ifndef VECTYPE
00010 #define VECTYPE VectorXLd
00011 #endif
00012 
00013 #ifndef VECSIZE
00014 #define VECSIZE 1000000
00015 #endif
00016 
00017 #ifndef REPEAT
00018 #define REPEAT 1000
00019 #endif
00020 
00021 int main(int argc, char *argv[])
00022 {
00023         VECTYPE I = VECTYPE::Ones(VECSIZE);
00024         VECTYPE m(VECSIZE,1);
00025         for(int i = 0; i < VECSIZE; i++)
00026         {
00027                 m[i] = 0.1 * i/VECSIZE;
00028         }
00029         for(int a = 0; a < REPEAT; a++)
00030         {
00031                 m = VECTYPE::Ones(VECSIZE) + 0.00005 * (m.cwise().square() + m/4);
00032         }
00033         cout << m[0] << endl;
00034         return 0;
00035 }


re_vision
Author(s): Dorian Galvez-Lopez
autogenerated on Sun Jan 5 2014 11:30:47