Is there a way to generalize this Reed-Solomon encoder/decoder?

150 Views Asked by At

I'm trying to construct a [7,4,4] RS code with primitive polynomial 0x3f3 (1+x+x^3) over GF(8), using the library https://github.com/lrq3000/unireedsolomon

Upon initializing the encoder with the command

coder = rs.RSCoder(7,4, prim = 0x3f3, c_exp = 3)

I get the following error:

Traceback (most recent call last):
  File "/home/damuna/HACKATHON/RS.py", line 174, in <module>
    coder = rs.RSCoder(7,4,prim=0x3f3, c_exp = 3)   
  File "/home/damuna/.local/lib/python3.8/site-packages/unireedsolomon/rs.py", line 89, in __init__
    init_lut(generator=generator, prim=prim, c_exp=self.gf2_c_exp)
  File "/home/damuna/.local/lib/python3.8/site-packages/unireedsolomon/ff.py", line 154, in init_lut
    logtable[x] = i
IndexError: list assignment index out of range

The library is used to generate the usual (255,223) RS code over GF(16), it doesn't seem to do well when trying to generalize this, does someone have an idea? (the functions are found in the file "rs.py" in the repository)

1

There are 1 best solutions below

0
On

The code should be:

coder = rs.RSCoder(7,4, prim = 0xb, c_exp = 3)  # all numbers are powers of 3

The code could also define 2 as the primitive element:

coder = rs.RSCoder(7,4, prim = 0xb, c_exp = 2)  # all numbers are powers of 2

0x3f3 = 0x3 * 0x3 * 0x3 * 0xb * 0xb (in binary GF(2) math) and does not represent an irreducible polynomial that could be used for GF(512). This is probably what is causing the error.

RS(255,...) requires GF(256) or larger.