PermutationMatrix.get_distance_from

PermutationMatrix.get_distance_from(other, degree=2)

Return the distance between self and other.

The distance is given as:

\sqrt[D]{1 - \frac{|Tr(U_1^\dagger U_2)|^D}{N^D}}

where D is the degree, by default is 2.

Parameters:
  • other (UnitaryLike) – The unitary to measure distance from.

  • degree (int) – The degree of the distance metric.

Returns:

A value between 1 and 0, where 0 means the two unitaries are equal up to global phase and 1 means the two unitaries are very unsimilar or far apart.

Return type:

float