Skip to content

Conversation

@qec-pconner
Copy link
Contributor

  • Adding operator[] to ReferenceSampleTree.
    • Allows quick access to any reference sample bit within the tree at a given absolute index.
  • Updating src/stim/util_top/reference_sample_tree.test.cc to check bit positions, as applicable.

* Adding `operator[]` to `ReferenceSampleTree`.
  * Allows quick access to any reference sample bit within the tree at a given absolute index.
* Updating `src/stim/util_top/reference_sample_tree.test.cc` to check bit positions, as applicable.
* Faster random access.
  * Iterate once for shallow access (if desired index is in first pass), also measures size.
  * From desired index and size, extrapolate iteration value.
  * Jump forward to the correct iteration value and iterate through childen (second pass).
* Adding `<< "index: " << index`  output for `ASSERT_EQ` in `src/stim/util_top/reference_sample_tree.test.cc` for easier test debugging.
…or[]` for a tree of >10^17 bits (encoded into 5 nodes).

  * Iterates over the beginning, the end, and 1 outer repetition before the end.
  * Test case finishes in <1ms.
  * Helps detect when the size of any node is larger than `ULLONG_MAX` instead of silently overflowing.
@qec-pconner qec-pconner force-pushed the reference_sample_tree_random_access branch from c4ba19e to f9188e2 Compare August 4, 2025 22:50
  * Better compat for inconsistent `long` vs `long long` ABIs.
  * `unsigned long long` necessary (instead of just `uint64_t`) due to incompatible type usage between ABIs.
… support for BMI2.

* Adding windows-specific overflow check, via `_umul128()`.
* Adding fallback overflow check in `#else` clause.
  * `_umul128()` not supported on 32-bit windows.
  * 32-bit windows will then fallback to the `#else`'s general assertion.
@Strilanc Strilanc merged commit 901b630 into quantumlib:main Aug 6, 2025
62 checks passed
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