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 1999] Correct attributes #2113

Merged
merged 16 commits into from
Jan 20, 2022
Merged

[Bugfix 1999] Correct attributes #2113

merged 16 commits into from
Jan 20, 2022

Conversation

mariaschuld
Copy link
Contributor

Context:

It was noted that the existing attributes miss some gates and, in one case, contain a wrong gate.

Adding the IsingZZ to is_diagonal_in_z_basis uncovered an issue: Since it does not have _eigvals defined, the eigenvalues are computed from the matrix using a numpy module, which means they are not differentiable in a backpropagation pipeline.

I think this is an issue with inferring the eigenvalues from a matrix in a non-diffable manner, which goes against the grain of PL. For now we fix it by warning of this issue.

Description of the Change:

Remove/add gates. Add _eigvals method to IsingZZ and explain the _eigvals requirement in the attributes docstring.

Benefits: Fixes #1999

@cvjjm
Copy link
Contributor

cvjjm commented Jan 19, 2022

Nice work!

@josh146
Copy link
Member

josh146 commented Jan 19, 2022

@mariaschuld I may hold off on reviewing until the tests are passing if that is okay!

@mariaschuld
Copy link
Contributor Author

@mariaschuld I may hold off on reviewing until the tests are passing if that is okay!

Sorry @josh146 I should not have tagged you before checking the tests, this 20 min wait is too much for my impatience :)

@codecov
Copy link

codecov bot commented Jan 20, 2022

Codecov Report

Merging #2113 (ce84181) into master (dd50a7f) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #2113   +/-   ##
=======================================
  Coverage   99.19%   99.19%           
=======================================
  Files         228      228           
  Lines       17534    17558   +24     
=======================================
+ Hits        17393    17417   +24     
  Misses        141      141           
Impacted Files Coverage Δ
pennylane/drawer/representation_resolver.py 99.43% <ø> (ø)
pennylane/ops/qubit/__init__.py 100.00% <ø> (ø)
pennylane/ops/qubit/attributes.py 100.00% <ø> (ø)
pennylane/devices/default_qubit.py 100.00% <100.00%> (ø)
pennylane/drawer/tape_mpl.py 100.00% <100.00%> (ø)
pennylane/math/is_independent.py 100.00% <100.00%> (ø)
pennylane/math/multi_dispatch.py 100.00% <100.00%> (ø)
pennylane/ops/qubit/non_parametric_ops.py 97.43% <100.00%> (+0.05%) ⬆️
pennylane/ops/qubit/parametric_ops.py 99.83% <100.00%> (+<0.01%) ⬆️
pennylane/templates/state_preparations/basis.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 dd50a7f...ce84181. Read the comment docs.

Copy link
Member

@josh146 josh146 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 to me, thanks @mariaschuld!

@mariaschuld mariaschuld merged commit 7cb6965 into master Jan 20, 2022
@mariaschuld mariaschuld deleted the correct-attributes branch January 20, 2022 12:39
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.

Consequences of removing DiagonalOperation
3 participants