Skip to content

Conversation

@Fe-r-oz
Copy link
Contributor

@Fe-r-oz Fe-r-oz commented Jun 21, 2025

This PR implements the traditional classical expander codes using LPS Ramanujan graphs.

Reference: #4, #6 😃

julia> g = ramanujan_graph(29, 13)
{1092, 16380} undirected simple Int64 graph
julia> H_inner = generate_parity_matrix(3, degree(g, 1))
3×30 Matrix{Int64}:
 0  1  1  1  1  1  0  0  0  0  0  0  1  1  1  0  0  0  1  0  0  1  0  0  1  0  1  0  0  1
 1  0  0  1  1  0  1  0  0  1  0  1  0  0  0  1  1  1  1  1  1  0  1  0  1  1  1  1  0  1
 0  0  0  1  0  0  0  1  1  0  1  1  0  1  1  1  0  1  0  0  0  1  1  1  1  0  0  0  1  0
julia> @test size(H_inner, 2) == degree(g, 1)
Test Passed
julia> H_expander = QuantumExpanders.expander_code_parity_matrix(g, H_inner)
3276×16380 SparseArrays.SparseMatrixCSC{Int64, Int64} with 49140 stored entries:
⎡⢻⣿⣿⣶⣶⣶⣶⣶⣤⣤⣤⣤⣄⣀⣀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⎤
⎢⠈⢿⣿⣿⣿⣷⣿⣿⣿⣿⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣶⣶⣦⣤⣤⣤⣄⣀⣀⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⎥
⎢⠀⠘⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⡿⣿⣯⣿⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⣿⣿⣿⣽⣻⣿⣶⣶⣶⣦⣤⣤⣤⣀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⎥
⎢⠀⠀⠘⢿⣟⣿⣿⣿⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣶⣶⣤⣤⣤⣀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⎥
⎢⠀⠀⠀⠈⠻⣿⣿⣿⣿⣿⣿⣟⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣦⣤⣄⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⎥
⎢⠀⠀⠀⠀⠀⠈⠻⣿⣿⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣶⣦⣤⣀⠀⠀⠀⎥
⎢⠀⠀⠀⠀⠀⠀⠀⠈⠙⠻⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣟⣿⣿⣟⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣦⡄⎥
⎣⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠉⠉⠙⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠋⠛⠛⠋⠛⠛⠛⠛⠛⠛⠙⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠙⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⠛⎦

julia> m, n = size(H_expander)
(3276, 16380)
julia> r = rank(H_expander)
3276
julia> k = n - r
13104
julia> @test n == ne(g)
Test Passed
julia> @test m == nv(g) * size(H_inner, 1)
Test Passed
julia> @test k == n - r
Test Passed

julia> d = degree(g,1)
30
julia> inner_rate = (d - rank((H_inner))) / d
0.9
julia> theoretical_min_rate = 2*inner_rate - 1
0.8
julia> actual_rate = k/n
0.8
  • The code is properly formatted and commented.
  • Substantial new functionality is documented within the docs.
  • All new functionality is tested.
  • All of the automated tests on github pass.
  • We recently started enforcing formatting checks. If formatting issues are reported in the new code you have written, please correct them.

@Fe-r-oz Fe-r-oz marked this pull request as ready for review September 13, 2025 01:45
@Fe-r-oz Fe-r-oz changed the title classical expander ECC classical Tanner code using expander graph Oct 6, 2025
@Fe-r-oz Fe-r-oz marked this pull request as draft October 10, 2025 03:34
@Fe-r-oz Fe-r-oz changed the title classical Tanner code using expander graph classical Sipser-Spielman expander codes Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant