pyriemann.utils.distance.distance_logdet

pyriemann.utils.distance.distance_logdet(A, B, squared=False)

Log-det distance between SPD/HPD matrices.

The log-det distance between two SPD/HPD matrices \(\mathbf{A}\) and \(\mathbf{B}\) is [1]:

\[d(\mathbf{A},\mathbf{B}) = \sqrt{\log(\det \left( \frac{\mathbf{A}+\mathbf{B}}{2} \right)) - \frac{1}{2} \log(\det(\mathbf{A} \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.

New in version 0.5.

Returns:
dfloat or ndarray, shape (…,)

Log-det distance between A and B.

See also

distance

References

[1]

Matrix nearness problems with Bregman divergences I.S. Dhillon, J.A. Tropp. SIAM J Matrix Anal Appl, 2007, 29 (4), pp. 1120-1146