Skip to content

Avoid redundant parity calculation for Pauli amplitude pairs - #838

Open
whahnsr wants to merge 1 commit into
QuEST-Kit:mainfrom
whahnsr:optimize-pauli-pair-parity
Open

whahnsr wants to merge 1 commit into
QuEST-Kit:mainfrom
whahnsr:optimize-pauli-pair-parity

Conversation

@whahnsr

@whahnsr whahnsr commented Oct 20, 2026

Copy link
Copy Markdown

Summary

Compute the parity relationship between paired amplitudes once, outside the hot loop.

Since iB = iA ^ maskXY, the second parity sign can be derived from the first using a precomputed mask-dependent sign. This eliminates one parity calculation per amplitude pair.

Performance

12-qubit, 20-step dynamics benchmark, serial CPU, three paired runs:

  • Original: 14.25 billion CPU cycles (average)
  • Optimized: 13.67 billion CPU cycles (average)
  • Reduction: 4.06%

Validation

Derive the second amplitude's parity sign from the first using a mask-dependent sign computed outside the hot loop.

On a 12-qubit, 20-step dynamics benchmark, this reduces CPU cycles by an average of 4.06% across three paired runs. Numerical output is byte-identical to the reference. Eight relevant Pauli-operation tests pass.

Co-authored-by: ChatGPT <chatgpt@openai.com>

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant