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

Make visual changes for 0 and 1 control values [unitaryhack] #2668

Merged
merged 21 commits into from
Jun 8, 2022

Conversation

ankit27kh
Copy link
Contributor

@ankit27kh ankit27kh commented Jun 7, 2022

Context:
Text drawing had no difference between 0 and 1 control values. Similarly, mpl drawer was missing ControlledQubitUnitary in its special cases
Description of the Change:
Changes text drawer to have different symbols for 0 and 1 control values. Also, add ControlledQubitUnitary as a special case in mpl drawer. Adds logic in mpl drawer to consider control_values
Benefits:
Better visual circuits.
Possible Drawbacks:

Related GitHub Issues:
Closes #2660

@codecov
Copy link

codecov bot commented Jun 7, 2022

Codecov Report

Merging #2668 (634bd07) into master (189de28) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #2668   +/-   ##
=======================================
  Coverage   99.58%   99.58%           
=======================================
  Files         249      249           
  Lines       20220    20228    +8     
=======================================
+ Hits        20137    20145    +8     
  Misses         83       83           
Impacted Files Coverage Δ
pennylane/drawer/tape_mpl.py 100.00% <100.00%> (ø)
pennylane/drawer/tape_text.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 189de28...634bd07. Read the comment docs.

@ankit27kh ankit27kh changed the title add 'O' for control state 0 Make visual changes for 0 and 1 control values Jun 7, 2022
@ankit27kh ankit27kh marked this pull request as ready for review June 7, 2022 17:43
@ankit27kh
Copy link
Contributor Author

Hey @albi3ro, I think this is ready

@albi3ro albi3ro self-requested a review June 7, 2022 21:30
@ankit27kh ankit27kh changed the title Make visual changes for 0 and 1 control values Make visual changes for 0 and 1 control values [unitaryhack] Jun 8, 2022
Copy link
Contributor

@albi3ro albi3ro left a comment

Choose a reason for hiding this comment

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

I just realized we didn't update the documentation examples, but I can do that this afternoon. The documentation changes will be easy but extensive because many examples rely on qml.draw to demonstrate their behaviour.

Thanks for the great suggestion and contribution @ankit27kh ! This will especially be useful going forward as we make our control operations more general.

@ankit27kh
Copy link
Contributor Author

Hey @albi3ro, I found another discrepancy with the mpl drawer. While out of the scope of this PR, it is still something you may want to look at when generalising control operations.
I have made bug report #2677.

@albi3ro albi3ro merged commit f1517eb into PennyLaneAI:master Jun 8, 2022
@ankit27kh ankit27kh deleted the control_value_draw branch June 8, 2022 16:29
@CatalinaAlbornoz CatalinaAlbornoz added the unitaryhack-accepted This contribution has been accepted for a UnitaryHack issue label Jun 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unitaryhack-accepted This contribution has been accepted for a UnitaryHack issue
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Have control state of qubits visible in the circuit drawing
3 participants