-
Notifications
You must be signed in to change notification settings - Fork 47
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
[[2ᵐ - 1, 1, 3]]
quantum Reed-Muller code
#302
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2ee0c48
quantum Reed-Muller code
11c2a42
Adding tests
c35472f
Adding a separate test file for quantum reed-muller codes
65f8a2c
add to run tests
9c2770d
Merge branch 'master' into qrm
Fe-r-oz 2e814e7
misc cleanup
Fe-r-oz 23b47ee
Merge branch 'master' into qrm
Fe-r-oz d3ffedc
clean up the error message and do not forbid arbitrarily large codes …
Krastanov ba4ad1e
make the test more legible (the `//` characters were never meant to b…
Krastanov 0459549
make the parity_checks_x and parity_checks_z tests more thorough
Krastanov 026e483
use stab_to_gf2 since H is Bool and parity_checks return Stabilizer
Fe-r-oz f1538dd
Add BitFlipDecoder for quantum ReedMuller codes
Fe-r-oz 758eb26
slightly reorganize tests
Krastanov e7e1420
Merge branch 'master' into pr/Fe-r-oz/302
Krastanov bf16aaa
changelog
Krastanov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
""" | ||
The family of `[[2ᵐ - 1, 1, 3]]` CSS Quantum-Reed-Muller codes, as discovered by Steane in his 1999 paper [steane1999quantum](@cite). | ||
|
||
Quantum codes are constructed from shortened Reed-Muller codes `RM(1, m)`, by removing the first row and column of the generator matrix `Gₘ`. Similarly, we can define truncated dual codes `RM(m - 2, m)` using the generator matrix `Hₘ` [anderson2014fault](@cite). The quantum Reed-Muller codes `QRM(m)` derived from `RM(1, m)` are CSS codes. | ||
|
||
Given that the stabilizers of the quantum code are defined through the generator matrix of the classical code, the minimum distance of the quantum code corresponds to the minimum distance of the dual classical code, which is `d = 3`, thus it can correct any single qubit error. Since one stabilizer from the original and one from the dual code are removed in the truncation process, the code parameters are `[[2ᵐ - 1, 1, 3]]`. | ||
|
||
You might be interested in consulting [anderson2014fault](@cite) and [campbell2012magic](@cite) as well. | ||
|
||
The ECC Zoo has an [entry for this family](https://errorcorrectionzoo.org/c/quantum_reed_muller). | ||
""" | ||
struct QuantumReedMuller <: AbstractECC | ||
m::Int | ||
function QuantumReedMuller(m) | ||
if m < 3 | ||
throw(DomainError("Invalid parameters: m must be bigger than 2 in order to have a valid code.")) | ||
end | ||
new(m) | ||
end | ||
end | ||
|
||
function iscss(::Type{QuantumReedMuller}) | ||
return true | ||
end | ||
|
||
function parity_checks(c::QuantumReedMuller) | ||
RM₁₋ₘ = generator(RecursiveReedMuller(1, c.m)) | ||
RM₍ₘ₋₂₎₋ₘ₎ = generator(RecursiveReedMuller(c.m-2, c.m)) | ||
QRM = CSS(RM₁₋ₘ[2:end, 2:end], RM₍ₘ₋₂₎₋ₘ₎[2:end, 2:end]) | ||
Stabilizer(QRM) | ||
end | ||
|
||
code_n(c::QuantumReedMuller) = 2^c.m - 1 | ||
|
||
code_k(c::QuantumReedMuller) = 1 | ||
|
||
distance(c::QuantumReedMuller) = 3 | ||
|
||
parity_checks_x(c::QuantumReedMuller) = stab_to_gf2(parity_checks(QuantumReedMuller(c.m)))[1:c.m, 1:end÷2] | ||
|
||
parity_checks_z(c::QuantumReedMuller) = stab_to_gf2(parity_checks(QuantumReedMuller(c.m)))[end-(code_n(c::QuantumReedMuller)-2-c.m):end, end÷2+1:end] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
@testitem "Quantum Reed-Muller" begin | ||
using Test | ||
using Nemo: echelon_form, matrix, GF | ||
using LinearAlgebra | ||
using QuantumClifford | ||
using QuantumClifford: canonicalize!, Stabilizer, stab_to_gf2 | ||
using QuantumClifford.ECC | ||
using QuantumClifford.ECC: AbstractECC, QuantumReedMuller, Steane7, CSS | ||
|
||
function designed_distance(mat) | ||
dist = 3 | ||
for row in eachrow(mat) | ||
count = sum(row) | ||
if count < dist | ||
return false | ||
end | ||
end | ||
return true | ||
end | ||
|
||
@testset "Test QuantumReedMuller(r,m) properties" begin | ||
for m in 3:10 | ||
stab = parity_checks(QuantumReedMuller(m)) | ||
H = stab_to_gf2(stab) | ||
@test designed_distance(H) == true | ||
# QuantumReedMuller(3) is the Steane7 code. | ||
@test canonicalize!(parity_checks(Steane7())) == parity_checks(QuantumReedMuller(3)) | ||
@test code_n(QuantumReedMuller(m)) == 2^m - 1 | ||
@test code_k(QuantumReedMuller(m)) == 1 | ||
@test distance(QuantumReedMuller(m)) == 3 | ||
@test H == stab_to_gf2(parity_checks(CSS(parity_checks_x(QuantumReedMuller(m)), parity_checks_z(QuantumReedMuller(m))))) | ||
# [[15,1,3]] qrm code from table 1 of https://arxiv.org/pdf/1705.0010 | ||
qrm₁₅₁₃ = S"ZIZIZIZIZIZIZIZ | ||
IZZIIZZIIZZIIZZ | ||
IIIZZZZIIIIZZZZ | ||
IIIIIIIZZZZZZZZ | ||
IIZIIIZIIIZIIIZ | ||
IIIIZIZIIIIIZIZ | ||
IIIIIZZIIIIIIZZ | ||
IIIIIIIIIZZIIZZ | ||
IIIIIIIIIIIZZZZ | ||
IIIIIIIIZIZIZIZ | ||
XIXIXIXIXIXIXIX | ||
IXXIIXXIIXXIIXX | ||
IIIXXXXIIIIXXXX | ||
IIIIIIIXXXXXXXX" | ||
@test canonicalize!(parity_checks(qrm₁₅₁₃)) == canonicalize!(parity_checks(QuantumReedMuller(4))) | ||
end | ||
end | ||
end |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, good catch