Search code examples
pythonmatlabreed-solomon

Differences Between Systematic Reed Solomon Encoding Methods


I have been trying to implement a Reed Solomon encoder to produce code words in systematic form with the message followed by the check symbols. For comparison, I have referenced this whitepaper:http://www.bbc.co.uk/rd/pubs/whp/whp031.shtml which is very instructive with hand calculations and LFSR description.

For the example given in this whitepaper the primitive polynomial of the RS(15,11) code is X^4 + X + 1 and the message is 1,2,3,4,5,6,7,8,9,10,11 and the resulting check symbols are 3,3,12,12.

I can verify this by hand. I have also used this code https://en.wikiversity.org/wiki/Reed%E2%80%93Solomon_codes_for_coders referenced by the Wikipedia article on Reed Solomon to verify that the check symbols are 3,3,12,12.

However, when I use the Python galois package and this code I get different results. The check symbols are 11,10,14,6.

import galois

rs = galois.ReedSolomon(15,11, primitive_poly = 19)
GF = rs.field;
## Encode the message
m = GF([1,2,3,4,5,6,7,8,9,10,11])
c = rs.encode(m)

This result agrees with MATLAB.

Are there two different algorithms to encode a systematic codeword in reed solomon that yield different check symbols? If not, which method is correct?


Solution

  • The issue is the generator polynomials are different.

    Using generator polynomial (x-1)(x-2)(x-4)(x-8), the encode produces 3,3,12,12.

    Using generator polynomial (x-2)(x-4)(x-8)(x-3), the encode produces 11,10,14,6.

    Both generator polynomials are "correct". The generator that starts with (x-2) is termed to be a "narrow sense code".

    https://en.wikipedia.org/wiki/Reed%E2%80%93Solomon_error_correction#The_BCH_view:_The_codeword_as_a_sequence_of_coefficients