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

Add LightningQubit2 class #607

Merged
merged 197 commits into from
Mar 15, 2024
Merged

Add LightningQubit2 class #607

merged 197 commits into from
Mar 15, 2024

Conversation

albi3ro
Copy link
Contributor

@albi3ro albi3ro commented Feb 2, 2024

Context:

PennyLane has added a new device interface that will potentially allow for adjoint differentiation to be enabled with lightning by default.

This PR adds the Python API for such a change.

Description of the Change:

This PR adds a LightningQubit2 class.

It relies on three methods, simulate, jacobian and simulate_and_jacobian
Right now, the device restricts itself to analytic simulations.

Benefits:

Users can get the most performant choices automatically, without having to manually request adjoint differentiation.

The internal simulation details are also fully abstracted away from the required device interface, allowing for change and optimizations as the technical details require.

Possible Drawbacks:

This will be a major breaking change to the interface, and users may be relying on the specific names of methods.

Shortcut Stories:
[sc-56080]

Copy link
Contributor

github-actions bot commented Feb 2, 2024

Hello. You may have forgotten to update the changelog!
Please edit .github/CHANGELOG.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.

Copy link

codecov bot commented Feb 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.71%. Comparing base (ad04e24) to head (67cdc90).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #607      +/-   ##
==========================================
+ Coverage   98.44%   98.71%   +0.26%     
==========================================
  Files         172      173       +1     
  Lines       24883    24466     -417     
==========================================
- Hits        24497    24152     -345     
+ Misses        386      314      -72     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@albi3ro albi3ro changed the base branch from master to lightning-qubit2-add-simulate February 16, 2024 19:02
Copy link
Contributor

@vincentmr vincentmr left a comment

Choose a reason for hiding this comment

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

One last round of comments, but I'm ready to approve.

pennylane_lightning/lightning_qubit/lightning_qubit2.py Outdated Show resolved Hide resolved
tests/lightning_qubit2/test_no_binaries.py Outdated Show resolved Hide resolved
tests/test_adjoint_jacobian.py Outdated Show resolved Hide resolved
Copy link
Contributor

@vincentmr vincentmr left a comment

Choose a reason for hiding this comment

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

This is massive :) Happy to approve the PR at this point. Thanks for all the hard work @mudit2812 and @albi3ro .

Copy link
Contributor

@AmintorDusko AmintorDusko left a comment

Choose a reason for hiding this comment

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

Great work here! Thank you @mudit2812, @albi3ro and @vincentmr for the awesome work!
Please don't forget the changelog!

Copy link
Member

@maliasadi maliasadi left a comment

Choose a reason for hiding this comment

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

Great work! 🥳

.github/workflows/tests_linux.yml Outdated Show resolved Hide resolved
.github/workflows/tests_without_binary.yml Outdated Show resolved Hide resolved
pennylane_lightning/core/_serialize.py Show resolved Hide resolved
pennylane_lightning/lightning_qubit/lightning_qubit2.py Outdated Show resolved Hide resolved
pennylane_lightning/lightning_qubit/lightning_qubit2.py Outdated Show resolved Hide resolved
pennylane_lightning/lightning_qubit2 Outdated Show resolved Hide resolved
mudit2812 and others added 2 commits March 15, 2024 16:12
Co-authored-by: Ali Asadi <10773383+maliasadi@users.noreply.github.com>
Copy link
Member

@maliasadi maliasadi left a comment

Choose a reason for hiding this comment

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

🪂

@mudit2812 mudit2812 merged commit a3071d3 into master Mar 15, 2024
85 checks passed
@mudit2812 mudit2812 deleted the lightning-qubit2-interface branch March 15, 2024 21:05
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.

5 participants