Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more 1q and 2q Pauli rotation equivalences #7407

Merged
merged 15 commits into from
Jun 20, 2023
Merged
27 changes: 27 additions & 0 deletions qiskit/circuit/library/standard_gates/equivalence_library.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,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.s(0)
ry_to_rx.rx(-theta, 0)
ry_to_rx.sdg(0)
_sel.add_equivalence(RZGate(theta), ry_to_rx)
tyrolize marked this conversation as resolved.
Show resolved Hide resolved

# CRYGate

q = QuantumRegister(2, "q")
Expand Down Expand Up @@ -290,6 +297,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 = QuantumRegister(2, "q")
Expand Down Expand Up @@ -317,6 +331,19 @@
def_rzz.append(inst, qargs, cargs)
_sel.add_equivalence(RZZGate(theta), def_rzz)

q = QuantumRegister(2, "q")
theta = Parameter("theta")
rzz_to_rxx = QuantumCircuit(q)
for inst, qargs, cargs in [
(HGate(), [q[0]], []),
(HGate(), [q[1]], []),
(RXXGate(theta), [q[0], q[1]], []),
(HGate(), [q[0]], []),
(HGate(), [q[1]], []),
]:
rzz_to_rxx.append(inst, qargs, cargs)
_sel.add_equivalence(RZZGate(theta), rzz_to_rxx)

# RZXGate

q = QuantumRegister(2, "q")
Expand Down