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

suspected fail of decoding with n=7, k=5 codewords #585

Open
Sirmen opened this issue Dec 21, 2024 · 0 comments
Open

suspected fail of decoding with n=7, k=5 codewords #585

Sirmen opened this issue Dec 21, 2024 · 0 comments

Comments

@Sirmen
Copy link

Sirmen commented Dec 21, 2024

Dear Gentlemen,
I have an issue with the Galois.ReedSolomon's decode method.
The parameters used can be seen in the output. Since t=1, the decode method is to recover 1 error and detect 1+ errors.
When I insert 2 errors, the expected behavior is to receive a -1 (as the documentation says, "If a codeword has too many errors and cannot be corrected, -1 will be returned").
However, I observed that (not always but most of the time) instead of returning a fail (i.e. -1), it returns 1 as the number of corrected errors, and the decoded message. If you run the code snippet you can see the relevant traceback and messages.
It is misleading since when you don't know the possible number of errors in advance, you can assume the existing errors are recovered and move forward.
Could it be related to the default generator/primitive polynomials, or there may be a way to choose the correct polynomials to deal with such a case if we want to work with GF(2^3)?
I could not work on the issue further since the corrected codeword, syndromes, or any other interim results are unfortunately not available.
Your kind opinions are appreciated.
With regards,
R.Tanju Sirmen
Asst.Prof. CS
tsirmen@pirireis.edu.tr
Code:
import galois
import numpy as np
n = 7 # 15 #
k = 5 # 9 #
rs = galois.ReedSolomon(n, k)
print(rs)
GF = rs.field
message = GF.Random(rs.k)
print(f"message:\t{message}")
encoded = rs.encode(message)
print(f"encoded:\t{encoded}")
x = 2 # num of errors
err_pos, err_val = [],[]
corrupted = encoded.copy()
b = 0
s = rs.t
for i in range(x):
## Corrupt t symbols of the codeword
e = GF.Random(rs.t, low=1)
err_val.append(e)
err_pos.append(b)
corrupted[b:s] += e # inject errors
b = s + i
s = b + rs.t
print(f"corrupted:\t{corrupted} error_positions:{err_pos} values:{err_val}")
##Decode
decoded_1 = rs.decode(corrupted, errors=False) # with parameter errors=False
print(f"decoded_1:\t{decoded_1} >success:",np.array_equal(decoded_1, message))
decoded_2, num_err = rs.decode(corrupted, errors=True) # with parameter errors=True
print(f"decoded_2:\t{decoded_2} corrected num of err:{num_err} >success:",np.array_equal(decoded_1, message))
Output:
Reed-Solomon Code:
[n, k, d]: [7, 5, 3]
field: GF(2^3)
generator_poly: x^2 + 6x + 3
is_primitive: True
is_narrow_sense: True
is_systematic: True
message: [3 4 2 5 1]
encoded: [3 4 2 5 1 6 5]
corrupted: [2 5 2 5 1 6 5] error_positions:[0, 1] values:[GF([1], order=2^3), GF([1], order=2^3)]
decoded_1: [2 5 2 5 1] >success: False
decoded_2: [2 5 2 5 1] corrected num of err:1 >success: False

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

No branches or pull requests

1 participant