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

[new opmath] Deprecation warnings and making LinearCombination.compare more user friendly #5504

Merged
merged 20 commits into from
Apr 24, 2024

Conversation

Qottmann
Copy link
Contributor

@Qottmann Qottmann commented Apr 12, 2024

Removing LinearCombination._obs_data, which requires updating LinearCombination.compare. While at it, also updating the doc string to make it clear.

Potential Drawbacks

A comparison with an Observable that has no pauli_rep (i.e. involving a Hadamard) will not work due to https://github.com/PennyLaneAI/pennylane/blob/master/pennylane/ops/functions/equal.py#L160. I consider this a separate issue for updating qml.equal accordingly. Alternative solution is to give Hadamard a pauli_rep.

op1, op2 = (qml.ops.LinearCombination([1.0], [qml.Hadamard(0)]), qml.Hadamard(0))
op1, op2 = (qml.ops.LinearCombination([1.0], [qml.Hadamard(0) @ qml.Hadamard(1)]), qml.Hadamard(0) @ qml.Hadamard(1))
op1, op2 = (qml.ops.LinearCombination([1.0], [qml.Hadamard(0) @ X(1)]), qml.Hadamard(0) @ X(1))

[sc-59339]

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 Apr 12, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.68%. Comparing base (10d59e7) to head (2857505).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5504      +/-   ##
==========================================
- Coverage   99.69%   99.68%   -0.01%     
==========================================
  Files         410      410              
  Lines       38247    37944     -303     
==========================================
- Hits        38130    37826     -304     
- Misses        117      118       +1     

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

@Qottmann Qottmann requested a review from trbromley April 15, 2024 10:37
Copy link
Contributor

@trbromley trbromley left a comment

Choose a reason for hiding this comment

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

Thanks @Qottmann!

pennylane/ops/op_math/linear_combination.py Outdated Show resolved Hide resolved
tests/ops/op_math/test_linear_combination.py Show resolved Hide resolved
@albi3ro albi3ro requested a review from mudit2812 April 19, 2024 15:52
@Alex-Preciado Alex-Preciado changed the title [new opmath] Depcreation warnings and making LinearCombination.compare more user friendly [new opmath] Deprecation warnings and making LinearCombination.compare more user friendly Apr 19, 2024
Copy link
Contributor

@astralcai astralcai 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! Just a small comment.

pennylane/ops/op_math/linear_combination.py Outdated Show resolved Hide resolved
@trbromley trbromley added this to the v0.36 milestone Apr 19, 2024
@Qottmann Qottmann enabled auto-merge (squash) April 24, 2024 10:15
@Qottmann Qottmann merged commit f504341 into master Apr 24, 2024
37 checks passed
@Qottmann Qottmann deleted the newopmathdeprecations branch April 24, 2024 10:47
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.

4 participants