-
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
binary golay code #276
base: master
Are you sure you want to change the base?
binary golay code #276
Conversation
Benchmark ResultJudge resultBenchmark Report for /home/runner/work/QuantumClifford.jl/QuantumClifford.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTarget
Baseline
Target resultBenchmark Report for /home/runner/work/QuantumClifford.jl/QuantumClifford.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Baseline resultBenchmark Report for /home/runner/work/QuantumClifford.jl/QuantumClifford.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Runtime information
Architecture: x86_64
Benchmark ResultJudge resultBenchmark Report for /home/runner/work/QuantumClifford.jl/QuantumClifford.jlJob Properties
ResultsA ratio greater than
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfoTarget
Baseline
Target resultBenchmark Report for /home/runner/work/QuantumClifford.jl/QuantumClifford.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Baseline resultBenchmark Report for /home/runner/work/QuantumClifford.jl/QuantumClifford.jlJob Properties
ResultsBelow is a table of this job's results, obtained by running the benchmarks.
Benchmark Group ListHere's a list of all the benchmark groups executed by this job:
Julia versioninfo
Runtime information
Architecture: x86_64
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #276 +/- ##
==========================================
+ Coverage 82.85% 82.95% +0.10%
==========================================
Files 60 61 +1
Lines 3971 4013 +42
==========================================
+ Hits 3290 3329 +39
- Misses 681 684 +3 ☔ View full report in Codecov by Sentry. |
Kindly please review these short PRs @Krastanov 🙏🏼. The sequence of review of PRs can be 277, 276, 254. Thank you 🙏🏼 |
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.
Thanks, this is pretty cool!
Here are a couple of minor comments. I have not reviewed the tests in detail yet.
|
||
2. Extended Binary `[[24, 12, 8]]` Golay code: Obtained by adding a parity check bit to `[[23, 12, 7]]`. The bordered reverse circulant matrix `(A)` of `[[24, 12, 8]]` Golay code is self-dual, i.e., A₂₄ is same as A₂₄'. | ||
|
||
Parity Check Matrix `(H)`: `H` is defined as follows: `H₂₄ = [I₁₂ | A']` where `I₁₂` is the 12 x 12 identity matrix and `A` is a bordered reverse circulant matrix. |
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.
On wikipedia they seem to be implying that this is the generator matrix, not the parity check matrix.
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.
There two notations people use either H= [I | A], G = [A| I], or H= [A | I ], G = [I | A] where I is identity matrix and A is the bordered reverse circulant matrix.
In this paper, H is described as H= [I | A]. This website also describes it as H = [I |A ].
Golay Codes are self-dual (C = C⊥) , H = [A | I ], G = [I | A]. H and G are canonically equivalent as we take their reduced row echelon form.
Wikipedia describes G = [ I| A ], so H = [A| I ]. Wolfram Mathwork follows this notation as well: https://mathworld.wolfram.com/GolayCode.html
Huffman and Pless Book (Section 1.9) formulation of binary Golay Codes is used. I will add generator to make it clear which notation we are following and a test of self-duality.
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.
Huffman and Pless Book (Section 1.9) formulation of binary Golay Codes is used.
In the recent papers about quantum Golay Code [[23, 1, 7]] and classical golay paper, the notation used for H = [A | I ] and G = [I | A]. This is same notation used by Wikipedia for G.
Thus, let's use this notation rather than Huffman and Pless (which is currently used). This make sure the consistency of notation b/w classical and quantum codes.
src/ecc/codes/classical/golay.jl
Outdated
|
||
Construction method for `A` [huffman2010fundamentals](@cite): The columns of `A` are labeled by ∞, 0, 1, 2, ..., 10. The first row contains 0 in column ∞ and 1 elsewhere. To obtain the second row, a 1 is placed in column ∞ and a 1 is placed in columns 0, 1, 3, 4, 5, and 9; these numbers are precisely the squares of the integers modulo 11. That is, 0² = 0, 1² ≡ 10² ≡ 1 (mod 11), 2² ≡ 2² ≡ 4 (mod 11), etc. The third row of `A` is obtained by putting a 1 in column ∞ and then shifting the components in the second row one place to the left and wrapping the entry in column 0 around to column 10. The fourth row is obtained from the third in the same manner, as are the remaining rows. | ||
|
||
Punctured Code: All punctured codes are equivalent. Adding an overall parity check to `H₂₃` recovers `H₂₄`. |
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.
This probably needs an elaboration. I am not sure what "all punctured codes are equivalent" means.
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.
I took it from this except from Huffman and Pless book:
"It turns out, as we will see later, that all these punctured codes are equivalent. By Exercise 59, adding an overall parity check to one of these punctured codes (in the same position which had been punctured) gives exactly the same G 24 back.
Exercise 59: Prove that if G 24 is punctured in any coordinate and the resulting code is extended in the same position, exactly the same code G 24 is obtained. Hint: See Exercise 27."
In less fancy terms, this paper mentions punturing as deleting one coordinate position from the reverse circulant matrix (deleting one column -- they deleted the last one) to make the [23, 1, 7] Golay code.
Adding a test about would be exciting.
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.
I have added elaboration and a test:
Elaboration:
Puncturing and then extending any column in with an overall parity check H₂₃
reconstructs the original parity check matrix H₂₄
. Thus, all punctured codes are equivalent.
Test:
"""
Test the equivalence of punctured and extended code by verifying that puncturing the binary parity check matrix H₂₄ in any coordinate and then extending it by
adding an overall parity check in the same position yields the original matrix H₂₄.
Steps:
1. Puncture the Code: Remove the i-th column from H₂₄ to create a punctured matrix H₂₃. Note: H₂₃ = H[:, [1:i-1; i+1:end]]
2. Extend the Code: Add a column in the same position to ensure each row has even parity. Note: H'₂₄ = [H₂₃[:, 1:i-1] c H₂₃[:, i:end]]. Here, c is a column vector added to ensure
each row in H'₂₄ has even parity.
3. Equivalence Check: Verify that H'₂₄ = H₂₄.
"""
function puncture_code(mat, i)
return mat[:, [1:i-1; i+1:end]]
end
function extend_code(mat, i)
k, _ = size(mat)
extended_mat = hcat(mat[:, 1:i-1], zeros(Bool, k, 1), mat[:, i:end])
# Calculate the parity for each row
for row in 1:k
row_parity = sum(mat[row, :]) % 2 == 1
extended_mat[row, i] = row_parity
end
return extended_mat
end
for i in 1:24
punctured_mat = puncture_code(H, i)
extended_mat = extend_code(punctured_mat, i)
# Test equivalence
@test extended_mat == H
end
Thanks for helpful comments. Improvements include:
|
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.
Same frustrating situation like with the other PR, due to the recent rework of the test suite: this needs a rebase. Apologies for the inconvenience :(
There are two members of classical Golay Binary codes in the literature, namely the [[24, 12, 8]] and [[23, 12, 7]]. The latter can be obtained by puncturing the former. The former is described via Huffman construction method.