Decodes the message contained in code using a [n,k] Reed-Solomon code. The variable code must be a Galois array with n columns and an arbitrary number of rows. Each row of code represents a single block to be decoded by the Reed-Solomon coder. The decoded message is returned in the variable msg containing k columns and the same number of rows as code.
If n does not equal 2^m-1
, where m is an integer, then a
shorten Reed-Solomon decoding is used where zeros are added to the start of
each row to obtain an allowable codeword length. The returned msg
has these prepending zeros stripped.
By default the generator polynomial used in the Reed-Solomon coding is based
on the properties of the Galois Field in which msg is given. This
default generator polynomial can be overridden by a polynomial in g.
Suitable generator polynomials can be constructed with rsgenpoly
.
fcr is an integer value, and it is taken to be the first consecutive
root of the generator polynomial. The variable prim is then the
primitive element used to construct the generator polynomial. By default
fcr and prim are both 1. It is significantly faster to specify
the generator polynomial in terms of fcr and prim, since g
is converted to this form in any case.
By default the parity symbols are placed at the end of the coded message.
The variable parpos controls this positioning and can take the values
"beginning"
or "end"
. If the parity symbols are at the end, the message is
treated with the most-significant symbol first, otherwise the message is
treated with the least-significant symbol first.
See also: gf, rsenc, rsgenpoly.
Package: communications