Skip to content

Commit

Permalink
Improve speed of multivariate_normality (#437)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelvallat authored Sep 3, 2024
1 parent 1be61a8 commit ab57491
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/pingouin/multivariate.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ def multivariate_normality(X, alpha=0.05):
# Squared-Mahalanobis distances
Dj = np.diag(np.linalg.multi_dot([difT, S_inv, difT.T]))
Y = np.linalg.multi_dot([X, S_inv, X.T])
Djk = -2 * Y.T + np.repeat(np.diag(Y.T), n).reshape(n, -1) + np.tile(np.diag(Y.T), (n, 1))
Y_diag = np.diag(Y)
Djk = -2 * Y.T + Y_diag + Y_diag[..., None]

# Smoothing parameter
b = 1 / (np.sqrt(2)) * ((2 * p + 1) / 4) ** (1 / (p + 4)) * (n ** (1 / (p + 4)))
Expand Down

0 comments on commit ab57491

Please sign in to comment.