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

Zoo: [[2^j, 2^-j-2,3]] Gottesman /Quantum Hamming Code #238

Closed
wants to merge 126 commits into from
Closed
Show file tree
Hide file tree
Changes from 96 commits
Commits
Show all changes
126 commits
Select commit Hold shift + click to select a range
3bf0779
Update references.bib
Fe-r-oz Feb 28, 2024
f207dc1
Update references.md
Fe-r-oz Feb 28, 2024
7070155
Update references.md
Fe-r-oz Feb 28, 2024
df8d6b8
Update decoder_pipeline.jl
Fe-r-oz Feb 28, 2024
296c634
Update decoder_pipeline.jl
Fe-r-oz Feb 28, 2024
4032b7f
Create code833
Fe-r-oz Mar 1, 2024
55a4955
Create code833
Fe-r-oz Mar 1, 2024
5242529
Delete src/ecc/code833
Fe-r-oz Mar 1, 2024
fe4b153
Rename code833 to code833.jl
Fe-r-oz Mar 1, 2024
568f31d
Update code833.jl
Fe-r-oz Mar 1, 2024
b39260e
Create code422.jl
Fe-r-oz Mar 1, 2024
e0f960c
Create QHammingcode.jl
Fe-r-oz Mar 1, 2024
3f8a37e
Create hypergraphproductcode.jl
Fe-r-oz Mar 1, 2024
2f63447
Merge pull request #1 from Fe-r-oz/Fe-r-oz-patch-1
Fe-r-oz Mar 1, 2024
344e13b
Update hypergraphproductcode.jl
Fe-r-oz Mar 1, 2024
b81d4de
Update QHammingcode.jl
Fe-r-oz Mar 1, 2024
5d48c01
Update hypergraphproductcode.jl
Fe-r-oz Mar 1, 2024
3ca1cc2
Delete src/ecc/codes/code833.jl
Fe-r-oz Mar 1, 2024
7d1b34d
Delete src/ecc/codes/code422.jl
Fe-r-oz Mar 1, 2024
7e6c48e
Delete src/ecc/codes/hypergraphproductcode.jl
Fe-r-oz Mar 1, 2024
0f43554
Update references.bib
Fe-r-oz Mar 1, 2024
0597d35
Update references.md
Fe-r-oz Mar 1, 2024
9f86c77
Rename QHammingcode.jl to qhammingcode.jl
Fe-r-oz Mar 1, 2024
5997735
Update decoder_pipeline.jl
Fe-r-oz Mar 1, 2024
748b866
Update ECC.jl
Fe-r-oz Mar 1, 2024
d3f00c3
Update ECC.jl
Fe-r-oz Mar 1, 2024
ce21699
Update qhammingcode.jl
Fe-r-oz Mar 2, 2024
683933d
Update test_ecc_encoding.jl
Fe-r-oz Mar 2, 2024
48e2d09
Update test_ecc_syndromes.jl
Fe-r-oz Mar 2, 2024
3b12a0a
Update test_ecc_decoder_all_setups.jl
Fe-r-oz Mar 2, 2024
3f784ea
Update test_ecc.jl
Fe-r-oz Mar 2, 2024
2f0afcf
Update qhammingcode.jl
Fe-r-oz Mar 2, 2024
ccf4499
Add files via upload
Fe-r-oz Mar 2, 2024
fa2fc87
Create test_qhamming_code.jl
Fe-r-oz Mar 2, 2024
042ef3e
Delete docs/src/notebooks/quantumhammingcode.ipynb
Fe-r-oz Mar 3, 2024
f091649
Update test/test_ecc_decoder_all_setups.jl
Fe-r-oz Mar 3, 2024
8547a2d
Update ECC.jl
Fe-r-oz Mar 3, 2024
912321b
Update test_ecc.jl
Fe-r-oz Mar 3, 2024
1a1eefd
Update test_ecc_syndromes.jl
Fe-r-oz Mar 3, 2024
d5187f0
Update test_ecc_encoding.jl
Fe-r-oz Mar 3, 2024
6449d6b
Update references.md
Fe-r-oz Mar 3, 2024
72f2f16
Update ECC.jl
Fe-r-oz Mar 3, 2024
845b7b1
Update test_qhamming_code.jl
Fe-r-oz Mar 3, 2024
73b4c1d
Update test_throws.jl
Fe-r-oz Mar 3, 2024
a1901f5
Update qhammingcode.jl
Fe-r-oz Mar 3, 2024
c8bc9f4
Update ECC.jl
Fe-r-oz Mar 4, 2024
17c66eb
Update qhammingcode.jl
Fe-r-oz Mar 4, 2024
d1945e6
Update qhammingcode.jl
Fe-r-oz Mar 5, 2024
6035ff9
Update and rename qhammingcode.jl to eightqubit.jl
Fe-r-oz Mar 5, 2024
31e0a0e
Update eightqubit.jl
Fe-r-oz Mar 5, 2024
6f6704f
Update ECC.jl
Fe-r-oz Mar 5, 2024
84dfb02
Update test_ecc.jl
Fe-r-oz Mar 5, 2024
e4d0759
Update test_throws.jl
Fe-r-oz Mar 5, 2024
412d54a
Update test_qhamming_code.jl
Fe-r-oz Mar 5, 2024
33fb94b
Merge branch 'QuantumSavory:master' into master
Fe-r-oz Mar 6, 2024
8eb5bb7
Update test_ecc_encoding.jl
Fe-r-oz Mar 6, 2024
d1bc220
Update test_ecc_syndromes.jl
Fe-r-oz Mar 6, 2024
fd4d073
Update test_ecc_decoder_all_setups.jl
Fe-r-oz Mar 6, 2024
e3a1fcf
Update references.md
Fe-r-oz Mar 6, 2024
9364f6c
Create sixteenqubit.jl
Fe-r-oz Mar 6, 2024
1c740cf
Update ECC.jl
Fe-r-oz Mar 6, 2024
e40f1ab
added better names of eccs in the zoo, removed the test_hamming_code …
Mar 7, 2024
733a7ad
minor modifications
Mar 7, 2024
a6d1d1b
minor modifications
Mar 7, 2024
5a2913f
minor modifications
Mar 7, 2024
62fdcbe
tweaking decoders parameters for pedagogical nkd16103
Mar 7, 2024
b572c8f
minor tweak
Mar 7, 2024
32e8676
Gottesman aka Quantum Hamming Code Implementation
Mar 8, 2024
e7e9b40
Original Paramters
Mar 8, 2024
04c62e8
Update src/ecc/codes/gottesman.jl
Fe-r-oz Mar 9, 2024
4ab69ae
Update src/ecc/ECC.jl
Fe-r-oz Mar 9, 2024
1b602f4
Update src/ecc/codes/gottesman.jl
Fe-r-oz Mar 9, 2024
cc8c6e2
Update src/ecc/codes/gottesman.jl
Fe-r-oz Mar 9, 2024
bdac20b
Update src/ecc/codes/gottesman.jl
Fe-r-oz Mar 9, 2024
39344e0
sompleting suggested changes
Mar 9, 2024
f547dd4
Update test/test_ecc_decoder_all_setups.jl
Fe-r-oz Mar 9, 2024
a907f56
Update test/test_ecc_decoder_all_setups.jl
Fe-r-oz Mar 9, 2024
ba2f3ff
suggested changes
Mar 9, 2024
0828eaf
undoing extra lines
Mar 9, 2024
bd16194
minor modification
Mar 9, 2024
63b1093
suggested changes
Mar 9, 2024
d52a03b
completing suggested changes
Mar 9, 2024
3dbd5a3
completing suggested changes
Mar 9, 2024
66255aa
undoing extra lines in files
Mar 9, 2024
e39fd21
undoing extra lines
Mar 9, 2024
67a979c
suggested changes
Mar 9, 2024
c54744f
undoing extra lines
Mar 9, 2024
38aa86f
minor modification
Mar 11, 2024
e50a44b
implementation of Gottesman aka Quantum Hamming Code
Mar 11, 2024
3eb22e1
minor modification
Mar 11, 2024
5c3864e
minor modification
Mar 11, 2024
a0698b7
Gottesman aka quantum Hamming code implementation
Mar 11, 2024
1a7e926
Adding documentation for Gottesman codes aka quantum Hamming codes
Mar 11, 2024
90e52f0
Minor Modification
Mar 11, 2024
ead9bbe
Using Precise Naming Convention
Mar 13, 2024
42cd5ea
Merge branch 'master' into pr/Fe-r-oz/238
Krastanov Mar 16, 2024
227b9d6
relax testing requirements for decoding Gottesman code
Krastanov Mar 16, 2024
ff88de8
Update test/test_ecc_syndromes.jl
Fe-r-oz Mar 16, 2024
536f55c
Update src/ecc/codes/gottesmancode.jl
Fe-r-oz Mar 16, 2024
c5c7d60
resetting parameters to default
Mar 16, 2024
6527546
"resetting to default parameters"
Mar 16, 2024
9e1cc0f
adding separate Hx and Hz checks in Gottesman
Mar 16, 2024
3e5d4a7
Minor Modifications
Mar 16, 2024
035c006
minor modifications
Mar 16, 2024
ffb91a9
minor modifications
Mar 16, 2024
fd0408c
adding Hx and Hz checks in Gottesman
Mar 16, 2024
1d10548
utilizing stab_to_gf2
Mar 16, 2024
475fc80
Minor Modification
Mar 16, 2024
b3c8725
updating changelog
Mar 16, 2024
43a24fb
resolving changelog conflicts
Mar 16, 2024
c00a0ed
undoing whitespaces
Mar 16, 2024
074683c
removing whitespaces
Mar 16, 2024
f39e8b3
Update test/test_ecc.jl
Fe-r-oz Mar 16, 2024
51fbc02
minor modification
Mar 16, 2024
80189ef
resolving conflicts
Mar 16, 2024
f87161a
Implementation of non-CSS Gottesman codes aka quantum Hamming codes
Mar 16, 2024
f07fd2c
Implementation of non-CSS Gottesman codes aka quantum Hamming codes
Mar 16, 2024
8831a55
undoing whitespaces
Mar 16, 2024
73fc7d2
undoing whitespaces
Mar 16, 2024
a753f32
undoing whitespaces
Mar 16, 2024
e55dc19
minor modification
Mar 16, 2024
31c38fe
updating changelog
Mar 16, 2024
9a48cb2
cleanup
Krastanov Mar 16, 2024
d564cd3
Adding Checks
Mar 17, 2024
b218e1e
Merge branch 'master' of https://github.com/Fe-r-oz/QuantumClifford.jl
Mar 17, 2024
f11efa5
improving indentation
Mar 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions docs/src/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -225,3 +225,29 @@ @article{nahum2017quantum
author = {Nahum, Adam and Ruhman, Jonathan and Vijay, Sagar and Haah, Jeongwan},
year = {2017}
}
Fe-r-oz marked this conversation as resolved.
Show resolved Hide resolved

