Repository navigation
fix(hash): spread high-bit keys across buckets in tableau and Pauli-word maps - #267
Merged
Merged
Conversation
MSRudolph
requested review from
Roger-luo and
david-pl
and
a balanced review from Copilot
October 23, 2026 09:44
Contributor
Author
|
The peripheral Lindblad test change is because it accidentally relied on insertion order. |
Contributor
|
Roger-luo
approved these changes
Oct 23, 2026
Roger-luo
left a comment
Collaborator
There was a problem hiding this comment.
I don't see any public user interface breaking in this PR, so I think it's totally fine.
|
|
||
| /// Fast hasher for internal maps and word hashes, with a fixed seed. | ||
| /// Iteration is reproducible for the same build and insertion order. | ||
| pub type FastBuildHasher = foldhash::fast::FixedState; |
Collaborator
There was a problem hiding this comment.
should we just call it FoldBuildHasher? Fast is quite general, the convention here should be transparent about what downstream hasher we are using.
MSRudolph
enabled auto-merge (squash)
October 23, 2026 11:30
Merged
david-pl
added a commit
that referenced
this pull request
Oct 23, 2026
`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](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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>
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.
FxHash clusters branch indices and Pauli words that differ mainly in their high bits. This made T gates much slower once extended-stabilizer runs crossed 16,384 coefficients.
This PR uses foldhash for branch-index maps, cached Pauli-word hashes, and the tableau fingerprint fallback on builds without AES. It keeps existing configuration types and uses a fixed seed for reproducible iteration within a build. It also initializes identity-word hashes correctly.
Regression tests cover high-bit key distribution and identity-word map lookups. One Lindblad test now tolerates tiny rounding differences caused by the changed summation order.
Representative timings on an Apple M4 Pro, release builds, medians:
Just the hash map
usize)u128)U256)U2048)Full simulations
rayon)TFIM term counts and noisy-distillation branch probabilities match
mainexactly. Workspace tests, tableau tests withrayon, Clippy, and formatting checks pass.