cov function

Generic function for the covariance