primpoly

Find primitive polynomials for Galois field

Syntax

pr = primpoly(m)
pr = primpoly(m,opt)
pr = primpoly(m...,'nodisplay')

Description

pr = primpoly(m) returns the primitive polynomial for GF(2^m), where m is an integer between 2 and 16. The Command Window displays the polynomial using "D" as an indeterminate quantity. The output argument pr is an integer whose binary representation indicates the coefficients of the polynomial.

pr = primpoly(m,opt) returns one or more primitive polynomials for GF(2^m). The output pol depends on the argument opt as shown in the table below. Each element of the output argument pr is an integer whose binary representation indicates the coefficients of the corresponding polynomial. If no primitive polynomial satisfies the constraints, pr is empty.

optMeaning of pr
'min'One primitive polynomial for GF(2^m) having the smallest possible number of nonzero terms
'max'One primitive polynomial for GF(2^m) having the greatest possible number of nonzero terms
'all'All primitive polynomials for GF(2^m)
Positive integer k All primitive polynomials for GF(2^m) that have k nonzero terms

pr = primpoly(m...,'nodisplay') prevents the function from displaying the result as polynomials in "D" in the Command Window. The output argument pr is unaffected by the 'nodisplay' option.

Examples

The first example below illustrates the formats that primpoly uses in the Command Window and in the output argument pr. The subsequent examples illustrate the display options and the use of the opt argument.

pr = primpoly(4)

pr1 = primpoly(5,'max','nodisplay')

pr2 = primpoly(5,'min')

pr3 = primpoly(5,2)

pr4 = primpoly(5,3);

The output is below.

Primitive polynomial(s) = 
 
D^4+D^1+1

pr =

    19


pr1 =

    61 


Primitive polynomial(s) = 
 
D^5+D^2+1

pr2 =

    37


No primitive polynomial satisfies the given constraints.

pr3 =

     []


Primitive polynomial(s) = 
 
D^5+D^2+1
D^5+D^3+1

See Also

Was this topic helpful?