From 7693077b792ea748f493e272f7b727fcd23eb56a Mon Sep 17 00:00:00 2001 From: Laura Messio Date: Mon, 30 Sep 2013 15:45:16 +0200 Subject: [PATCH] gf: Fix out of bound in linear mesh in gf eval. - When reaching the last point of the grid, move one step back and set w =1. - fix the gf_2times but and related issues. --- triqs/gfs/meshes/linear.hpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/triqs/gfs/meshes/linear.hpp b/triqs/gfs/meshes/linear.hpp index 18bc28bc..6f59c062 100644 --- a/triqs/gfs/meshes/linear.hpp +++ b/triqs/gfs/meshes/linear.hpp @@ -193,13 +193,14 @@ namespace triqs { namespace gfs { /// Approximation of a point of the domain by a mesh point template - std::tuple windowing (linear_mesh const & mesh, typename D::point_t const & x) { + std::tuple windowing (linear_mesh const & mesh, typename D::point_t const & x) { double a = (x - mesh.x_min())/mesh.delta(); - long i = std::floor(a); - bool in = (! ((i<0) || (i>long(mesh.size())-1))); + long i = std::floor(a), imax = long(mesh.size())-1; + bool in = (i>=0) && (i