/******************************************************************************* * * TRIQS: a Toolbox for Research in Interacting Quantum Systems * * Copyright (C) 2011 by O. Parcollet * * TRIQS is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. * * TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * TRIQS. If not, see . * ******************************************************************************/ #include #include using namespace triqs::arrays; using namespace triqs; const int N1= 200, N2 = 300; namespace tqa=triqs::arrays; namespace tql=triqs::clef; struct plain { void operator()() { triqs::arrays::array A (N1,N2,FORTRAN_LAYOUT); for (int u =0; u<5000; ++u) { for (int j=0; j i_; tql::placeholder<1> j_; triqs::arrays::array A (N1,N2,FORTRAN_LAYOUT); for (int u =0; u<5000; ++u) A(i_,j_) << i_+ 2*j_; } }; struct foreach_lambda { void operator()() { triqs::arrays::array A (N1,N2,FORTRAN_LAYOUT); for (int u =0; u<5000; ++u) //assign_foreach(A, [](size_t i, size_t j) { return i + 2.0*j;}); assign_foreach(A, [](long i, long j) { return i + 2.0*j;}); } }; #include "./speed_tester.hpp" int main() { const int l = 100; speed_tester (l); speed_tester (l); speed_tester (l); return 0; }