[SciPy-Dev] matrix_sqrt for singular symmetric square matrices

Gael Varoquaux gael.varoquaux at normalesup.org
Sun Oct 28 03:59:06 EDT 2018


On Sun, Oct 28, 2018 at 08:56:37AM +0100, Gael Varoquaux wrote:
> using '@' to denote the matrix product, and S = np.diag(s) is the
> diagonal matrix of eigenvalues. The matrix square root is then given by:

>    sqrt(M) = U' @ np.diag(np.sqrt(s)) @ U

I forgot to say: this is the definition used by Joseph, in his original
post (so basically, I am backing his choice), with the only difference
that I would not use an SVD, but and "eigh", which should be faster and
more stable for SPD matrices (and non SPD matrices do not have a square
root).

G


More information about the SciPy-Dev mailing list