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

OptimizeSwapBeforeMeasure removes classically conditioned SwapGate #6192

Closed
kdk opened this issue Apr 9, 2021 · 0 comments · Fixed by #6239
Closed

OptimizeSwapBeforeMeasure removes classically conditioned SwapGate #6192

kdk opened this issue Apr 9, 2021 · 0 comments · Fixed by #6239
Labels
bug Something isn't working

Comments

@kdk
Copy link
Member

kdk commented Apr 9, 2021

Information

  • Qiskit Terra version:
  • Python version:
  • Operating system:

What is the current behavior?

From https://travis-ci.com/github/Qiskit/qiskit-terra/jobs/495770351#L997:

>>> qc = qk.QuantumCircuit.from_qasm_str('''
OPENQASM 2.0;
include "qelib1.inc";
qreg q3134[2];
creg c137[1];
cx q3134[1],q3134[0];
h q3134[1];
if(c137==1) swap q3134[1],q3134[0];
measure q3134[1] -> c137[0];
''')
>>> qc.draw()
         ┌───┐               
q3134_0: ┤ X ├────────X──────
         └─┬─┘┌───┐   │   ┌─┐
q3134_1: ──■──┤ H ├───X───┤M├
              └───┘┌──╨──┐└╥┘
 c137: 1/══════════╡ = 1 ╞═╩═
                   └─────┘ 0 
>>> qk.transpile(qc, optimization_level=3).draw()
         ┌───┐     ┌─┐
q3134_0: ┤ X ├─────┤M├
         └─┬─┘┌───┐└╥┘
q3134_1: ──■──┤ H ├─╫─
              └───┘ ║ 
 c137: 1/═══════════╩═
                    0 

Steps to reproduce the problem

What is the expected behavior?

Suggested solutions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant