spd_learn.functional.bwcm_distance#

spd_learn.functional.bwcm_distance(A: Tensor, B: Tensor, *, theta: float = 0.5, diagonal_weight: float = 0.25) → Tensor#

Compute Riemannian distance under the Power-Cholesky Metric (PCM).

\[d_{\text{PCM}}(A, B) = \sqrt{\|\lfloor L_A \rfloor - \lfloor L_B \rfloor\|_F^2 + w_{\text{diag}} \left\|\frac{1}{\theta}(d_A^\theta - d_B^\theta)\right\|_2^2}\]
Parameters:
  • A (torch.Tensor) – SPD matrices of shape (…, n, n).

  • B (torch.Tensor) – SPD matrices of shape (…, n, n).

  • theta (float, default=0.5) – Power parameter (\(\theta \neq 0\)).

  • diagonal_weight (float, default=1.0) – Weight \(w_{\text{diag}}\) on diagonal distance.

Returns:

Distances of shape (…).

Return type:

torch.Tensor