Herein, we will show how to compute the angles for one-qubit synthesis, using the axes "XZX" as
an example. We separate the process into the extraction of a global phase from a unitary
V∈U(2) and the decomposition of the remaining special unitary U∈SU(2)
into a circuit RXRZRX. Afterwards, we also briefly describe how rotations about
arbitrary axes can be used for one-qubit synthesis.
Extract the global phase
Given a unitary matrix V∈U(2), we compute its determinant
det(V)=exp(−2iφ). Then we need to compute a square root of exp(−2iφ). Since
the complex square root is not unique, we need to pick a branch. However, any branch will work,
so this choice is an insignificant implementation detail.
Let's denote the root we chose by exp(−iφ), and define U=exp(iφ)V.
Then we have
det(U)=det(exp(iφ)I2)det(V)=exp(2iφ)exp(−2iφ)=1,
so that U∈SU(2) and we may proceed by decomposing the special unitary matrix U.
Decompose the special unitary matrix
We want to decompose U∈SU(2) into a circuit of the form
0: ──RX(ϕ)──RZ(θ)──RX(ω)─┤.
It corresponds to the matrix product C(ϕ,θ,ω)=RX(ω)RZ(θ)RX(ϕ),
which we can compute explicitly:
where we wrote θ′=θ/2, cx=cos(x/2), and sx=sin(x/2).
We can add the diagonal entries, add the off-diagonal entries, and apply some
trigonometric identities
to obtain
cos(2ω+ϕ)cos(θ′)=21(U00+U11)
sin(2ω+ϕ)cos(θ′)=2i(U01+U10).
From this, we can use the sign-sensitive arctan(a/b), e.g. implemented in np.arctan2 to compute
ω+ϕ from those two sums.
Similarly, computing the differences of diagonal and off-diagonal entries yields
cos(2ω−ϕ)cos(θ′)=2i(U00−U11)
sin(2ω−ϕ)cos(θ′)=21(U01+U10),
from which we obtain ω−ϕ, and thus can compute ω and ϕ individually.
The missing angle, θ′, can then be computed from any of the four equations above that
allows to divide out the sin(21(ω±ϕ)) or cos(21(ω±ϕ))
factor, respectively. For example, if U00+U11=0, we may compute
θ=2arccos(2cos(21(ω+ϕ))U00+U11).
Doubling the obtained values then yields the rotation angles for the decomposition.
Arbitrary rotation axes
As mentioned in the overview tab, one-qubit synthesis can be performed not only with pairs of Pauli rotations but also with any pair of rotation axes
n0,n1∈R3 with ∥nj∥2=1.
The generator of the corresponding rotations is
so that the product of the three rotations R0(ω)R1(θ)R0(ϕ) can be expressed
explicitly in terms of the generators. If n0⊥n1, it is sufficient to compute
the trace inner products of U with I, G0, and G1 to obtain the coefficients like
in the four equations above (the fourth value is simply such that the sum of squares of all four
values is one).
If n0⊥n1, the trace inner products can be computed with the Pauli basis,
and an explicit basis change to the generators has to be performed to extract the coefficients from
which the rotation angles are obtained.