% -*- texinfo -*- % @deftypefn {Function File} {@var{g} = } rsgenpoly (@var{n},@var{k}) % @deftypefnx {Function File} {@var{g} = } rsgenpoly (@var{n},@var{k},@var{p}) % @deftypefnx {Function File} {@var{g} = } rsgenpoly (@var{n},@var{k},@var{p},@var{b},@var{s}) % @deftypefnx {Function File} {@var{g} = } rsgenpoly (@var{n},@var{k},@var{p},@var{b}) % @deftypefnx {Function File} {[@var{g}, @var{t}] = } rsgenpoly (@var{...}) % % Creates a generator polynomial for a Reed-Solomon coding with message % length of @var{k} and codelength of @var{n}. @var{n} must be greater % than @var{k} and their difference must be even. The generator polynomial % is returned on @var{g} as a polynomial over the Galois Field GF(2^@var{m}) % where @var{n} is equal to @code{2^@var{m}-1}. If @var{m} is not integer % the next highest integer value is used and a generator for a shorten % Reed-Solomon code is returned. % % The elements of @var{g} represent the coefficients of the polynomial in % descending order. If the length of @var{g} is lg, then the generator % polynomial is given by % @iftex % @tex % $$ % g_0 x^{lg-1} + g_1 x^{lg-2} + \cdots + g_{lg-1} x + g_lg. % $$ % @end tex % @end iftex % @ifinfo % % @example % @var{g}(0) * x^(lg-1) + @var{g}(1) * x^(lg-2) + ... + @var{g}(lg-1) * x + @var{g}(lg). % @end example % @end ifinfo % % If @var{p} is defined then it is used as the primitive polynomial of the % the Galois Field GF(2^@var{m}). The default primitive polynomial will % be used if @var{p} is equal to []. % % The variables @var{b} and @var{s} determine the form of the generator % polynomial in the following manner. % @iftex % @tex % $$ % g = (x - A^{bs}) (x - A^{(b+1)s}) \cdots (x - A ^{(b+2t-1)s}). % $$ % @end tex % @end iftex % @ifinfo % % @example % @var{g} = (@var{x} - A^(@var{b}*@var{s})) * (@var{x} - A^((@var{b}+1)*@var{s})) * ... * (@var{x} - A^((@var{b}+2*@var{t}-1)*@var{s})). % @end example % @end ifinfo % % where @var{t} is @code{(@var{n}-@var{k})/2}, and A is the primitive element % of the Galois Field. Therefore @var{b} is the first consecutive root of the % generator polynomial and @var{s} is the primitive element to generate the % the polynomial roots. % % If requested the variable @var{t}, which gives the error correction % capability of the the Reed-Solomon code % @end deftypefn % @seealso{gf,rsenc,rsdec}