now in-place calcuation, no swapping
use integrate function in hpx codes