Main Content

isprimitive

True for primitive polynomial for Galois field

Syntax

isprimitive(a) 

Description

isprimitive(a) returns 1 if the polynomial that a represents is primitive for the Galois field GF(2m), and 0 otherwise. The input a can represent the polynomial using one of these formats:

  • A nonnegative integer less than 217. The binary representation of this integer indicates the coefficients of the polynomial. In this case, m is floor(log2(a)).

  • A Galois row vector in GF(2), listing the coefficients of the polynomial in order of descending powers. In this case, m is the order of the polynomial represented by a.

Examples

The example below finds all primitive polynomials for GF(8) and then checks using isprimitive whether specific polynomials are primitive.

a = primpoly(3,'all','nodisplay'); % All primitive polys for GF(8)

isp1 = isprimitive(13) % 13 represents a primitive polynomial.

isp2 = isprimitive(14) % 14 represents a nonprimitive polynomial.

The output is below. If you examine the vector a, notice that isp1 is true because 13 is an element in a, while isp2 is false because 14 is not an element in a.

isp1 =

     1


isp2 =

     0

Version History

Introduced before R2006a