covariance matrix working