Asymptotically optimal circuits for arbitrary n-qubit diagonal comutations

A unitary operator U = Σj,k uj,k|k〉〈j| is called diagonal when uj,k = 0 unless j = k. The definition extends to quantum computations, where j and k vary over the 2n binary expressions for integers 0,1 ...,2n - 1, given n qubits. Such operators do not affect outcomes of the projective measurement {|j〉〈j|; 0 ≤ j ≤ 2n - 1} but rather create arbitrary relative phases among the computational basis states {|j〉 ; 0 ≤ j ≤ 2n - 1}. Prior quantum circuits for diagonal computations require O(n22n) controlled-not gates and one-qubit Blodl sphere rotations. This work provides a recursive, constructive procedure which inputs U and outputs such a diagram containing 2n+1 - 3 alternating controlled-not gates and one-qubit z- axis Bloch sphere rotations. Up to a factor of two, these circuits are provably the smallest possible. Moreover, the algorithm recognizes certain special case structures within U. For example, if U is a full diagonal tensor of Rz(α) = e-iα/2|0〉〈0| + e-iα/2|1〉〈1| rotations, then a cancellation of controlled-not gates reduces our circuit to the n gate tensor. Moreover, any V ⊕ Rz will output half as many gates as a generic U.