3
0
mirror of https://github.com/triqs/dft_tools synced 2024-10-31 19:23:45 +01:00
dft_tools/test/speed/isol_array_foreach_pb.cpp
Olivier Parcollet f2c7d449cc First commit : triqs libs version 1.0 alpha1
for earlier commits, see TRIQS0.x repository.
2013-07-17 19:24:07 +02:00

25 lines
471 B
C++

#include <iostream>
void f (int * p,int i, int j, int val) { p[ i + 200*j] += val;}
int N1 = 200, N2 = 300;
int main() {
int * p = new int [ 200*300];
int t[2];
#ifdef STATIC
const int u[2] = {1,0};
#else
int u[2]; for (int i=0; i<2; ++i) u[i] = 1-i;
#endif
for (int k =0; k<500000; ++k)
for (t[u[0]]=0; t[u[0]]<N2; ++t[u[0]])
for (t[u[1]] =0; t[u[1]]<N1; ++t[u[1]])
f(p,t[u[1]],t[u[0]] , 1 );
std::cout<< " p[5] = " << p[5]<<std::endl ;
}