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

simplify Barriers to the Identity if only_visual=True #3016

Merged
merged 2 commits into from Sep 1, 2022

Conversation

albi3ro
Copy link
Contributor

@albi3ro albi3ro commented Aug 31, 2022

In our compilation functions, only Barriers where only_visual=False affect the output of the compilation. If only_visual=True, the Barriers are removed prior to compilation.

We should mimic this behaviour with the qml.simplify pipeline. With this PR and #2982 , we get:

>>> qml.simplify( qml.S(0) @ qml.Barrier(0, only_visual=True) @ qml.S(0) )
PauliX(wires=[0])
>>> qml.simplify( qml.S(0) @ qml.Barrier(0, only_visual=False) @ qml.S(0) )
S(wires=[0]) @ Barrier(wires=[0]) @ S(wires=[0])

@albi3ro albi3ro added the op-arithmetic PR's involved in introducing operator arithmetic label Aug 31, 2022
@codecov
Copy link

codecov bot commented Aug 31, 2022

Codecov Report

Merging #3016 (08f7d94) into master (8978a02) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #3016   +/-   ##
=======================================
  Coverage   99.65%   99.65%           
=======================================
  Files         269      269           
  Lines       22551    22557    +6     
=======================================
+ Hits        22474    22480    +6     
  Misses         77       77           
Impacted Files Coverage Δ
pennylane/ops/qubit/non_parametric_ops.py 100.00% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Copy link
Contributor

@AlbertMitjans AlbertMitjans left a comment

Choose a reason for hiding this comment

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

Nice!

@AlbertMitjans AlbertMitjans merged commit 2084132 into master Sep 1, 2022
@AlbertMitjans AlbertMitjans deleted the simplify-only-visual-barriers branch September 1, 2022 09:03
@rmoyard rmoyard added this to the v0.26.0 milestone Sep 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
op-arithmetic PR's involved in introducing operator arithmetic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants