def toPartialCorr(Prec): D=Prec[np.diag_indices(Prec.shape[0])] P=Prec.copy() D=np.outer(D,D) return -P/np.sqrt(D)