-
Notifications
You must be signed in to change notification settings - Fork 23
Fix small code bugs for FT Stateprep #267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
If a code has a number of qubits that is a power of 2, then the assertion in `_generate_circ_with_bounded_gates` that makes sure the bitvector variables encoding the CNOT qubits act only on valid qubits erroneously asserts that control and target should be less than 0. This of course always returns `False`.
Computing (d-1)//2 as the maximum number of errors is incorrect for codes with even distance.
This reverts commit 5e2ccfc.
So far we assumed that we always want to have an error correction code and thus the maximum number of independent errors in the circuit was computed as (d-1)//2. But for an error detection code we allow d//2 independent errors. For this I introduced a flag `error_detection_code` in the `StatePrepCircuit` class so that the errors are computed correctly. Furthermore, if d=2 this flag is set automatically.
ad84eba
to
c8213b8
Compare
Rebasing to main because the other PR might be awhile |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #267 +/- ##
=====================================
Coverage 82.5% 82.5%
=====================================
Files 46 46
Lines 3985 3997 +12
Branches 362 362
=====================================
+ Hits 3288 3298 +10
- Misses 697 699 +2
*This pull request uses carry forward flags. Click here to find out more.
|
The patch coverage is incorrect due to the concurrent execution of processes. All new functionality is covered and the diff of the project does not change. |
Description
This PR fixes some issues with certain codes.
There was a bug when the code was defined over a number of qubits, which is an exact power of 2, leading to the optimal state prep circuit failing to be synthesized.
Another issue occurred when looking at d=2 codes, which cannot be used for error correction but only for error detection. I have added functionality to set whether one wants to create the circuit for error detection or error correction in the
StatePrepCircuit
class.Fixes #265
Checklist: