Skip to content

inverse of conditional gate is not conditional #6810

@aeddins-ibm

Description

@aeddins-ibm

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions