spd_learn.functional.distance_logdet#

spd_learn.functional.distance_logdet(A, B, squared=False)[source]#

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:
  • A (ndarray, shape (..., n, n)) – First SPD/HPD matrices.

  • B (ndarray, shape (..., n, n)) – Second SPD/HPD matrices, same dimensions as A.

  • squared (bool, default=False) –

    Return squared distance.

    Added in version 0.5.

Returns:

d – Log-det distance between A and B.

Return type:

float or ndarray, shape (…,)

Notes

Changed in version 0.12: Add support for NumPy and PyTorch.

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