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

Bicycle and Unicycle codes: Fixing doc and method errors #425

Open
wants to merge 22 commits into
base: master
Choose a base branch
from

Conversation

Benzillaist
Copy link
Contributor

@Benzillaist Benzillaist commented Nov 13, 2024

Hi! I finally got around to addressing the problems with my previous commits. I made a few changes:

  • Updated doc strings to be consistent with the rest of the code
  • Added appropriate citation links
  • Fixed issue with outdated method calls in 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.

Benzillaist and others added 21 commits October 31, 2023 19:40
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
Copy link
Member

@Krastanov Krastanov left a 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.

@@ -561,3 +561,22 @@ @article{haah2011local
pages={042330},
year={2011},
}

@article{mackay_sparse-graph_2004,
Copy link
Member

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
Copy link
Member

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

return comp_matrix
end

"""Attempts to generate a list of indices to be used in a bicycle code using a search method"""
Copy link
Member

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?

Copy link
Contributor Author

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?

"""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)
Copy link
Member

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.

Copy link
Contributor Author

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

Comment on lines 244 to 245
circ_arr::Array{Int} = [0]
diff_arr::Array{Int} = []
Copy link
Member

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

julia> O = typeof(Bicycle(4, 2))
Bicycle

julia> O = parity_checks(Bicycle(4, 2))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
julia> O = parity_checks(Bicycle(4, 2))
julia> parity_checks(Bicycle(4, 2))

+ XXXX
+ ZZZZ

julia> O = parity_checks(Bicycle(6, 4))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
julia> O = parity_checks(Bicycle(6, 4))
julia> parity_checks(Bicycle(6, 4))

Comment on lines 38 to 43
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
Copy link
Member

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?

Comment on lines 53 to 54
"""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)
Copy link
Member

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

Comment on lines 1 to 2
"""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)
Copy link
Member

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)

@Krastanov Krastanov marked this pull request as draft November 15, 2024 20:34
@Krastanov
Copy link
Member

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
@Benzillaist Benzillaist marked this pull request as ready for review November 16, 2024 06:34
@Benzillaist
Copy link
Contributor Author

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!

Copy link
Member

@Krastanov Krastanov left a 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
Copy link
Member

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},
}
}
Copy link
Member

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:

image

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)"""
Copy link
Member

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?

Comment on lines +245 to +247
circ_arr = Int[0]
diff_arr = Int[]
circ_arr[1] = 0
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants