Communications Toolbox    

Polynomials over Prime Fields

A polynomial over GF(p) is a polynomial whose coefficients are elements of GF(p). The Communications Toolbox provides functions for:

Cosmetic Changes of Polynomials

To display the traditionally formatted polynomial that corresponds to a row vector containing coefficients, use gfpretty. To truncate a polynomial by removing all zero-coefficient terms that have exponents higher than the degree of the polynomial, use gftrunc. For example,

Polynomial Arithmetic

The functions gfadd and gfsub add and subtract, respectively, polynomials over GF(p). The gfconv function multiplies polynomials over GF(p). The gfdeconv function divides polynomials in GF(p), producing a quotient polynomial and a remainder polynomial. For example, the commands below show that 2 + x + x2 times 1 + x over the field GF(3) is 2 + 2x2 + x3.

The previously discussed functions gfadd and gfsub add and subtract, respectively, polynomials. Because it uses a vector of coefficients to represent a polynomial, MATLAB does not distinguish between adding two polynomials and adding two row vectors elementwise.

Characterization of Polynomials

Given a polynomial over GF(p), the gfprimck function determines whether it is irreducible and/or primitive. By definition, if it is primitive then it is irreducible; however, the reverse is not necessarily true.

Given an element of GF(pm), the gfminpol function computes its minimal polynomial over GF(p).

For example, the code below reflects the irreducibility of all minimal polynomials. However, the minimal polynomial of a nonprimitive element is not a primitive polynomial.

Roots of Polynomials

Given a polynomial over GF(p), the gfroots function finds the roots of the polynomial in a suitable extension field GF(pm). If p is not specified, then the default is 2. If m is not specified, then the default is the degree of the polynomial. There are two ways to tell MATLAB the degree m of the extension field GF(pm), as shown in the table below.

Table 2-13: Formats for Second Argument of gfroots 
Second Argument
Represents
A positive integer
m as in GF(pm). MATLAB uses the default primitive polynomial in its computations.
A row vector
a primitive polynomial for GF(pm). Here m is the degree of this primitive polynomial.

Example: Roots of a Polynomial in GF(9).   The code below finds roots of the polynomial 1 + x2 + x3 in GF(9) and then checks that they are indeed roots. The exponential format of elements of GF(9) is used throughout.

The output shows that 0 (which equals 1), 5, and 7 are roots.

See the reference page for gfroots to see how gfroots can also provide you with the polynomial formats of the roots and the list of all elements of the field.


 Arithmetic in Galois Fields Other Galois Field Functions