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

Skip identities in default.mixed #2365

Merged
merged 3 commits into from
Mar 23, 2022
Merged

Conversation

albi3ro
Copy link
Contributor

@albi3ro albi3ro commented Mar 22, 2022

Following #2356 , this PR makes "default.mixed" skip identities as well.

@albi3ro albi3ro requested a review from antalszava March 22, 2022 21:50
@codecov
Copy link

codecov bot commented Mar 22, 2022

Codecov Report

Merging #2365 (738415d) into master (d74b46b) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #2365   +/-   ##
=======================================
  Coverage   99.42%   99.42%           
=======================================
  Files         243      243           
  Lines       18322    18324    +2     
=======================================
+ Hits        18216    18218    +2     
  Misses        106      106           
Impacted Files Coverage Δ
pennylane/devices/default_mixed.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 d74b46b...738415d. Read the comment docs.

Copy link
Contributor

@antalszava antalszava left a comment

Choose a reason for hiding this comment

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

Looks good! 🎉 Thank you for the quick addition here ⚡ Just had one minor suggestion and a question.

doc/releases/changelog-dev.md Outdated Show resolved Hide resolved
Comment on lines +820 to +824
initialstate = dev.state.__copy__()

dev._apply_operation(op)

assert qml.math.allclose(dev.state, initialstate)
Copy link
Contributor

Choose a reason for hiding this comment

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

How come the state is being copied here (as opposed to default.qubit where we could compare using is)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

dev._apply_operation updates dev.state itself. So So I have to copy the initial state to be able to compare it later. Since it's copied, I can't use is, as is checks whether its the exact same thing at the same location.

Co-authored-by: antalszava <antalszava@gmail.com>
@antalszava antalszava merged commit 482cd08 into master Mar 23, 2022
@antalszava antalszava deleted the default_mixed_skip_identity branch March 23, 2022 14:07
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.

None yet

2 participants