Calculating covariance of two sets of data points