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

BugFix: draw_mpl fails with adjointed CNOT #5149

Merged
merged 8 commits into from
Feb 2, 2024
Merged

BugFix: draw_mpl fails with adjointed CNOT #5149

merged 8 commits into from
Feb 2, 2024

Conversation

astralcai
Copy link
Contributor

Context:
Error raised when calling draw_mpl on a circuit containing an Adjoint(CNOT). This is due to unwrap_control incorrectly considering Adjoint as a controlled operation because it has the control_wires property, and double counting the same control wires when generating default control values.

Description of the Change:
A check is added to only append more control values if the operation in focus is indeed a controlled operation.

Related GitHub Issues:
#5064

Related Shortcut Story
[sc-53947]

@astralcai astralcai marked this pull request as ready for review February 2, 2024 20:44
@astralcai astralcai requested review from KetpuntoG and a team February 2, 2024 20:44
Copy link
Contributor

@KetpuntoG KetpuntoG left a comment

Choose a reason for hiding this comment

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

Thanks for working on this, it looks great!
Checking it with the user hat, all my examples now work correctly 😄

Copy link

codecov bot commented Feb 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (402ceb5) 99.69% compared to head (47111e2) 99.68%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5149      +/-   ##
==========================================
- Coverage   99.69%   99.68%   -0.01%     
==========================================
  Files         394      394              
  Lines       36130    35862     -268     
==========================================
- Hits        36019    35750     -269     
- Misses        111      112       +1     

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

Copy link
Contributor

@timmysilv timmysilv left a comment

Choose a reason for hiding this comment

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

nice fix!

@astralcai astralcai merged commit 0db33ee into master Feb 2, 2024
35 checks passed
@astralcai astralcai deleted the drawer-ctrl branch February 2, 2024 22:23
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.

3 participants