Evaluate the multivariate Gaussian log-density at many points by rotating into the eigenbasis of , where the Mahalanobis distance becomes a weighted sum of squares.
With the eigendecomposition , the coordinates give
Implement mvn_logpdf_mahal(Y, mu, Sigma) for Y of shape (N, D), mu of shape (D,) and a symmetric positive definite Sigma with distinct eigenvalues. Return the tuple (logpdf, delta2, Z):
logpdf, delta2: arrays of shape (N,).Z: array of shape (N, D) of rotated coordinates, with the eigenvalues sorted in ascending order (column d uses the eigenvector of the d-th smallest eigenvalue), and each eigenvector's sign fixed so that its entry of largest absolute value is positive.Do not form explicitly.