Skip to content

Commit

Permalink
Update decoder_pipeline.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
Fe-r-oz authored Feb 28, 2024
1 parent df8d6b8 commit 296c634
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/ecc/decoder_pipeline.jl
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,18 @@ function decode(decoder::IterativeDecoder, syndrome_sample)
# Return the final error estimate vector
return error_estimate
end

function test_iterative_decoder()
# Create an instance of the decoder
decoder = IterativeDecoder(H)

# Generate a random syndrome sample
n = size(H, 1) # Number of qubits based on H
syndrome = rand(Bool, n)

# Decode the syndrome
decoded_errors = decode(decoder, syndrome)

# Define a test assertion: Check if all decoded errors are zeros (perfect decoding)
@test isall(decoded_errors == 0)
end

0 comments on commit 296c634

Please sign in to comment.