Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Fe-r-oz committed Nov 29, 2024
1 parent 7d4229d commit 2022ab8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/ecc/codes/classical/hamming.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ end
using SparseArrays

function parity_checks(h::Hamming)
n = 2 ^ h.r - 1 # Total number of columns
n = 2 ^ h.r - 1
rows = Int[]
cols = Int[]
values = Int[]
vals = Int[]
for j in 1:n
columnsⱼ = bitstring(j)[end - h.r + 1:end]
for i in 1:h.r
if parse(Int, columnsⱼ[i]) == 1
push!(rows, i)
push!(cols, j)
push!(values, 1)
push!(vals, 1)
end
end
end
H = sparse(rows, cols, values, h.r, n)
H = sparse(rows, cols, vals, h.r, n)
return H
end

Expand Down
6 changes: 3 additions & 3 deletions test/test_ecc_hamming.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
end

@testset "Testing Hamming codes properties" begin
r_vals = [3, 4, 5]
r_vals = [3, 4]
for r in r_vals
n = 2 ^ r - 1
k = 2 ^ r - 1 - r
Expand All @@ -31,8 +31,8 @@
mat = matrix(GF(2), parity_checks(Hamming(r)))
computed_rank = rank(mat)
@test computed_rank == n - k
@test Hamming_bound(Hamming(r)) == true
@test Gilbert_Varshamov_bound(Hamming(r)) == true
@test hamming_bound(Hamming(r)) == true
@test gilbert_varshamov_bound(Hamming(r)) == true
end
# Example taken from [huffman2010fundamentals](@cite).
@test Matrix{Bool}(parity_checks(Hamming(3))) == [0 0 0 1 1 1 1;
Expand Down

0 comments on commit 2022ab8

Please sign in to comment.