Code to calculate ovariance matrices of probability distributions