% Key details about [[8, 3, 3]] stabilizer construction via alternative approach

@article{6506105,
author={Yu, Sixia and Bierbrauer, Jürgen and Dong, Ying and Chen, Qing and Oh, C. H.},
journal={IEEE Transactions on Information Theory},
title={All the Stabilizer Codes of Distance 3},
year={2013},
volume={59},
number={8},
pages={5179-5185},
keywords= {Generators;Frequency modulation;Vectors;Educational institutions;Error correction codes;Physics;Indexes;1-error correcting stabilizer codes;optimal codes;quantum error correction;quantum Hamming bound},
doi={10.1109/TIT.2013.2259138}
}

@article{Chao2017QuantumEC,
title={Quantum Error Correction with Only Two Extra Qubits.},
author={Rui Chao and Ben W Reichardt},
journal={Physical review letters},
year={2017},
volume={121 5},
pages={
050502
},
url={https://api.semanticscholar.org/CorpusID:206314271}
}
Fe-r-oz marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 3 additions & 3 deletions src/ecc/ECC.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export parity_checks, parity_checks_x, parity_checks_z,
RepCode,
CSS,
Shor9, Steane7, Cleve8, Perfect5, Bitflip3,
Toric,
Toric, Gottesman,
evaluate_decoder,
CommutationCheckECCSetup, NaiveSyndromeECCSetup, ShorSyndromeECCSetup,
TableDecoder,
Expand Down Expand Up @@ -334,5 +334,5 @@ include("codes/steanecode.jl")
include("codes/shorcode.jl")
include("codes/clevecode.jl")
include("codes/toric.jl")

end #module
include("codes/gottesmancode.jl")
end #module
Fe-r-oz marked this conversation as resolved.
Show resolved Hide resolved
92 changes: 92 additions & 0 deletions src/ecc/codes/gottesmancode.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
"""This class implements the family of [[2^j, 2^j - j - 2, 3]] Gottesman codes, also known as [[2^j, 2^j - j - 2, 3]] quantum Hamming codes, as described in Gottesman's 1997 PhD thesis on 'Stabilizer Codes and Quantum Error Correction' [Gottesman1997](@cite).

Key details for the [[8, 3, 3]] code when j = 3 using Stabilizer Formalism:
- [6506105](@cite) utilizes an explicit construction method for the stabilizer generators. The remaining m generators, apart from Mx and Mz, are constructed using the check matrix [Hm|AmHm], where Hm = [c0, c1, ..., c^2m − 1]. Each column ck (for k = 0, 1, ..., 2^m − 1) represents a binary vector corresponding to the integer k. Also, Am refers to any invertible m × m matrix devoid of fixed points such that Am​.s ≠ 0 and Am.s ≠ s for all s ∈ F₂ᵐ.
- [Chao2017QuantumEC](@cite) introduces alternative stabilizer generators for the [[8, 3, 3]] code. It identifies permutations effective for all stabilizer generators except for X^⊗8 and Z^⊗8. However, these can be replaced with XXYZIYZI and ZZIXYIXY, respectively. The stabilizer generators are permuted to achieve desired properties, reflecting an alternative approach to constructing the stabilizer code.

Notes:
- This implementation adopts the Gottesman Notation for the [[8, 3, 3]] stabilizer code as depicted in Table 3.3 on Page 22 on the Gottesman's PhD thesis. Additionally, for j = 4, our [[16, 10, 3]] stabilizer code stemming from QHamming(4) can be cross-verified from Table 8.1 on Page 91 as well [Gottesman1997](@cite).
- The differences between [6506105](@cite), [Chao2017QuantumEC](@cite), and [Gottesman1997](@cite) primarily lie in the choice of stabilizer generators and their permutations for the [[8, 3, 3]] stabilizer code.
- The discrepancy in stabilizer generator representations underscores the flexibility within the stabilizer formalism, allowing for various valid choices and permutations, albeit with different notations and implementation details.
Fe-r-oz marked this conversation as resolved.
Show resolved Hide resolved
"""

struct Gottesman <: AbstractECC
j::Int
function Gottesman(j)
(j >= 3 && j < 21) || error("In `Gottesman(j)`, `j` must be ≥ 3 in order to obtain a valid code and `j` must be < 21 to remain tractable")
new(j)
end
end

code_n(c::Gottesman) = 2^c.j

function parity_checks(c::Gottesman)
rows = c.j + 2
cols = 2^c.j

Hx = falses(rows,cols)
Hz = falses(rows,cols)

Hx[1, :] .= true
Hx[2, :] .= false

if c.j == 3
for col in 1:cols
Hx[3, col] = (col % 8 == 1 || col % 8 == 3 || col % 8 == 6) ? 0 : 1
end
Hx[3, cols] = Hx[3, cols] == 0 ? 1 : 0
for col in 1:cols
Hx[4, col] = (col % 4 == 1) || (col % 4 == 3) ? 0 : 1
end
for a in 1:cols
Hx[rows, a] = ((a % 4 == 0) || (a % 4 == 1) ? 0 : 1) ⊻ ((a % 8 == 5) || (a % 8 == 6))
end
Hx[end, [end-1, end]] .= [0, 1]

else
for a in 1:cols
Hx[3, a] = (a == 0) || (a % 2 == 0)
end
for row in 4:rows - 1
for col in 1:cols
k = row - 3
m = 2^(c.j - k)
n = 2^(c.j - k)
if (col - 1) % (m + n) < m
if col % 2 == 0
Hx[row, col] = 1
else
Hx[row, col] = 0
end
else
if col % 2 == 0
Hx[row, col] = 0
else
Hx[row, col] = 1
end
end
end
end

for a in 1:cols
Hx[rows, a] = (a % 4 == 0) || (a % 4 == 1) ? 0 : 1
end
end

Hz[1, :] .= false
Hz[2, :] .= true

for i in 3:rows
period = 2^(rows - i)
for a in 1:cols
Hz[i, a] = div(a - 1, period) % 2 == 1
end
end
extended_Hx = Matrix{Bool}(Hz)
extended_Hz = Matrix{Bool}(Hx)

num_rows = size(Hx, 1)

fill_array = fill(UInt8(0), num_rows)
Stabilizer(fill_array, extended_Hz, extended_Hx)
end
4 changes: 2 additions & 2 deletions test/test_ecc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ codes = [
Steane7(),
Shor9(),
Perfect5(),
Cleve8(),
Cleve8(), Gottesman(3), Gottesman(5),
Fe-r-oz marked this conversation as resolved.
Show resolved Hide resolved
CSS([0 1 1 0; 1 1 0 0], [1 1 1 1]),
]

Expand Down Expand Up @@ -76,4 +76,4 @@ end
@test isdegenerate(Steane7()) == false
@test isdegenerate(Steane7(), 2) == true
@test isdegenerate(Bitflip3()) == true
end
end
Fe-r-oz marked this conversation as resolved.
Show resolved Hide resolved
8 changes: 4 additions & 4 deletions test/test_ecc_decoder_all_setups.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import LDPCDecoders
Steane7(),
Shor9(),
Perfect5(),
Cleve8(),
Fe-r-oz marked this conversation as resolved.
Show resolved Hide resolved
Cleve8(), Gottesman(3), Gottesman(5),
Fe-r-oz marked this conversation as resolved.
Show resolved Hide resolved
]

