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 diagram for Identity with no qubits #6926

Merged
merged 6 commits into from
Jan 8, 2025

Conversation

dstrain115
Copy link
Collaborator

  • An IdentityGate with 0 qubits used to raise an exception in the circuit drawer.
  • This PR fixes the issue and displays the gate similar to a GlobalPhaseGate.

Fixes: #6768

- An IdentityGate with 0 qubits used to raise an exception
in the circuit drawer.
- This PR fixes the issue and displays the gate similar to a
GlobalPhaseGate.

Fixes: quantumlib#6768
@dstrain115 dstrain115 requested review from vtomole and a team as code owners January 7, 2025 00:29
@dstrain115 dstrain115 requested a review from viathor January 7, 2025 00:29
@CirqBot CirqBot added the size: S 10< lines changed <50 label Jan 7, 2025
Copy link

codecov bot commented Jan 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.86%. Comparing base (3e16e15) to head (c95ec49).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #6926   +/-   ##
=======================================
  Coverage   97.86%   97.86%           
=======================================
  Files        1084     1084           
  Lines       94309    94314    +5     
=======================================
+ Hits        92298    92303    +5     
  Misses       2011     2011           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@pavoljuhas pavoljuhas left a comment

Choose a reason for hiding this comment

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

LGTM without an extra list.

1: ───I───
2: ───I───
""".strip()
Copy link
Collaborator

Choose a reason for hiding this comment

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

cirq.testing.assert_has_diagram trims and yada yada for you.

@daxfohl
Copy link
Collaborator

daxfohl commented Jan 7, 2025

If you want to solve this more broadly, I'm pretty sure the place is here: https://github.com/quantumlib/Cirq/blob/main/cirq-core/cirq/protocols/circuit_diagram_info_protocol.py#L345. Add a check and info.wire_symbols. If there are no wire symbols, then it should be drawn under the circuit.

@dstrain115 dstrain115 merged commit 25b3362 into quantumlib:main Jan 8, 2025
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: S 10< lines changed <50
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IdentityGate Visualization
5 participants