Diagonal Nonlinear Transformations Preserve Structure in Covariance and Precision Matrices