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

inverse of conditional gate is not conditional #6810

Open
aeddins-ibm opened this issue Jul 26, 2021 · 1 comment · May be fixed by #6829
Open

inverse of conditional gate is not conditional #6810

aeddins-ibm opened this issue Jul 26, 2021 · 1 comment · May be fixed by #6829
Assignees
Labels
bug Something isn't working

Comments

@aeddins-ibm
Copy link
Contributor

Information

  • Qiskit Terra version: 0.18
  • Python version: 3.9.5
  • Operating system: mac

What is the current behavior?

Calling the inverse method of a conditional X gate returns an unconditional X gate.

Steps to reproduce the problem

image

What is the expected behavior?

I'd expect the inverse of a conditional gate to have the same condition.

That way, for instance, x.c_if(bit, 1) immediately followed by its inverse operation would produce the identity, as one would expect for an inverse.

Suggested solutions

Assuming it's the desired behavior, could have inverse copy the condition from the original gate to the inverse gate before returning it.

@aeddins-ibm aeddins-ibm added the bug Something isn't working label Jul 26, 2021
@ewinston ewinston self-assigned this Jul 28, 2021
@ewinston
Copy link
Contributor

I'm just curious about when this situation comes up and why it might not just warn due to the presence of measurement?

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.

2 participants