add logging of r[k]