noise = 0.001
Expand Down Expand Up @@ -79,11 +79,11 @@ end

for c in codes
for s in setups
e = evaluate_decoder(PyMatchingDecoder(c), s, 10000)
e = evaluate_decoder(PyMatchingDecoder(c), s, 100000)
Fe-r-oz marked this conversation as resolved.
Show resolved Hide resolved
#@show c
#@show s
#@show e
@assert max(e...) < noise/5
end
end
end
end
Fe-r-oz marked this conversation as resolved.
Show resolved Hide resolved
end
Fe-r-oz marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 3 additions & 3 deletions test/test_ecc_encoding.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ using QuantumClifford
using QuantumClifford.ECC

##

@testset "encoding circuits - compare to algebraic construction of encoded state" begin
# This test verifies that logical measurements on an encoded state match the physical pre-encoded state.
# This test skips verifying the permutations of qubits during canonicalization are properly undone,
Expand All @@ -15,6 +14,8 @@ using QuantumClifford.ECC
:(Shor9()),
:(Perfect5()),
:(Bitflip3()),
:(Gottesman(3)),
:(Gottesman(5)),
:(S"Y_"),
:(S"Z_"),
:(S"X_"),
Expand All @@ -25,7 +26,6 @@ using QuantumClifford.ECC
:(Toric(8,8)),
fill(:(random_stabilizer(5,7)), 100)...
]

code = eval(codeexpr)
if undoperm==false
# Pre-process the tableau to remove permutations and negative phases.
Expand Down Expand Up @@ -55,4 +55,4 @@ using QuantumClifford.ECC

#println("$codeexpr, $(encodedₙ == algebraicₙ)")
end
end
end
4 changes: 2 additions & 2 deletions test/test_ecc_syndromes.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ codes = [
Steane7(),
Shor9(),
Perfect5(),
Cleve8(),
Cleve8(), Gottesman(3), Gottesman(5),
Fe-r-oz marked this conversation as resolved.
Show resolved Hide resolved
CSS([0 1 1 0; 1 1 0 0], [1 1 1 1]),
Toric(3,3),
Toric(3,6),
Expand Down Expand Up @@ -59,4 +59,4 @@ end
for c in codes
pframe_naive_vs_shor_syndrome(c)
end
end
end
Fe-r-oz marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion test/test_throws.jl
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,4 @@ for m in [sMX,sMZ,sMY,sMRX,sMRZ,sMRY]
@test_throws ArgumentError m(-1)
@test_throws ArgumentError m(0,1)
@test_throws ArgumentError m(-1,0)
end
end
Loading