Accept rotation gate names in CommutationChecker filters#16409
Accept rotation gate names in CommutationChecker filters#16409peter941221 wants to merge 6 commits into
Conversation
892d160 to
762bfd2
Compare
762bfd2 to
095318c
Compare
|
Pushed 095318c. I moved the I rebuilt the Rust extension and reran: |
|
This is a copy-pasted message. At the moment, you have 9 open PRs, and it seems that most of them were created using an LLM with little to no human involvement in the process. Talking to LLMs is not a good use of reviewers' time. I strongly suggest keeping only 1 or 2 PRs that you are willing to invest your own time and effort in as a human, and closing the rest. |
|
I narrowed this PR to the named-filter behavior only and dropped the empty-set assertion. I closed the other open PRs, so this and #16388 are the two active ones. |
c2ec85e to
4588045
Compare
CommutationCheckerused to map parameterized rotation gates to their generators before it applied the optionalgatesfilter. With a filter like{"rx"}, anRXGatepair was normalized to"x"first, so the filter rejected it before the commutation lookup.This PR keeps the filter keyed to the public gate names and still keeps generator normalization for the commutation logic itself. A filter like
{"rx"}now acceptsRXGatepairs from #16407, while unrelated filters such as{"rz"}still returnFalse.The regression coverage checks:
RXGatereproducer from the issue withgates={"rx"}gates={"x"}gates={"rx", "x"}gates={"rz"}Tests run:
python -m unittest test.python.circuit.test_commutation_checker.TestCommutationChecker.test_parameterized_gates_when_gates_specified test.python.circuit.test_commutation_checker.TestCommutationChecker.test_parameterized_gatespython -m unittest test.python.circuit.test_commutation_checkercargo fmt --all --checkpython -m ruff check test/python/circuit/test_commutation_checker.pyFix #16407
AI/LLM disclosure
OpenAI GPT-5 Codex
OpenAI GPT-5 Codex