Skip to content

Fix inconsistencies in double factorization cost estimation#1366

Merged
mhucka merged 1 commit into
quantumlib:mainfrom
arettig:df_cost_fix
Jun 18, 2026
Merged

Fix inconsistencies in double factorization cost estimation#1366
mhucka merged 1 commit into
quantumlib:mainfrom
arettig:df_cost_fix

Conversation

@arettig

@arettig arettig commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

This fixes #839. Double factorization uses different precisions for $\theta$ for the first and second factorizations (leading to differences in gate counts), but when estimating the cost of double factorization, the first precision is used for both factorizations. This was corrected and the tests updated to reflect the changed cost function.

Double factorization uses different precisions for theta for the
first and second factorizations, but the cost estimation function
used the first precision for estimating the cost of the second
factorization. This was corrected and tests updated to reflect
the changed cost function.

@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 resolves a bug in the double factorization resource estimation where the variable br (representing bits of precision for rotation) was overwritten. Previously, the first value of br was incorrectly used to calculate the QROM output size (bo) before being overwritten with a value of 7 for the second state preparation. The fix splits br into br_first and br_second, ensuring br_second is defined and used correctly for bo. Test assertions have been updated to reflect the corrected resource estimates. As there are no review comments, I have no feedback to provide.

@mhucka mhucka left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@mhucka mhucka added this pull request to the merge queue Jun 18, 2026
Merged via the queue into quantumlib:main with commit 4c340bc Jun 18, 2026
22 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.

Inconsistencies in the double factorized chemistry resource estimate costing function

2 participants