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 text drawer AnnotatedOperations #11466

Merged
merged 2 commits into from
Dec 31, 2023

Conversation

enavarro51
Copy link
Contributor

Summary

Fixes #11465

Details and comments

This PR fixes an issue in the text drawer where multi-qubit AnnotatedOperations were not displaying all the qubits.

Now this,

from qiskit.circuit import QuantumCircuit
from qiskit.circuit.annotated_operation import AnnotatedOperation, InverseModifier, ControlModifier
from qiskit.circuit.library import CXGate

gate = AnnotatedOperation(CXGate(), ControlModifier(1))
circuit = QuantumCircuit(gate.num_qubits)
circuit.append(gate, range(gate.num_qubits))
print(circuit)

displays as

            
q_0: ───■───
     ┌──┴──┐
q_1: ┤0    ├
     │  Cx │
q_2: ┤1    ├
     └─────┘

@enavarro51 enavarro51 requested review from nonhermitian and a team as code owners December 29, 2023 17:02
@qiskit-bot
Copy link
Collaborator

One or more of the the following people are requested to review this:

@coveralls
Copy link

coveralls commented Dec 29, 2023

Pull Request Test Coverage Report for Build 7358911878

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.04%) to 87.513%

Totals Coverage Status
Change from base Build 7317452088: -0.04%
Covered Lines: 59227
Relevant Lines: 67678

💛 - Coveralls

@alexanderivrii
Copy link
Contributor

@enavarro51, many thanks for the lightning fast fix. Just a small question: could there be a similar problem in matplotlib-based visualization?

@enavarro51
Copy link
Contributor Author

The problem here was just that the text drawer did not handle the multi-qubit case. The mpl drawer already does.
image

Copy link
Contributor

@alexanderivrii alexanderivrii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@alexanderivrii alexanderivrii added this pull request to the merge queue Dec 31, 2023
Merged via the queue into Qiskit:main with commit a9b3881 Dec 31, 2023
13 checks passed
ShellyGarion pushed a commit to ShellyGarion/qiskit-terra that referenced this pull request Jan 18, 2024
* Fix text drawer Annotated

* Fix test name
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.

Displaying control-annotated operations
4 participants