Skip to main content
IBM Quantum Platform

TwoQubitControlledUDecomposer

class qiskit.synthesis.TwoQubitControlledUDecomposer(rxx_equivalent_gate, euler_basis='ZXZ')

GitHub

Bases: object

Decompose a general two-qubit unitary in terms of a target two-qubit gate, that is locally equivalent to an RXXGate.

Synthesis algorithm

Any two-qubit unitary UU can be written, through its canonical (Weyl) decomposition (see TwoQubitWeylDecomposition), as a Weyl gate Ud(a,b,c)U_d(a, b, c) surrounded by four single-qubit unitary gates:

     ┌─────┐┌───────┐┌─────┐
q_0: ┤ c2r ├┤0      ├┤ c1r ├
     ├─────┤│  Weyl │├─────┤
q_1: ┤ c2l ├┤1      ├┤ c1l ├
     └─────┘└───────┘└─────┘

The Weyl gate factorizes into a product of three two-qubit rotations, Ud(a,b,c)=RXX(a)RYY(b)RZZ(c)U_d(a, b, c) = R_{XX}(a)\, R_{YY}(b)\, R_{ZZ}(c):

     ┌─────────┐┌─────────┐
q_0: ┤0        ├┤0        ├─■──────
     │  Rxx(a) ││  Ryy(b) │ │ZZ(c)
q_1: ┤1        ├┤1        ├─■──────
     └─────────┘└─────────┘

The RYYR_{YY} and RZZR_{ZZ} rotations are then mapped onto RXXR_{XX} rotations using single-qubit basis changes. With RYY(b)=(SS)RXX(b)(SS)R_{YY}(b) = (S^\dagger \otimes S^\dagger)\, R_{XX}(b)\, (S \otimes S):

     ┌─────┐┌─────────┐┌───┐
q_0: ┤ Sdg ├┤0        ├┤ S ├
     ├─────┤│  Rxx(b) │├───┤
q_1: ┤ Sdg ├┤1        ├┤ S ├
     └─────┘└─────────┘└───┘

and RZZ(c)=(HH)RXX(c)(HH)R_{ZZ}(c) = (H \otimes H)\, R_{XX}(c)\, (H \otimes H):

     ┌───┐┌─────────┐┌───┐
q_0: ┤ H ├┤0        ├┤ H ├
     ├───┤│  Rxx(c) │├───┤
q_1: ┤ H ├┤1        ├┤ H ├
     └───┘└─────────┘└───┘

Finally, each RXXR_{XX} rotation is realized with the user-supplied gate that is locally equivalent to RXXGate (the rxx_equivalent_gate), wrapped by the single-qubit gates that account for the local equivalence and for any scaling of the rotation angle. After every rotation is expanded, all single-qubit gates that fall between two consecutive two-qubit gates are multiplied together and consolidated, so the synthesized circuit uses at most three applications of rxx_equivalent_gate and at most eight single-qubit unitary gates:

     ┌─────┐┌───────────┐┌─────┐┌───────────┐┌─────┐┌───────────┐┌─────┐
q_0: ┤ d2r ├┤0          ├┤ d1r ├┤0          ├┤ e1r ├┤0          ├┤ f1r ├
     ├─────┤│  Equiv(a) │├─────┤│  Equiv(b) │├─────┤│  Equiv(c) │├─────┤
q_1: ┤ d2l ├┤1          ├┤ d1l ├┤1          ├┤ e1l ├┤1          ├┤ f1l ├
     └─────┘└───────────┘└─────┘└───────────┘└─────┘└───────────┘└─────┘

Here Equiv(a), Equiv(b) and Equiv(c) are the user-supplied rxx_equivalent_gate (the gate locally equivalent to RXXGate) realizing the RXX(a)R_{XX}(a), RXX(b)R_{XX}(b) and RXX(c)R_{XX}(c) rotations, and the remaining boxes are the consolidated single-qubit unitary gates.

The number of two-qubit gates actually emitted depends on the Weyl parameters of the target: rotations with a vanishing angle are dropped, so unitaries that are closer to a single or two instances of RXXGate use one or two applications of rxx_equivalent_gate respectively instead of three. A target close to the identity will use no applications of it.

Parameters

Raises

QiskitError – If the gate is not locally equivalent to an RXXGate.

__call__

__call__(unitary, approximate=False, use_dag=False, *, atol=1e-12)

GitHub

Decompose a two-qubit unitary using the TwoQubitControlledUDecomposer.

Parameters

  • unitary (Operator |ndarray) – 4×44 \times 4 unitary to synthesize.
  • approximate – Currently not used by this decomposer; accepted for signature compatibility with the other two-qubit decomposers. Reserved for future use.
  • use_dag – Currently not used by this decomposer; accepted for signature compatibility with the other two-qubit decomposers. Reserved for future use.
  • atol – Absolute tolerance for checking angles of the single-qubit unitaries when simplifying the returned circuit [Default: 1e-12].

Returns

Synthesized quantum circuit.

Return type

QuantumCircuit

Note: atol is passed to OneQubitEulerDecomposer.

Was this page helpful?
Report a bug, typo, or request content on GitHub.