pyriemann.utils.distance.distance_thompson¶
- pyriemann.utils.distance.distance_thompson(A, B, squared=False)¶
Thompson distance between SPD/HPD matrices.
The Thompson distance between two SPD/HPD matrices \(\mathbf{A}\) and \(\mathbf{B}\) is [1]:
\[d(\mathbf{A},\mathbf{B}) = \Vert \log(\mathbf{B}^{-1/2} \mathbf{A} \mathbf{B}^{-1/2}) \Vert_2 = \max_i | \log(\lambda_i) |\]where \(\lambda_i\) are the joint eigenvalues of \(\mathbf{A}\) and \(\mathbf{B}\).
- Parameters:
- Andarray, shape (…, n, n)
First SPD/HPD matrices, at least 2D ndarray.
- Bndarray, shape (…, n, n)
Second SPD/HPD matrices, same dimensions as A.
- squaredbool, default=False
Return squared distance.
- Returns:
- dfloat or ndarray, shape (…,)
Thompson distance between A and B.
See also
Notes
Added in version 0.10.
References
[1]On certain contraction mappings in a partially ordered vector space A.C.Thompson. Proceedings of the American Mathematical Society, 1963.