Fix LightCone sparse observable ordering - #16942
Open
Christopher Rivera (chrisriv10) wants to merge 1 commit into
Open
Fix LightCone sparse observable ordering#16942Christopher Rivera (chrisriv10) wants to merge 1 commit into
Christopher Rivera (chrisriv10) wants to merge 1 commit into
Conversation
Christopher Rivera (chrisriv10)
marked this pull request as ready for review
September 6, 2026 06:56
Christopher Rivera (chrisriv10)
requested a review
from a team
as a code owner
September 6, 2026 06:56
Christopher Rivera (chrisriv10)
requested review from
Jake Lishman (jakelishman)
and
a lite review from Copilot
September 6, 2026 06:56
Jake Lishman (jakelishman)
left a comment
Member
There was a problem hiding this comment.
Thanks for the interest. I've left a discussion comment that we need to resolve before we can decide what the correct fix is: #16866 (comment).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #16866.
LightConereverses the positional association between sparse observablebit_termsandindices.Sparse observable terms associate positionally as
bit_terms[i] -> indices[i], whilePauliGateuses Qiskit's dense Pauli ordering, where the rightmost character acts on local qubit 0. Passingbit_termsdirectly toPauliGatetherefore reverses asymmetric multi-qubit observables.This can cause
LightConeto perform commutation checks against the wrong observable and incorrectly remove gates, changing expectation values.Details
bit_termswhen constructing the initialPauliGate, preserving the positional association withindices."XZ"observable on qubits[0, 1].Testing
python -m pytest test/python/transpiler/test_light_cone.py -v— 22 passed.ruff check qiskit/transpiler/passes/optimization/light_cone.py test/python/transpiler/test_light_cone.py— passed.black --check qiskit/transpiler/passes/optimization/light_cone.py test/python/transpiler/test_light_cone.py— passed.AI/LLM disclosure