spd_learn.functional.gbw_distance#

spd_learn.functional.gbw_distance(x, y, metric, power=1.0, *, squared=False)[source]#

Compute the power-deformed generalized BW distance.

Parameters:
  • x (torch.Tensor) – Real SPD matrices of shape (…, n, n).

  • y (torch.Tensor) – Real SPD matrices broadcastable with x.

  • metric (torch.Tensor) – Common SPD metric broadcastable with both inputs.

  • power (float or torch.Tensor, default=1.0) – Positive scalar deformation exponent.

  • squared (bool, default=False) – Return squared distances instead of distances.

Returns:

Distances over the broadcast leading axes, preserving input dtype/device.

Return type:

torch.Tensor

Notes

The distance includes division by power. First-order derivatives are supported; coincident points use a zero subgradient.