inWord = [1 2 3 4 5 6 7 8 9 10 11];
## Generate a word on the RS code 15,11) with GF on primpoly = 19 decimal
gf_inWord = gf(inWord, 4, 19);
## Generate a field generator polynomial for encoding in method 1 to follow
B = 0; ## First consecutive roots
S = 1; ## primitive element
fprintf("\nOctave produced this generator poly with method 1 using rsgenpoly:\n");
gf_GenPoly = rsgenpoly(15, 11, 19, B, S)
fprintf("\nOctave produced this encoded output using the rsgenpoly output:\n");
gf_encWords_1 = rsenc(gf_inWord, 15, 11, gf_GenPoly)
fprintf("\nBut Octave produced this encoded output using B and S parameters instead of the generator poly as an argument:\n");
gf_encWords_2 = rsenc(gf_inWord, 15, 11, B, S)
fprintf("\nI would have expected that when you pass B and S instead of G to rsenc\n");
fprintf("that the results would be the same in the output word. It appears that\n");
fprintf("when you set B=B-1 mod 2^m-1 when calling rsenc that the results are consistent\n");
fprintf("as shown here for at least the case where B=0:\n");
B=15;
gf_encWords_3 = rsenc(gf_inWord, 15, 11, B, S)