-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Add pauli() accessor to PauliProductMeasurement #15469
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
Conversation
Add a public accessor method pauli() to PauliProductMeasurement to expose the underlying Pauli object that the instruction measures. This addresses issue Qiskit#15468. - Added pauli() method returning Pauli with z, x, and phase components - Added unit test test_pauli_accessor to verify accessor returns original Pauli - Added release note documenting the new feature The accessor uses the existing internal _pauli_z, _pauli_x, and _pauli_phase attributes to reconstruct the full Pauli object, maintaining compatibility with existing serialization and synthesis code paths.
|
Thank you for opening a new pull request. Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient. While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone. One or more of the following people are relevant to this code:
|
Pull Request Test Coverage Report for Build 20462188496Details
💛 - Coveralls |
Co-authored-by: Julien Gacon <[email protected]>
|
@Cryoris all test are passing and added your review suggestions. |
Cryoris
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM thanks for the addition!
Summary
Add a public accessor method
pauli()toPauliProductMeasurementto expose the underlying Pauli object measured by the instruction.Details and comments
This PR implements the feature requested in #15468 by adding a public
pauli()method to thePauliProductMeasurementclass.Implementation:
pauli() -> Paulimethod that reconstructs the Pauli product from internal z/x/phase components_pauli_z,_pauli_x,_pauli_phase)Testing:
test_pauli_accessor()unit test intest/python/circuit/library/test_ppm.pyPauliProductMeasurement(Pauli("-XZ")).pauli() == Pauli("-XZ")Documentation:
renoinreleasenotes/notes/allow-pauli-accessor-15468.yamlVerification:
Fixes #15468