Skip to content

fix: CompactDataBlock.n_tiles() missing paper's +3 term (#1943) - #1949

Open
kkoci wants to merge 1 commit into
quantumlib:mainfrom
kkoci:fix-compact-data-block-plus-3
Open

kkoci wants to merge 1 commit into
quantumlib:mainfrom
kkoci:fix-compact-data-block-plus-3

Conversation

@kkoci

@kkoci kkoci commented Sep 10, 2026

Copy link
Copy Markdown

Closes #1943.

Main's current n_tiles() computes ceil(1.5 * n_algo_qubits + 2). This differs from the cited paper (Litinski, arXiv:1808.02892, page 7, Fig. 9: "A compact block stores n data qubits in 1.5n+3 tiles") due to operator precedence ceil(1.5*n + 2) is not the same as ceil(1.5*(n+2)) for most n (e.g. n=2 gives 5 here, vs. the paper-correct 6).

This adds parentheses to match the paper: ceil(1.5 * (n_algo_qubits + 2)), algebraically 1.5n+3, matching the fix proposed and agreed on in the issue discussion.

Before: n_algo_qubits=2 -> 5 tiles
After: n_algo_qubits=2 -> 6 tiles (matches the paper)

Added a parametrized test in data_block_test.py (test_compact_block) covering n=2, 4, 100 against the paper-correct tile count.

@google-cla

google-cla Bot commented Sep 10, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@gemini-code-assist gemini-code-assist Bot 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.

Code Review

This pull request updates the n_tiles calculation in CompactDataBlock to add 2 to the number of algorithm qubits before performing the calculation. It also adds corresponding unit tests in data_block_test.py to verify this behavior. There are no review comments, so I have no feedback to provide.

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.

CompactDataBlock uses ceil(1.5*n) instead of the paper's 1.5*n + 3 (arXiv:1808.02892, Fig. 9)

1 participant