diff --git a/triqs/gfs/imtime.hpp b/triqs/gfs/imtime.hpp index 3bd3f959..a78345d3 100644 --- a/triqs/gfs/imtime.hpp +++ b/triqs/gfs/imtime.hpp @@ -77,15 +77,14 @@ namespace triqs { namespace gfs { double beta = g->mesh().domain().beta; int p = std::floor(tau/beta); tau -= p*beta; - double a = tau/g->mesh().delta(); - long n = std::floor(a); - double w = a-n; - assert(n < g->mesh().size()-1); - auto _ = arrays::ellipsis(); + size_t n; double w; bool in; + std::tie(in, n, w) = windowing(g->mesh(),tau); + if (!in) TRIQS_RUNTIME_ERROR <<" Evaluation out of bounds"; + auto gg = on_mesh(*g); if ((g->mesh().domain().statistic == Fermion) && (p%2==1)) - _tmp = - w*g->data()(n, _) - (1-w)*g->data()(n+1, _); + _tmp = - (1-w)*gg(n) - w*gg(n+1); else - _tmp = w*g->data()(n, _) + (1-w)*g->data()(n+1, _); + _tmp = (1-w)*gg(n) + w*gg(n+1); //else { // Speed test to redo when incoparated qview in main branch // _tmp(0,0) = w*g->data()(n, 0,0) + (1-w)*g->data()(n+1, 0,0); // _tmp(0,1) = w*g->data()(n, 0,1) + (1-w)*g->data()(n+1, 0,1); diff --git a/triqs/gfs/meshes/linear.hpp b/triqs/gfs/meshes/linear.hpp index b2256764..d75834cc 100644 --- a/triqs/gfs/meshes/linear.hpp +++ b/triqs/gfs/meshes/linear.hpp @@ -193,7 +193,7 @@ namespace triqs { namespace gfs { template std::tuple windowing ( linear_mesh const & mesh, typename D::point_t const & x) { double a = (x - mesh.x_min())/mesh.delta(); - long i = floor(a); + long i = std::floor(a); bool in = (! ((i<0) || (i>long(mesh.size())-1))); double w = a-i; // std::cerr << " window "<< i << " "<< in << " "<< w<< std::endl ;