-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Implement iterating/collecting PauliSumOp coefficients #5547 #5560
Conversation
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.
Very nice. Just a small comment.
The |
It may be unrelated to this PR. There is probably a way to re-run it. |
I triggered a re-run and it passed. Maybe a transient azure issue? |
Summary
Fixes #5547
Details and comments
This fix provides the ability of being able to iterate over, or return a list of coefficients in PauliSumOp. At present, one has to dig into the details to construct the coefficients for each term. In particular, it requires multiplying two numbers for each coeffcient. There are use cases, for instance when bounding the eigenvalues of the operators.
The coeffs property returns a numpy array of the operator obtained by multiplying the coeffs of the primitive by the coefficient provided in the constructor.
The matrix iterator iterates through the Pauli table representing the the PauliSumOp in either sparse or not fashion.