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

Fix for conditional single gate plotting using mpl #7018

Closed
wants to merge 2 commits into from

Conversation

paniash
Copy link
Contributor

@paniash paniash commented Sep 14, 2021

Summary

Fixes #7017. Minor bug fix involving plotting of QuantumCircuit object when using conditional single gates like circuit.h(0).c_if(0, True).

@1ucian0
Copy link
Member

1ucian0 commented Sep 14, 2021

This is an unexpectedly short fix :)

Does it make sense @TharrmashasthaPV and @enavarro51 ?

@enavarro51
Copy link
Contributor

Probably need @TharrmashasthaPV to weigh in, but isn't this what #6259 fixes? (Which got stuck in CI, by the way).

@1ucian0
Copy link
Member

1ucian0 commented Sep 14, 2021

@paniash do you mind adding a test?

@TharrmashasthaPV
Copy link
Contributor

Hey. I am just not sure if this is a complete fix. Because for one, the circuit

q = QuantumRegister(1,'q')
c = ClassicalRegister(2,'c')
circuit = QuantumCircuit(q, c)
circuit.h(0).c_if(1, True)
circuit.h(0).c_if(0, True)
circuit.draw('mpl')

outputs
image
The label is 0x1 irrespective of the bit the gate is conditioned on. Also, circuit.draw('mpl', cregbundle=False) breaks and if a gate is conditioned on a complete register like circuit.x(0).c_if(c,1), the drawer breaks.

@paniash
Copy link
Contributor Author

paniash commented Sep 14, 2021

@TharrmashasthaPV Thanks for pointing it out. Can you confirm if this issue is fixed in #6259? If so, then I'll close this PR.

@1ucian0
Copy link
Member

1ucian0 commented Sep 14, 2021

Which got stuck in CI, by the way

Ups.. unblocking this.

@1ucian0
Copy link
Member

1ucian0 commented Sep 15, 2021

#6259 merged. That seems to solve #7017. If #6259 is incomplete and this PR is the way to go, please reopen it.

@1ucian0 1ucian0 closed this Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

mpl drawer cannot draw circuits conditioned on single bits
4 participants