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

Commute z gates for qscout_compile #814

Open
vtomole opened this issue Oct 12, 2023 · 1 comment
Open

Commute z gates for qscout_compile #814

vtomole opened this issue Oct 12, 2023 · 1 comment

Comments

@vtomole
Copy link
Member

vtomole commented Oct 12, 2023

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.

@cdbf1
Copy link
Contributor

cdbf1 commented Jul 8, 2024

This is an interesting issue because the cirq.commutes() function doesn't recognize the Rxx gate commuting with the pair of Z gates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants