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}}](../../_images/math/bd4d7afd85d89ab87c3210d80a837a95361ee4a9.png)
where D is the degree, by default is 2.
- Parameters:
other (
UnitaryMatrix|complex128|complex64|int64|int32|float64|float32|Sequence[Sequence[int|float|complex]]) – 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