-
Notifications
You must be signed in to change notification settings - Fork 48
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
Bicycle and Unicycle codes: Fixing doc and method errors #425
base: master
Are you sure you want to change the base?
Conversation
Added multiple methods: code_generation: - Methods for creating Bicycle and Unicycle codes - Methods for assembling CSS codes - Utility methods for working with codes code_evaluation: - Methods for evaluating codes with a belief propagation decoder
Added the following dependencies: CairoMakie LDPCDecoders SparseArrays Statistics
During discussion with Anthony, he mentioned that he would add his code himself later on
- Fixed naming and organization issued identified. - Limited exports - Added additional methods to easily create unicycle and bicycle codes
- Fixed issues with typing in bicycle gen methods - Fixed issue with incorrectly copied methods for unicycle generation - Fixed imports for Nemo methods
Fixed bugs preventing the generation of Bicycle and Unicycle codes
Remove LDPCDecoders import Co-authored-by: Stefan Krastanov <[email protected]>
Remove LDPCDecoders import Co-authored-by: Stefan Krastanov <[email protected]>
Updated use case description Co-authored-by: Stefan Krastanov <[email protected]>
Remove unused import Co-authored-by: Stefan Krastanov <[email protected]>
Update use case of Bicycle matrix Co-authored-by: Stefan Krastanov <[email protected]>
Updated CSS struct to use Hx and Hz instead of just the full tableau form. Updated CSS methods to work with the new struct form
- Added more jldoctests for methods - Updated method descriptions with updated names - Fixed broken reduce_unicycle method - Added doc links to referenced papers
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.
Thank you, this is shaping really well! I have not reviewed everything yet, but here is a first pass of things that can be polished a bit.
docs/src/references.bib
Outdated
@@ -561,3 +561,22 @@ @article{haah2011local | |||
pages={042330}, | |||
year={2011}, | |||
} | |||
|
|||
@article{mackay_sparse-graph_2004, |
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 reference already exists in the bib file, no need to add it again
test/test_ecc.jl
Outdated
end | ||
end | ||
|
||
function |
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 seems to be causing a syntax error in the test runner
src/ecc/codes/simple_sparse_codes.jl
Outdated
return comp_matrix | ||
end | ||
|
||
"""Attempts to generate a list of indices to be used in a bicycle code using a search method""" |
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.
Where is this algorithm from? Could you add that to the docstring?
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 came up with it myself using the definition of a perfect difference set -- should I include a link to some article or definition on perfect difference sets?
src/ecc/codes/simple_sparse_codes.jl
Outdated
"""Attempts to generate a list of indices to be used in a bicycle code using a randomized check method | ||
|
||
Note: This is very slow for large N""" | ||
function bicycle_set_gen_rand(N::Int, d::Int) |
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.
Is this still used anywhere? If not, we should probably remove it.
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.
Sounds good! I'm not really using it for anything, potentially thought it could be used to see some interesting results, but I agree that it's not superbly useful
src/ecc/codes/simple_sparse_codes.jl
Outdated
circ_arr::Array{Int} = [0] | ||
diff_arr::Array{Int} = [] |
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.
the type-assert should be Vector{Int}
-- Array{Int}
is not concrete as it does not specify a dimmension, so type-stability will not be guaranteed.
This would also be more simply done as circ_arr = Int[0]
, etc
src/ecc/codes/simple_sparse_codes.jl
Outdated
julia> O = typeof(Bicycle(4, 2)) | ||
Bicycle | ||
|
||
julia> O = parity_checks(Bicycle(4, 2)) |
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.
julia> O = parity_checks(Bicycle(4, 2)) | |
julia> parity_checks(Bicycle(4, 2)) |
src/ecc/codes/simple_sparse_codes.jl
Outdated
+ XXXX | ||
+ ZZZZ | ||
|
||
julia> O = parity_checks(Bicycle(6, 4)) |
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.
julia> O = parity_checks(Bicycle(6, 4)) | |
julia> parity_checks(Bicycle(6, 4)) |
src/ecc/codes/simple_sparse_codes.jl
Outdated
if n%2 == 1 | ||
throw(DomainError(m, " N should be a multiple for 2 for bicycle codes.")) | ||
end | ||
if n < 2 | ||
throw(DomainError(m, " N is too small, make it greater than 1.")) | ||
end |
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.
maybe in the error constructor you want n
?
src/ecc/codes/simple_sparse_codes.jl
Outdated
"""Takes a height and width of matrix and generates a unicycle code to the specified height and width. | ||
Based on codes from [mackay_sparse-graph_2004](@cite) |
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.
The parameters do not seem to actually be height and width of a matrix
src/ecc/codes/simple_sparse_codes.jl
Outdated
"""Takes a height and width of matrix and generates a bicycle code to the specified height and width. | ||
Based on codes from [mackay_sparse-graph_2004](@cite) |
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 reads a bit more like a documentation for a function, not documentation for a type or structure. Start with saying what this thing is, only then worry about what the input parameters are (which is already said under the Paraments
header)
I converted it to draft to make it a bit easier for me to manage my review queue. |
Focused on updating the struct docstrings to be more descriptive of what the code is/does. Additionally cleaned up miscellaneous aspects of the code and remove unused function in simple_sparse_codes.jl
Hi Stefan, thanks for the review! I went back through and updated a few things with a focus on the function headers. Please let me know if there are any other things that you'd like me to check for! |
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.
A few more points. Mostly interested in learning more about the generating algorithm for the bicycle case.
@test code_n(c) == 180 && code_k(c) == 8 | ||
end | ||
end | ||
# @testitem "ECC Bivaraite Bicycle as 2BGA" begin |
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.
You seem to have commented out a bunch of tests.
Checking out the files
tab on github pull requests helps in catching this type of issues.
@@ -560,4 +560,4 @@ @article{haah2011local | |||
number={4}, | |||
pages={042330}, | |||
year={2011}, | |||
} | |||
} |
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.
A couple of files have their ending byte modified. For consistency and to keep the git history clean, it helps to set your editor to automatically take care of these.
In vscode for instance:
you can include these entries:
{
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"editor.rulers": [92],
"files.eol": "\n"
}
return comp_matrix | ||
end | ||
|
||
"""Attempts to generate a list of indices to be used in a bicycle code using a search method given a matrix width (N)""" |
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.
why "attempts"? Is this algorithm from the paper? Can you specify where in it if it is. If not, could you explain what the user should worry about with it?
circ_arr = Int[0] | ||
diff_arr = Int[] | ||
circ_arr[1] = 0 |
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.
circ_arr
already has its first element set to 0
in the first line
Hi! I finally got around to addressing the problems with my previous commits. I made a few changes:
reduce_unitary
If you have the chance to review this and let me know if you want me to fix anything else, that would be great! Thanks so much :)
I was unable to open the previous pull request so I made a new one here.