-
Notifications
You must be signed in to change notification settings - Fork 204
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
Fix MeasureMulti*PauliSum #288
Fix MeasureMulti*PauliSum #288
Conversation
self.measure_multiple_times returns a [len(obs_list), num_wires] tensor, you have to take the product over the wires first to get the measurement of the Pauli string and then sum over the obs_list (multiplied by coefficients in the case of MeasureMultiQubitPaulisum.
I don't think NumPy 2 has the "complex_" datatype any more . This last commit, strictly speaking, has nothing to do with MeasureMultiPauliSum, but should get the workflows to run. I have run the workflow
locally and it finishes fine with NumPy 1.26.1. |
Yeah, thanks for the fix, haven’t yet looked at breaking changes from numpy 2.0. I’ll likely open a PR for that later. |
Thanks! I can reverse that commit on requirements.txt if need be at least the workflows run now, the linting problem is that expval is defined when running measurements.py as main, while expval is also the name of a function. The fix is just to rename the expval in the main block at the bottom, can include it here if you want it, but it is a really straightforward fix. |
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.
This looks good to me, thanks for the PR! I’ll merge into dev!
79ce996
into
mit-han-lab:dev
Not sure whether I am misunderstanding the function.
self.measure_multiple_times returns a [len(obs_list), num_wires] tensor, you have to take the product over the wires first to get the measurement of the Pauli string and then sum over the obs_list (multiplied by coefficients in the case of MeasureMultiQubitPaulisum.