Skip to content

Commit

Permalink
test more extensively r=3:15, not just for r = [3,4]
Browse files Browse the repository at this point in the history
  • Loading branch information
Fe-r-oz committed Jan 17, 2025
1 parent 0e953b6 commit c20380b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions test/test_ecc_hamming.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using QuantumClifford
using QuantumClifford.ECC
using QuantumClifford.ECC: AbstractECC, Hamming
using Nemo: matrix, GF
using Nemo: matrix, GF, echelon_form

function minimum_distance(H)
n = size(H, 2)
Expand All @@ -21,17 +21,22 @@
end

@testset "Testing Hamming codes properties" begin
r_vals = [3, 4]
for r in r_vals
for r in 3:15
n = 2 ^ r - 1
k = 2 ^ r - 1 - r
H = parity_checks(Hamming(r))
H = Matrix{Bool}(H)
@test minimum_distance(parity_checks(Hamming(r))) == 3
mat = matrix(GF(2), parity_checks(Hamming(r)))
computed_rank = rank(mat)
@test computed_rank == n - k
end
# mininum distance test is expensive (NP-Hard) so we test for r = [3,4]

Check warning on line 33 in test/test_ecc_hamming.jl

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"mininum" should be "minimum".
r_vals = [3,4]
for r in r_vals
H = parity_checks(Hamming(r))
H = Matrix{Bool}(H)
@test minimum_distance(parity_checks(Hamming(r))) == 3
end
# Example taken from [huffman2010fundamentals](@cite).
@test Matrix{Bool}(parity_checks(Hamming(3))) == [0 0 0 1 1 1 1;
0 1 1 0 0 1 1;
Expand Down

0 comments on commit c20380b

Please sign in to comment.