TwoQubitControlledUDecomposer
class qiskit.synthesis.TwoQubitControlledUDecomposer(rxx_equivalent_gate, euler_basis='ZXZ')
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 can be written, through its canonical (Weyl) decomposition (see TwoQubitWeylDecomposition), as a Weyl gate 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, :
┌─────────┐┌─────────┐
q_0: ┤0 ├┤0 ├─■──────
│ Rxx(a) ││ Ryy(b) │ │ZZ(c)
q_1: ┤1 ├┤1 ├─■──────
└─────────┘└─────────┘The and rotations are then mapped onto rotations using single-qubit basis changes. With :
┌─────┐┌─────────┐┌───┐
q_0: ┤ Sdg ├┤0 ├┤ S ├
├─────┤│ Rxx(b) │├───┤
q_1: ┤ Sdg ├┤1 ├┤ S ├
└─────┘└─────────┘└───┘and :
┌───┐┌─────────┐┌───┐
q_0: ┤ H ├┤0 ├┤ H ├
├───┤│ Rxx(c) │├───┤
q_1: ┤ H ├┤1 ├┤ H ├
└───┘└─────────┘└───┘Finally, each 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 , and 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
- rxx_equivalent_gate (type[Gate]) – Gate that is locally equivalent to an
RXXGate: gate. Valid options are [RZZGate,RXXGate,RYYGate,RZXGate,CPhaseGate,CRXGate,CRYGate,CRZGate]. - euler_basis (str) – Basis string to be provided to
OneQubitEulerDecomposerfor 1Q synthesis. Valid options are ['ZXZ','ZYZ','XYX','XZX','U','U3','U321','U1X','PSX','ZSX','ZSXX','RR'].
Raises
QiskitError – If the gate is not locally equivalent to an RXXGate.
__call__
__call__(unitary, approximate=False, use_dag=False, *, atol=1e-12)
Decompose a two-qubit unitary using the TwoQubitControlledUDecomposer.
Parameters
- unitary (Operator |ndarray) – 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
Note: atol is passed to OneQubitEulerDecomposer.