client-superstaq
client-superstaq copied to clipboard
Commute `z` gates for `qscout_compile`
import qiskit
import qiskit_superstaq as qss
qc = qiskit.QuantumCircuit(2, 2)
qc.cz(0, 1)
qc.measure_all()
print(qc)
# prints
# ░ ┌─┐
# q_0: ─■──░─┤M├───
# │ ░ └╥┘┌─┐
# q_1: ─■──░──╫─┤M├
# ░ ║ └╥┘
# c: 2/═══════╬══╬═
# ║ ║
# meas: 2/═══════╩══╩═
# 0 1
#
provider = qss.superstaq_provider.SuperstaqProvider(token)
compiler_output = provider.qscout_compile(qc)
print(compiler_output.circuit)
# prints
# ┌─────────────┐┌───┐┌───────────┐┌─────────────┐┌───┐ ░ ┌─┐
# q_0: ┤ R(π/2,-π/2) ├┤ Z ├┤0 ├┤ R(π/2,-π/2) ├┤ S ├─░─┤M├───
# ├─────────────┤├───┤│ Rxx(π/2) │├─────────────┤├───┤ ░ └╥┘┌─┐
# q_1: ┤ R(π/2,-π/2) ├┤ Z ├┤1 ├┤ R(π/2,-π/2) ├┤ S ├─░──╫─┤M├
# └─────────────┘└───┘└───────────┘└─────────────┘└───┘ ░ ║ └╥┘
# c: 2/═════════════════════════════════════════════════════════╩══╩═
# 0 1
The z
gates came be moved to the right of Rxx
because and combined into the s
gates.