def distance_riemann(A, B):
"""Riemannian distance between two covariance matrices A and B.
.. math::
d = {\left( \sum_i \log(\lambda_i)^2 \\right)}^{-1/2}
where :math:`\lambda_i` are the joint eigenvalues of A and B
:param A: First covariance matrix
:param B: Second covariance matrix
:returns: Riemannian distance between A and B
"""
return numpy.sqrt((numpy.log(eigvalsh(A, B))**2).sum())
distance.py 文件源码
python
阅读 43
收藏 0
点赞 0
评论 0
评论列表
文章目录