def inv_sqrth(x):
"""
Matrix inverse square root
Parameters
----------
x : ndarray
Real, symmetric matrix
Returns
-------
invsqrt : ndarray
Input to the power -1/2
"""
vals, vecs = eigh(x)
return vecs @ diag(1 / sqrt(vals)) @ vecs.T
评论列表
文章目录