Skip to content

fix(tableau): use FoldHashMap for two-qubit rotation coefficients - #268

Merged
david-pl merged 1 commit into
mainfrom
david/rot2-foldhash
Oct 23, 2026
Merged

david-pl merged 1 commit into
mainfrom
david/rot2-foldhash

Conversation

@david-pl

Copy link
Copy Markdown
Collaborator

GeneralizedTableau::rotate_2 (RXX / RYY / RZZ) accumulated the new coefficients in a std::collections::HashMap. Its SipHash hasher is seeded randomly per process, so the order in which coefficients were written back into the tableau differed from run to run.

This switches it to ppvm_traits::FoldHashMap, the fixed-seed hasher the other tableau coefficient maps have used since #267. That makes the post-rotation coefficient order reproducible within a build, and foldhash is also cheaper than SipHash for integer keys.

cargo test -p ppvm-tableau passes with and without --features rayon, and clippy is clean.

🤖 Generated with Claude Code

rotate_2 accumulated coefficients in a std HashMap, whose random
per-process seed made the coefficient order after RXX/RYY/RZZ vary
between runs. Use the fixed-seed FoldHashMap already used by the other
tableau coefficient maps since #267.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings October 23, 2026 11:55

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The narrow substitution follows the existing map implementation and has no identified blocking issues.

No open issues 🎉

What changed in this PR

This PR aligns two-qubit rotation coefficient accumulation with the fixed-seed hashing introduced in #267, making coefficient ordering reproducible within a build.

Changes:

  • Replaces the standard HashMap with ppvm_traits::FoldHashMap.
  • Uses HashMap::default() to initialize the map without changing rotation logic.
File Description
crates/​ppvm-tableau/​src/​gates/​rot2.rs Uses fixed-seed hashing for RXX, RYY, and RZZ coefficient accumulation.

Review effort: Balanced

@david-pl
david-pl enabled auto-merge (squash) October 23, 2026 11:57
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-23 12:02 UTC

@david-pl
david-pl merged commit 6e8febe into main Oct 23, 2026
16 checks passed
@david-pl
david-pl deleted the david/rot2-foldhash branch October 23, 2026 12:02
@github-actions github-actions Bot mentioned this pull request Oct 23, 2026
david-pl pushed a commit that referenced this pull request Oct 23, 2026
## 🤖 New release

* `ppvm-traits`: 0.1.0 -> 0.1.1 (✓ API compatible changes)
* `ppvm-pauli-word`: 0.1.0 -> 0.1.1 (✓ API compatible changes)
* `ppvm-pauli-sum`: 0.1.0 -> 0.1.1 (✓ API compatible changes)
* `ppvm-sym`: 0.1.0 -> 0.1.1 (✓ API compatible changes)
* `ppvm-tableau`: 0.1.0 -> 0.1.1 (✓ API compatible changes)
* `stim-parser`: 0.1.0 -> 0.1.1 (✓ API compatible changes)
* `ppvm-stim`: 0.1.0 -> 0.1.1 (✓ API compatible changes)
* `ppvm-tableau-sum`: 0.1.0 -> 0.1.1 (✓ API compatible changes)
* `vihaco-circuit-isa`: 0.1.0 -> 0.1.1 (✓ API compatible changes)
* `ppvm-vihaco`: 0.1.0 -> 0.1.1 (✓ API compatible changes)
* `ppvm-tui`: 0.1.0 -> 0.1.1 (✓ API compatible changes)
* `ppvm-cli`: 0.1.0 -> 0.1.1

<details><summary><i><b>Changelog</b></i></summary><p>












## `ppvm-cli`

<blockquote>

##
[0.1.1](v0.1.0...v0.1.1)
- 2026-10-23

### Fixed

- *(hash)* spread high-bit keys across buckets in tableau and Pauli-word
maps ([#267](#267))
- *(tableau)* use FoldHashMap for two-qubit rotation coefficients
([#268](#268))

### Other

- add crates.io READMEs for the published crates
([#265](#265))
</blockquote>


</p></details>

---
This PR was generated with
[release-plz](https://github.com/release-plz/release-plz/).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

2 participants