Fix factor of 2 in Rz operator in trotter_export_to_qgates_test.py#1380
Conversation
A factor of 2 discrepancy between the definition of the Rz(theta) operator is corrected when exporting to QASM format.
There was a problem hiding this comment.
Code Review
This pull request updates the coefficient calculations for the C-Phase and Rz gates generated in pauli_exp_to_qasm within trotter_exp_to_qgates.py. Specifically, it doubles the coefficient for the Rz gate when no ancilla is used, and flips the signs for C-Phase and Rz gates when an ancilla is used. Corresponding unit tests in trotter_exp_to_qgates_test.py have been updated to reflect these new coefficient values. No review comments were provided, so there is no feedback to address.
|
It's weird how Gemini Code Assist is all over some PRs, and other ones it just kinda wipes its hands and says "eh, not my concern." |
mhucka
left a comment
There was a problem hiding this comment.
Thanks for doing this. I have some comments that are not critical, so I approved the PR and will leave it to you to address them (or not) before merging.
Implemented suggested changes to eliminate redundant code and avoid copying of lists.
Fixes #721 (supersedes #1343). A factor of 2 error in Rz gates is corrected when outputting a Trotter decomposition to QASM (for both the controlled and uncontrolled versions). The corresponding tests are also corrected.