Skip to content
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

add random Clifford circuit codes #298

Merged
merged 15 commits into from
Jul 4, 2024

Conversation

royess
Copy link
Contributor

@royess royess commented Jun 20, 2024

Add implementations of random Clifford circuit codes, whose connectivity can be all-to-all or brickwork in some dimensions.

Some notes:

  1. While preparing this PR, I found that this notebook have implemented a 1D brickwork random circuit codes. This PR provides more connectivity choices and uses AbstractOperations[] of sparse gates for the generated circuit, which should be more efficient and allow visualization.
  2. I do not include random circuit codes in ecc_decoder_all_setups in this PR. The reason is that to ensure a good code parameter, the code has to contain more than 10 qubits, which exceeds the size that TableDecoder can efficiently handle. Random circuit codes are not CSS and are currently unsupported by PyMatchingDecoder.
  3. For a reference, I did some more tests in royess/qecc-devlog/test_random_circuit.ipynb, including visualizing the encoding circuits and decoding via TableDecoder. In the future, we may consider including these contents as tutorials or documentation.

@royess
Copy link
Contributor Author

royess commented Jun 20, 2024

@Krastanov, please help review this PR; thanks! (The failed CI check is related to #245 )

@royess royess marked this pull request as ready for review June 20, 2024 02:36
Copy link
Member

@Krastanov Krastanov left a comment

Choose a reason for hiding this comment

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

This is great! You mentioned how it does not work well with many decoders. How does it perform with belief propagation and OSD decoders?

src/ecc/codes/random_circuit.jl Outdated Show resolved Hide resolved
src/ecc/codes/random_circuit.jl Outdated Show resolved Hide resolved
src/ecc/codes/random_circuit.jl Outdated Show resolved Hide resolved
src/ecc/codes/random_circuit.jl Outdated Show resolved Hide resolved
src/ecc/codes/random_circuit.jl Outdated Show resolved Hide resolved
@royess royess marked this pull request as draft June 20, 2024 05:34
@royess
Copy link
Contributor Author

royess commented Jun 20, 2024

You mentioned how it does not work well with many decoders.

Actually, TableDecoder can give a rather low logical error rate, as I tested in this notebook.

However, we need random circuit codes with more than 10 qubits, e.g., 20 qubits, to ensure the randomly generated codes have a distance larger than 0. This will make TableDecoder inefficient and trigger warnings due to #291.

How does it perform with belief propagation and OSD decoders?

BP and BP-OSD in PyQDecoders.jl (as well as earlier mentioned PyMatchingDecoder ) are not applicable to random circuit codes because they are non-CSS.

"Codes of type CircuitCode do not have separate X and Z parity checks, either because they are not a CSS code and thus inherently do not have separate checks, or because its separate checks are not yet implemented in this library."

Stacktrace:
 [1] parity_checks_x(code::CircuitCode)
   @ QuantumClifford.ECC ~/Documents/Repos/QuantumClifford.jl/src/ecc/ECC.jl:41
 [2] QuantumCliffordPyQDecodersExt.PyBeliefPropOSDecoder(c::CircuitCode; maxiter::Nothing, bpmethod::Nothing, errorrate::Nothing, osdmethod::Nothing, osdorder::Int64)
   @ QuantumCliffordPyQDecodersExt ~/Documents/Repos/QuantumClifford.jl/ext/QuantumCliffordPyQDecodersExt/QuantumCliffordPyQDecodersExt.jl:51
 [3] QuantumCliffordPyQDecodersExt.PyBeliefPropOSDecoder(c::CircuitCode)
   @ QuantumCliffordPyQDecodersExt ~/Documents/Repos/QuantumClifford.jl/ext/QuantumCliffordPyQDecodersExt/QuantumCliffordPyQDecodersExt.jl:50
 [4] PyBeliefPropOSDecoder(args::CircuitCode; kwargs::@Kwargs{})
   @ QuantumClifford.ECC ~/Documents/Repos/QuantumClifford.jl/src/ecc/decoder_pipeline.jl:297
 [5] PyBeliefPropOSDecoder(args::CircuitCode)
   @ QuantumClifford.ECC ~/Documents/Repos/QuantumClifford.jl/src/ecc/decoder_pipeline.jl:292
 [6] top-level scope
   @ ./In[27]:14

Copy link

codecov bot commented Jun 20, 2024

Codecov Report

Attention: Patch coverage is 88.46154% with 6 lines in your changes missing coverage. Please review.

Project coverage is 82.97%. Comparing base (dddaedb) to head (2fc7cda).

Files Patch % Lines
src/ecc/codes/random_circuit.jl 73.91% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #298      +/-   ##
==========================================
+ Coverage   82.85%   82.97%   +0.12%     
==========================================
  Files          60       61       +1     
  Lines        3971     4023      +52     
==========================================
+ Hits         3290     3338      +48     
- Misses        681      685       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@royess royess requested a review from Krastanov June 20, 2024 10:15
@royess royess marked this pull request as ready for review June 20, 2024 10:15
Copy link
Member

@Krastanov Krastanov left a comment

Choose a reason for hiding this comment

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

a few more minor stylistic changes

src/ecc/codes/random_circuit.jl Outdated Show resolved Hide resolved
src/ecc/codes/random_circuit.jl Outdated Show resolved Hide resolved
src/randoms.jl Outdated Show resolved Hide resolved
test/test_ecc_base.jl Outdated Show resolved Hide resolved
@Krastanov Krastanov marked this pull request as draft June 22, 2024 21:32
@Krastanov
Copy link
Member

What is the current status?

@royess
Copy link
Contributor Author

royess commented Jun 29, 2024

I did not fully comprehend some of your previous review comments and was waiting for your further replies on them.

I will get this PR updated quickly.

@royess royess marked this pull request as ready for review June 29, 2024 02:47
@royess royess requested a review from Krastanov June 29, 2024 02:48
Copy link
Member

@Krastanov Krastanov left a comment

Choose a reason for hiding this comment

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

looks good, but there are a few stylistic changes that I would like, to make it a bit more in the style of the rest of the library

src/ecc/codes/random_circuit.jl Outdated Show resolved Hide resolved
src/randoms.jl Outdated Show resolved Hide resolved
src/randoms.jl Show resolved Hide resolved
src/ecc/codes/random_circuit.jl Show resolved Hide resolved
src/ecc/codes/random_circuit.jl Outdated Show resolved Hide resolved
@royess royess requested a review from Krastanov July 2, 2024 16:32
@Krastanov Krastanov merged commit 59e399d into QuantumSavory:master Jul 4, 2024
15 checks passed
@Krastanov
Copy link
Member

Wonderful! Thanks for the addition

@royess royess deleted the randomcircuit branch July 5, 2024 00:26
Fe-r-oz pushed a commit to Fe-r-oz/QuantumClifford.jl that referenced this pull request Sep 9, 2024
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