small code to compute the correlation function