LocalCov function

An auxiliary function that computes all local correlations simultaneously in O(n^2).