fixed issue 8438 PauliList.evolve raises exception#8453
Conversation
|
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 the following people are requested to review this:
|
|
Great! Thank you for fixing the bug. This fix looks good. |
Pull Request Test Coverage Report for Build 2818990759
💛 - Coveralls |
I will add the test and release not, but I have to find out how to do this. |
|
added test added release note |
Co-authored-by: Ikko Hamamura <ikkoham@users.noreply.github.com>
Co-authored-by: Ikko Hamamura <ikkoham@users.noreply.github.com>
jakelishman
left a comment
There was a problem hiding this comment.
I'm not certain this is the fully correct solution to the problem here - see #8438 (comment) for my other reasoning.
|
@jakelishman You are completely right. We should pass dtype when we call |
|
As already discussed it is not necessary to modify the _count_y because dtype handling there looks correct for what the function does. The more correct solution is to ensure that whatever's calling that is passing np.uint8 as the dtype when it's going to bind the result to a uint8 context, or it manually cast. The caller can be found in the exception handling of the example: ~/anaconda3/envs/qiskit/lib/python3.9/site-packages/qiskit/quantum_info/operators/symplectic/base_pauli.py in _evolve_cz(base_pauli, q1, q2 In the example we use an evolve over the phase. This is done by the evolve_cz function. In line 663 the phase vector is set by: To cast the phase vector to a uint8 we can do: Summary I'll be happy to go further with this PR if this is the way to go. |
|
Sorry for the lack of responses here. The underlying issue appears to have been fixed by #8877, so I'll close this PR as obsolete now, but please feel free to open another PR if I've missed anything. |
Summary
This pull request is fix for issue #8438
Title
PauliList.evolve raises exception when evolving certain Clifford circuits
Details and comments
changed in file base_pauli.py
if dtype is None:
dtype = np.min_scalar_type(x.shape[axis])