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

Refactor Identity op to be part of qubit and cv modules #1956

Merged
merged 15 commits into from
Dec 2, 2021
Merged

Conversation

dime10
Copy link
Contributor

@dime10 dime10 commented Nov 30, 2021

Context: The Identity operation currently is added directly to the ops module, not being part of either ops.qubit or ops.cv, as it is common to both. However, this means there is no easy way to query which ops are supported by PennyLane on qubits only, or to selectively import them.

For example, the list given by qml.ops.qubit.ops does not include the string "Identity", and from qml.ops.qubit import * does not make the class Identity available.

Description of the Change:

  • Move the Identity class to a separate file (from ops/__init__.py).
  • Make the Identity operation part of both the qubit and cv modules.

Benefits: All supported qubit operations are now part of the qubit module, and similarly for the supported continuous variable operations.

Possible Drawbacks:

Related GitHub Issues:

@dime10 dime10 requested a review from Jaybsoni November 30, 2021 17:01
@github-actions
Copy link
Contributor

Hello. You may have forgotten to update the changelog!
Please edit doc/releases/changelog-dev.md with:

  • A one-to-two sentence description of the change. You may include a small working example for new features.
  • A link back to this PR.
  • Your name (or GitHub username) in the contributors section.

@dime10
Copy link
Contributor Author

dime10 commented Nov 30, 2021

[sc-11906]

@codecov
Copy link

codecov bot commented Nov 30, 2021

Codecov Report

Merging #1956 (52039d5) into master (a14abd1) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1956   +/-   ##
=======================================
  Coverage   98.81%   98.81%           
=======================================
  Files         224      225    +1     
  Lines       17307    17310    +3     
=======================================
+ Hits        17102    17105    +3     
  Misses        205      205           
Impacted Files Coverage Δ
pennylane/ops/__init__.py 100.00% <100.00%> (ø)
pennylane/ops/cv.py 100.00% <100.00%> (ø)
pennylane/ops/identity.py 100.00% <100.00%> (ø)
pennylane/ops/qubit/__init__.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 a14abd1...52039d5. Read the comment docs.

pennylane/ops/common.py Outdated Show resolved Hide resolved
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 to me! 🎉 Thank you for catching this and tidying it. 🙂

@josh146 josh146 merged commit 2695f66 into master Dec 2, 2021
@josh146 josh146 deleted the move_identity branch December 2, 2021 13:28
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

4 participants