Main Content

isprimitive

R2026b

True for primitive polynomial for Galois field

Description

tf = isprimitive(prim_poly) returns 1 if the polynomial that prim_poly represents is primitive for the Galois field GF(2m). Otherwise, it returns 0.

example

Examples

collapse all

Find all the primitive polynomials for GF(8).

a = primpoly(3,'all','nodisplay') % All primitive polynomials for GF(8)
a = 2×1

    11
    13

Use isprimitive to check if specific polynomials are primitive.

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

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

Examining the vector a, you can see that isp1 is true because 13 is an element in a and isp2 is false because 14 is not an element in a.

Input Arguments

collapse all

Primitive polynomial, specified as one of the following:

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

  • 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 prim_poly.

Data Types: double

Output Arguments

collapse all

True or false result, returned as logical 1 (true) or logical 0 (false) indicating if the input polynomial is primitive or not.

Data Types: logical

Version History

Introduced before R2006a