diff --git a/qiskit/circuit/library/standard_gates/equivalence_library.py b/qiskit/circuit/library/standard_gates/equivalence_library.py index 85116bfb65d7..6bda41addc7c 100644 --- a/qiskit/circuit/library/standard_gates/equivalence_library.py +++ b/qiskit/circuit/library/standard_gates/equivalence_library.py @@ -354,6 +354,13 @@ def_ry.append(RGate(theta, pi / 2), [q[0]], []) _sel.add_equivalence(RYGate(theta), def_ry) +q = QuantumRegister(1, "q") +ry_to_rx = QuantumCircuit(q) +ry_to_rx.sdg(0) +ry_to_rx.rx(theta, 0) +ry_to_rx.s(0) +_sel.add_equivalence(RYGate(theta), ry_to_rx) + # CRYGate # # q_0: ────■──── q_0: ─────────────■────────────────■── @@ -451,6 +458,20 @@ ryy_to_rzz.append(inst, qargs, cargs) _sel.add_equivalence(RYYGate(theta), ryy_to_rzz) +# RYY to RXX +q = QuantumRegister(2, "q") +theta = Parameter("theta") +ryy_to_rxx = QuantumCircuit(q) +for inst, qargs, cargs in [ + (SdgGate(), [q[0]], []), + (SdgGate(), [q[1]], []), + (RXXGate(theta), [q[0], q[1]], []), + (SGate(), [q[0]], []), + (SGate(), [q[1]], []), +]: + ryy_to_rxx.append(inst, qargs, cargs) +_sel.add_equivalence(RYYGate(theta), ryy_to_rxx) + # RZGate # global phase: -ϴ/2 # ┌───────┐ ┌───────┐ @@ -474,6 +495,13 @@ rz_to_sxry.sxdg(0) _sel.add_equivalence(RZGate(theta), rz_to_sxry) +q = QuantumRegister(1, "q") +rz_to_rx = QuantumCircuit(q) +rz_to_rx.h(0) +rz_to_rx.rx(theta, 0) +rz_to_rx.h(0) +_sel.add_equivalence(RZGate(theta), rz_to_rx) + # CRZGate # # q_0: ────■──── q_0: ─────────────■────────────────■── @@ -588,7 +616,6 @@ rzz_to_ryy.append(inst, qargs, cargs) _sel.add_equivalence(RZZGate(theta), rzz_to_ryy) - # RZXGate # # ┌─────────┐ diff --git a/releasenotes/notes/pauli-rotation-equivalences-6b2449c93c042dc9.yaml b/releasenotes/notes/pauli-rotation-equivalences-6b2449c93c042dc9.yaml new file mode 100644 index 000000000000..5c435eb51a53 --- /dev/null +++ b/releasenotes/notes/pauli-rotation-equivalences-6b2449c93c042dc9.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + The transpiler's built-in :class:`.EquivalenceLibrary` has been taught more Pauli-rotation + equivalences between the one-qubit :math:`R_X`, :math:`R_Y` and :math:`R_Z` gates, and between + the two-qubit :math:`R_{XX}`, :math:`R_{YY}` and :math:`R_{ZZ}` gates. This should make + simple basis translations more reliable, especially circuits that use :math:`Y` rotations. + See `#7332 `__.