Use Rcpp for covariance computation