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

Reed Solomon decode with c differnet from '1' #215

Closed
mhostetter opened this issue Jan 3, 2022 Discussed in #214 · 1 comment · Fixed by #216
Closed

Reed Solomon decode with c differnet from '1' #215

mhostetter opened this issue Jan 3, 2022 Discussed in #214 · 1 comment · Fixed by #216
Labels
bug Something isn't working

Comments

@mhostetter
Copy link
Owner

Discussed in #214

Originally posted by miritom December 28, 2021
Hi @mhostetter,

Thanks for maintaining this library. I started using it recently and it's very useful.
One thing I noticed is the Reed Solomon decode utility requires c=1 to work properly.
I tried the same example from the documentation, just added "c=2" to the constructor and it failed.
Is this a known limitiation? I saw that there are tests for the "encode" method with different c values, but all "decode" tests use the default, although I dindn't observe any comment on this in the documentation.

Example

In [1]: import galois                                                                                                    

In [2]: rs = galois.ReedSolomon(15, 9, c=2); rs                                                                          
Out[2]: <Reed-Solomon Code: [15, 9, 7] over GF(2^4)>

In [3]: GF = rs.field                                                                                                    

In [4]: m = GF.Random(rs.k); m                                                                                           
Out[4]: GF([10,  6,  3,  8, 11,  1,  1, 13,  1], order=2^4)

In [5]: c = rs.encode(m); c                                                                                              
Out[5]: 
GF([10,  6,  3,  8, 11,  1,  1, 13,  1,  2,  8,  3, 10, 15,  5],
   order=2^4)

In [6]: c[0] += GF(13); c                                                                                                   
Out[6]: 
GF([ 7,  6,  3,  8, 11,  1,  1, 13,  1,  2,  8,  3, 10, 15,  5],
   order=2^4)

# The first symbol is correctly erroneously
In [10]: dec_m = rs.decode(c); dec_m                                                                                     
Out[10]: GF([ 8,  6,  3,  8, 11,  1,  1, 13,  1], order=2^4)

In [11]: m                                                                                                               
Out[11]: GF([10,  6,  3,  8, 11,  1,  1, 13,  1], order=2^4)
@mhostetter mhostetter added the bug Something isn't working label Jan 3, 2022
@mhostetter mhostetter linked a pull request Jan 5, 2022 that will close this issue
mhostetter added a commit that referenced this issue Jan 7, 2022
@mhostetter
Copy link
Owner Author

The issue was

image

was used in the Forney Algorithm instead of

image.

Reference: https://en.wikipedia.org/wiki/Forney_algorithm

mhostetter added a commit that referenced this issue Jan 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant