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

devices.qubit.measure uses csr_dot_products only when it is usable. #6278

Merged
merged 19 commits into from
Sep 19, 2024

Conversation

astralcai
Copy link
Contributor

@astralcai astralcai commented Sep 17, 2024

There are a couple of scenarios when csr_dot_products is not usable for Sum and Hamiltonians:

  1. When not all of the ops has a sparse matrix
  2. When it's a legacy Hamiltonian and one of the ops are multi-wired.

Fixes #6264

[sc-73590]
[sc-73868]

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.

Copy link

codecov bot commented Sep 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.69%. Comparing base (cbc5a9d) to head (da9e3c1).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6278      +/-   ##
==========================================
- Coverage   99.69%   99.69%   -0.01%     
==========================================
  Files         443      444       +1     
  Lines       42022    42133     +111     
==========================================
+ Hits        41894    42004     +110     
- Misses        128      129       +1     

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

Copy link
Contributor

@mudit2812 mudit2812 left a comment

Choose a reason for hiding this comment

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

Since a new property is added to Operator, we should probably also add tests for it

Copy link
Contributor

@PietropaoloFrisoni PietropaoloFrisoni left a comment

Choose a reason for hiding this comment

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

This looks good! I just have a couple of questions. Is this PR relevant for this bug?

pennylane/devices/qubit/measure.py Show resolved Hide resolved
tests/devices/qubit/test_measure.py Outdated Show resolved Hide resolved
@astralcai
Copy link
Contributor Author

This looks good! I just have a couple of questions. Is this PR relevant for this bug?

Yes, Fixes #6264

Copy link
Contributor

@PietropaoloFrisoni PietropaoloFrisoni left a comment

Choose a reason for hiding this comment

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

LGTM

@astralcai astralcai enabled auto-merge (squash) September 19, 2024 19:31
@astralcai astralcai merged commit 4ae7113 into master Sep 19, 2024
37 checks passed
@astralcai astralcai deleted the fix-measure branch September 19, 2024 20:23
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.

[BUG] measure assumes all LinearCombination objects provide a sparse matrix
3 participants