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

Fix qml.probs for lightning.tensor #906

Merged
merged 13 commits into from
Sep 11, 2024
Merged

Fix qml.probs for lightning.tensor #906

merged 13 commits into from
Sep 11, 2024

Conversation

multiphaseCFD
Copy link
Member

@multiphaseCFD multiphaseCFD commented Sep 11, 2024

Before submitting

Please complete the following checklist when submitting a PR:

  • All new features must include a unit test.
    If you've fixed a bug or added code that should be tested, add a test to the
    tests directory!

  • All new functions and code must be clearly commented and documented.
    If you do make documentation changes, make sure that the docs build and
    render correctly by running make docs.

  • Ensure that the test suite passes, by running make test.

  • Add a new entry to the .github/CHANGELOG.md file, summarizing the
    change, and including a link back to the PR.

  • Ensure that code is properly formatted by running make format.

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.


Context:

[SC-73501]

cutensornet's Accessor API allows the users to extract single state amplitudes (elements of the state tensor), slices of state amplitudes (slices of the state tensor) as well as the full state tensor. Previous implementation summed up the slices of the state tensor and compute the probabilities, which was a bug. This PR sums up the prob of each slices of the state tensor and fixes the bug.

Description of the Change:

Benefits:

Analytic probs is supported

Possible Drawbacks:

The computation cost could be too expensive to afford if the number of projected wires is large.

Related GitHub Issues:

@maliasadi maliasadi added the urgent Mark a pull request as high priority label Sep 11, 2024
@multiphaseCFD multiphaseCFD marked this pull request as ready for review September 11, 2024 16:24
Copy link

codecov bot commented Sep 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.88%. Comparing base (ef3a8cc) to head (410e833).
Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff             @@
##           master     #906       +/-   ##
===========================================
+ Coverage   40.29%   97.88%   +57.59%     
===========================================
  Files          39      212      +173     
  Lines        2683    28279    +25596     
===========================================
+ Hits         1081    27681    +26600     
+ Misses       1602      598     -1004     

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

@multiphaseCFD multiphaseCFD added the bug-fix Indicates this fixes a known bug label Sep 11, 2024
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.

If possible, could you point out the bug in a comment for future reference?

@multiphaseCFD
Copy link
Member Author

If possible, could you point out the bug in a comment for future reference?

Sure, added it to the PR description.

Copy link
Contributor

@LuisAlfredoNu LuisAlfredoNu left a comment

Choose a reason for hiding this comment

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

Nice job @multiphaseCFD! I made a few comments 👍

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.

Looks good to me, thanks @multiphaseCFD .

Copy link
Contributor

@LuisAlfredoNu LuisAlfredoNu left a comment

Choose a reason for hiding this comment

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

LGTM Thank you @multiphaseCFD for fixing a bug! I left a question for future discussion 🚀

@multiphaseCFD multiphaseCFD merged commit dbd2cc4 into master Sep 11, 2024
101 checks passed
@multiphaseCFD multiphaseCFD deleted the fix_probs_ltensor branch September 11, 2024 21:20
multiphaseCFD added a commit that referenced this pull request Sep 11, 2024
Please complete the following checklist when submitting a PR:

- [ ] All new features must include a unit test.
If you've fixed a bug or added code that should be tested, add a test to
the
      [`tests`](../tests) directory!

- [ ] All new functions and code must be clearly commented and
documented.
If you do make documentation changes, make sure that the docs build and
      render correctly by running `make docs`.

- [ ] Ensure that the test suite passes, by running `make test`.

- [x] Add a new entry to the `.github/CHANGELOG.md` file, summarizing
the
      change, and including a link back to the PR.

- [x] Ensure that code is properly formatted by running `make format`.

When all the above are checked, delete everything above the dashed
line and fill in the pull request template.

------------------------------------------------------------------------------------------------------------

**Context:**

[SC-73501]

`cutensornet`'s `Accessor` API allows the users to extract single state
amplitudes (elements of the state tensor), slices of state amplitudes
(slices of the state tensor) as well as the full state tensor. Previous
implementation summed up the slices of the state tensor and compute the
probabilities, which was a bug. This PR sums up the prob of each slices
of the state tensor and fixes the bug.

**Description of the Change:**

**Benefits:**

Analytic probs is supported

**Possible Drawbacks:**

The computation cost could be too expensive to afford if the number of
projected wires is large.

**Related GitHub Issues:**

---------

Co-authored-by: ringo-but-quantum <github-ringo-but-quantum@xanadu.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fix Indicates this fixes a known bug urgent Mark a pull request as high priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants