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

Draft
wants to merge 24 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.

docs/src/references.bib Outdated Show resolved Hide resolved
test/test_ecc.jl Outdated Show resolved Hide resolved
src/ecc/codes/simple_sparse_codes.jl Outdated Show resolved Hide resolved
src/ecc/codes/simple_sparse_codes.jl Outdated Show resolved Hide resolved
src/ecc/codes/simple_sparse_codes.jl Outdated Show resolved Hide resolved
src/ecc/codes/simple_sparse_codes.jl Outdated Show resolved Hide resolved
src/ecc/codes/simple_sparse_codes.jl Outdated Show resolved Hide resolved
src/ecc/codes/simple_sparse_codes.jl Outdated Show resolved Hide resolved
src/ecc/codes/simple_sparse_codes.jl Outdated Show resolved Hide resolved
src/ecc/codes/simple_sparse_codes.jl Outdated Show resolved Hide resolved
@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/test_ecc_bivaraite_bicycle_as_twobga.jl Outdated Show resolved Hide resolved
docs/src/references.bib Show resolved Hide resolved
src/ecc/codes/simple_sparse_codes.jl Outdated Show resolved Hide resolved
src/ecc/codes/simple_sparse_codes.jl Outdated Show resolved Hide resolved
…et_gen

Made some small changes to the structure of the code, but primarily edited bicycle_set_gen. Added information about how the method works, what problems one can encounter, and what it returns.
@Benzillaist
Copy link
Contributor Author

Hi Stefan, I added a little description to the index generation method covering some information I thought was relevant! Please let me know if you think anything is missing from the description :)

@Benzillaist Benzillaist marked this pull request as draft November 23, 2024 06:39
@Benzillaist Benzillaist marked this pull request as ready for review November 23, 2024 06:39
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.

Finally got around to reviewing, thank you for your patience!

I think this is the last round of review -- this is very close to merging.

Do you think you would have a chance of looking into the change requests? I would be interested in adding this code to the wiki

Comment on lines +24 to +29
struct Bicycle
"Width of array, should be >= 2. Equal to number to number of physical qubits (N)"
n::Int
"Height of array, should be >= 2 and a multiple of 2. Equal to number of parity checks (M)"
m::Int
end
Copy link
Member

Choose a reason for hiding this comment

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

I think my main remaining request for change is related to the distinction between a structure and a function.

An instance of the type Bicycle should be a fully defined code where quickly and deterministically one can get a parity check matrix. The "quick" part is nice to have, but "deterministic" is mandatory.

Here, I think this is not deterministic. On the other hand the output of bicycle_set_gen seems to be all you need to be able to deterministically do the other steps. Thus I would suggest having set be an entry here, basically the way you have already done it for Unicycle.

That way both Bicycle and Unicycle will be fully defined codes by their fields, without any randomness. And the documentation can spell out the difference in what set needs to be. For Bicycle it needs to just be a set of integers (right? or maybe there are more constraints) while for Unicycle it has to be perfect difference set?

And in the docstring you can mention "we have a heuristic for finding useful sets in the function yadayada"

return parity_checks(CSS(rusc, rusc))
end

"""Takes an untrimmed bicycle matrix and removes the row which keeps the spread of the column weights minimal.
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 something you invented or something from the paper? In either case, explain why it is needed. If it is from the paper, give a specific reference where in the paper it is.

return comp_matrix
end

"""Takes an untrimmed unicycle matrix and removes linearly dependent rows.
Copy link
Member

Choose a reason for hiding this comment

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

same question about where this is coming from and why is it necessary

return comp_matrix
end

"""
Copy link
Member

Choose a reason for hiding this comment

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

same question about provenance and invention and reference

Copy link
Member

Choose a reason for hiding this comment

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

if this is your own thing, you should brag about it a bit more loudly :D

Comment on lines +185 to +196
while size(m)[1] > r
tm = vcat(m[1:i-1,:], m[i+1:end,:])
tr = LinearAlgebra.rank(matrix(rrzz, tm))
if(tr == r)
m = tm
if(size(m)[1] == r)
break
end
else
i += 1
end
end
Copy link
Member

Choose a reason for hiding this comment

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

This is an n^4 algorithm, right? n^3 for the Gaussian elimination in rank and then another factor of n for the loop?

Add something to the documentation saying that "a naive implementation of row-reduction currently bottlenecks the use on very large codes".

std_min = Inf
for i in 1:m
t_H0 = vcat(H0[1:i-1, :], H0[i+1:end, :])
std_temp = std(convert(Array, sum(t_H0, dims = 1)))
Copy link
Member

Choose a reason for hiding this comment

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

The convert(Array, is pretty suspicious. Do you need it?

@Krastanov Krastanov marked this pull request as draft December 19, 2024 21:54
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