What should we add?
The TwoQubitControlledUDecomposer produces too many unnecessary single-qubit gates.
Currently, the TwoQubitWeylDecomposition outputs a circuit containing the following sequence of gates:
K1L(0) K1R(1) RXX(0, 1) RYY(0, 1) RZZ(0, 1) K2L(0) K2R(1)
Now, in the case of an RZZ gate as the 2-qubit gate in the target, the TwoQubitControlledUDecomposer rewrites the
RXX and RYY as RZZ gates with S/Sdg/H additional gates, yielding the following sequence of gates:
K1L(0) K1R(1) H(0) H(1) RZZ(0, 1) H(0) H(1) Sdg(0) Sdg(1) H(0) H(1) RZZ(0, 1) H(0) H(1) S(0) S(1) RZZ(0, 1) K2L(0) K2R(1)
Now each of these 1-qubit gates K/H/S/Sdg calls the Euler decomposer independently using the function unitary_to_gate_sequence_inner, yielding too many unnecessary single qubit gates.
Since we usually used to call the OneQubitEulerDecomposer synthesis after the two-qubit synthesis, we didn't care about this too much.
But now with your new TwoQubitPeepholeOptimization pass #13419, I'm afraid that these unnecessary single-qubit gates may affect the fidelity and gate-count calculations.
Additional examples are given in the comments below.
What should we add?
The
TwoQubitControlledUDecomposerproduces too many unnecessary single-qubit gates.Currently, the
TwoQubitWeylDecompositionoutputs a circuit containing the following sequence of gates:K1L(0) K1R(1) RXX(0, 1) RYY(0, 1) RZZ(0, 1) K2L(0) K2R(1)Now, in the case of an RZZ gate as the 2-qubit gate in the target, the
TwoQubitControlledUDecomposerrewrites theRXX and RYY as RZZ gates with S/Sdg/H additional gates, yielding the following sequence of gates:
K1L(0) K1R(1) H(0) H(1) RZZ(0, 1) H(0) H(1) Sdg(0) Sdg(1) H(0) H(1) RZZ(0, 1) H(0) H(1) S(0) S(1) RZZ(0, 1) K2L(0) K2R(1)Now each of these 1-qubit gates K/H/S/Sdg calls the Euler decomposer independently using the function
unitary_to_gate_sequence_inner, yielding too many unnecessary single qubit gates.Since we usually used to call the
OneQubitEulerDecomposersynthesis after the two-qubit synthesis, we didn't care about this too much.But now with your new
TwoQubitPeepholeOptimizationpass #13419, I'm afraid that these unnecessary single-qubit gates may affect the fidelity and gate-count calculations.Additional examples are given in the comments below.