import numpy as np
import scipy.linalg as LA
def sqrtmh(A):
vals, vecs = LA.eigh(A)
return vecs @ np.diag(np.sqrt(vals)) @ vecs.T.conjugate()
-[Square root of a matrix](https://ja.wikipedia.org/wiki/%E8%A1%8C%E5%88%97%E3%81%AE%E5%B9%B3%E6%96%B9% E6% A0% B9) -[Positive Definite Matrix](https://ja.wikipedia.org/wiki/%E8%A1%8C%E5%88%97%E3%81%AE%E5%AE%9A%E5%80%A4 % E6% 80% A7)
Recommended Posts