-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[[2ᵐ - 1, 1, 3]]
quantum Reed-Muller code (#302)
--------- Co-authored-by: Fe-r-oz <[email protected]> Co-authored-by: Stefan Krastanov <[email protected]> Co-authored-by: Stefan Krastanov <[email protected]>
- Loading branch information
1 parent
a9af4b0
commit f420834
Showing
8 changed files
with
159 additions
and
3 deletions.
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 |