Repository navigation
Fix controlled GF2MulK decomposition when control is 0 - #1966
rupasri118 wants to merge 2 commits into
Conversation
|
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. |
|
Updated the controlled GF2 multiplication decomposition to use explicit TwoBitSwap operations for controlled permutations while preserving wire reordering for uncontrolled synthesis. Validation:
|
3924131 to
a4b8900
Compare
|
Hi @Strilanc ! I've been working on a fix for this issue and have pushed the changes along with regression tests. Could you please review the proposed approach and let me know if any changes are needed? Thank you for your time and guidance! |
Summary
Fixes #1951.
The permutation step in
SynthesizeLRCircuitwas implemented using direct Soquet rewiring. WhenGF2MulKwas controlled, this permutation remained unconditional, causing the decomposed circuit to modify the target register even when the control qubit was 0.This change represents the permutation using
TwoBitSwap, making it an explicit Bloq that can be correctly controlled during decomposition.Changes
TwoBitSwapinSynthesizeLRCircuit.GF2MulKdecomposition.ctrl=0leaves the input unchanged.ctrl=1performs multiplication by the specified constant.Testing
test_multiply_by_constant_controlled_decomposition— passedtest_synthesize_lr_circuit— 8 passedgf2_multiplication_test.pyexcluding notebook tests — 78 passed before a long-running test was interrupted.