diagonal_distance

diagonal_distance(unitary)[source]

Compute how diagonal a unitary is.

The diagonal distance measures how closely a unitary can be approx- imately inverted by a diagonal unitary. A unitary is approximately inverted when the Hilbert-Schmidt distance to the identity is less than some threshold.

A proof of correctness can be found in the appendix of: https://arxiv.org/abs/2409.00433

Parameters:

unitary (complex128) – The unitary matrix to check.

Returns:

The Hilbert-Schmidt distance to the nearest diagonal.

Return type:

float