2013-10-16 23:55:26 +02:00
|
|
|
#define TRIQS_ARRAYS_ENFORCE_BOUNDCHECK
|
2014-09-05 13:26:21 +02:00
|
|
|
|
|
|
|
//#define TRIQS_ARRAYS_CHECK_WEAK_REFS
|
|
|
|
|
|
|
|
#include <triqs/gfs.hpp>
|
2013-10-16 23:55:26 +02:00
|
|
|
using namespace triqs::gfs;
|
|
|
|
using namespace triqs::arrays;
|
2014-09-05 13:26:21 +02:00
|
|
|
#define TEST(X) std::cout << BOOST_PP_STRINGIZE((X)) << " ---> " << (X) << std::endl << std::endl;
|
|
|
|
#include <triqs/gfs/local/functions.hpp>
|
2013-07-17 19:24:07 +02:00
|
|
|
|
|
|
|
const int nl_interne = 1000;
|
|
|
|
const int N = 1000;
|
|
|
|
|
|
|
|
typedef double VALUE_TYPE;
|
2014-09-05 13:26:21 +02:00
|
|
|
// typedef int VALUE_TYPE;
|
|
|
|
// inline VALUE_TYPE fnt(size_t i) { return i*(i+2.0)*(i-8.0);}
|
|
|
|
inline VALUE_TYPE fnt(size_t i) { return i; } //*(i+2.0)*(i-8);}
|
|
|
|
// inline VALUE_TYPE fnt(size_t i) { return i*(i+2.0)*(i-8);}
|
2013-07-17 19:24:07 +02:00
|
|
|
|
2014-09-05 13:26:21 +02:00
|
|
|
struct with_g {
|
2013-07-17 19:24:07 +02:00
|
|
|
void operator()() {
|
|
|
|
|
2014-09-05 13:26:21 +02:00
|
|
|
double beta = 1;
|
|
|
|
auto G = gf<imfreq>{{beta, Fermion, N}, {2, 2}};
|
|
|
|
G() = 0;
|
2013-07-17 19:24:07 +02:00
|
|
|
|
2014-09-05 13:26:21 +02:00
|
|
|
for (int u = 0; u < nl_interne; ++u)
|
|
|
|
// for (int i =0; i<N-1; ++i) G.on_mesh(i)(0,0) = fnt(i);
|
|
|
|
for (int i = 0; i < N - 1; ++i) G[i](0, 0) = fnt(i);
|
2013-07-17 19:24:07 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct array_code {
|
|
|
|
void operator()() {
|
|
|
|
|
2014-09-05 13:26:21 +02:00
|
|
|
double beta = 1;
|
|
|
|
auto G = gf<imfreq>{{beta, Fermion, N}, {2, 2}};
|
|
|
|
G() = 0;
|
|
|
|
auto V = G.data();
|
2013-07-17 19:24:07 +02:00
|
|
|
|
2014-09-05 13:26:21 +02:00
|
|
|
for (int u = 0; u < nl_interne; ++u)
|
|
|
|
for (int i = 0; i < N - 1; ++i) V(i, 0, 0) = fnt(i);
|
2013-07-17 19:24:07 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "./speed_tester.hpp"
|
|
|
|
int main() {
|
2014-09-05 13:26:21 +02:00
|
|
|
try {
|
|
|
|
speed_tester<array_code>(100);
|
|
|
|
speed_tester<with_g>(100);
|
2013-10-16 23:55:26 +02:00
|
|
|
}
|
|
|
|
TRIQS_CATCH_AND_ABORT;
|
2013-07-17 19:24:07 +02:00
|
|
|
}
|
|
|
|
|