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

[WIP] Add is_hermitian property to Operator #2629

Merged
merged 10 commits into from
May 31, 2022
Merged

Conversation

Jaybsoni
Copy link
Contributor

Context:
Typically we use the type of an object to determine whether it can be used in a MeasurementProcess. We explicitly check if the type is Observable. This conflicts with operator-arithmetic classes which may or may not be observables depending on the instance. (eg. a Sum of observables may not be an observable unless their coefficients were real)

Description of the Change:
Add a property is_hermitian to the base Operator class, use this to determine if an operator can be used in a MeasurementProcess.

@Jaybsoni Jaybsoni changed the title Add is_hermitian property to Operator [WIP] Add is_hermitian property to Operator May 27, 2022
@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.

@Jaybsoni Jaybsoni added WIP 🚧 Work-in-progress op-arithmetic PR's involved in introducing operator arithmetic labels May 27, 2022
@Jaybsoni Jaybsoni requested a review from albi3ro May 27, 2022 16:19
@codecov
Copy link

codecov bot commented May 27, 2022

Codecov Report

Merging #2629 (3bf72ba) into master (e40c47e) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #2629   +/-   ##
=======================================
  Coverage   99.58%   99.58%           
=======================================
  Files         244      244           
  Lines       19667    19673    +6     
=======================================
+ Hits        19585    19591    +6     
  Misses         82       82           
Impacted Files Coverage Δ
pennylane/measurements.py 99.57% <100.00%> (ø)
pennylane/operation.py 96.54% <100.00%> (+0.03%) ⬆️

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 e40c47e...3bf72ba. Read the comment docs.

@Jaybsoni Jaybsoni removed the WIP 🚧 Work-in-progress label May 30, 2022
@Jaybsoni
Copy link
Contributor Author

[sc-20262]

pennylane/measurements.py Outdated Show resolved Hide resolved
pennylane/measurements.py Outdated Show resolved Hide resolved
pennylane/measurements.py Outdated Show resolved Hide resolved
Copy link
Contributor

@albi3ro albi3ro 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 👍

@Jaybsoni Jaybsoni merged commit 8265d21 into master May 31, 2022
@Jaybsoni Jaybsoni deleted the hermitian_property branch May 31, 2022 04:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
op-arithmetic PR's involved in introducing operator arithmetic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants