bug fixed in integrate method. don;t use a[i,j]=.. to set a value in the numeric::array a but a[make_tuple(i,j)].