Skip to content

Fix LightCone sparse observable ordering - #16942

Open
Christopher Rivera (chrisriv10) wants to merge 1 commit into
Qiskit:mainfrom
chrisriv10:fix/16866-light-cone-order
Open

Fix LightCone sparse observable ordering#16942
Christopher Rivera (chrisriv10) wants to merge 1 commit into
Qiskit:mainfrom
chrisriv10:fix/16866-light-cone-order

Conversation

@chrisriv10

Copy link
Copy Markdown

Summary

Fixes #16866.

LightCone reverses the positional association between sparse observable bit_terms and indices.

Sparse observable terms associate positionally as bit_terms[i] -> indices[i], while PauliGate uses Qiskit's dense Pauli ordering, where the rightmost character acts on local qubit 0. Passing bit_terms directly to PauliGate therefore reverses asymmetric multi-qubit observables.

This can cause LightCone to perform commutation checks against the wrong observable and incorrectly remove gates, changing expectation values.

Details

  • Reverse bit_terms when constructing the initial PauliGate, preserving the positional association with indices.
  • Add a regression test for an asymmetric "XZ" observable on qubits [0, 1].
  • Update two existing test expectations that depended on the reversed ordering.
  • Add a release note for the bug fix.

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

  • No part of this submission is LLM generated.
  • Some written text was generated by: ChatGPT (OpenAI), Claude (Anthropic)
  • Some submitted code was generated by: AI coding agents using OpenAI and Anthropic models

@CLAassistant

CLAassistant commented Sep 6, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ShellyGarion Shelly Garion (ShellyGarion) added mod: transpiler Issues and PRs related to Transpiler Community PR PRs from contributors that are not 'members' of the Qiskit repo labels Sep 6, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community PR PRs from contributors that are not 'members' of the Qiskit repo mod: transpiler Issues and PRs related to Transpiler

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

LightCone reverses the association between bit_terms and observable indices

5 participants