Main Content

gfprimck

Check whether polynomial over Galois field is primitive

Description

ck = gfprimck(a) checks whether the degree-m GF(2) polynomial a is a primitive polynomial for GF(2m), where m = length(a) - 1 .

Note

This function performs computations in GF(pm), where p is prime. If you are working in GF(2m), use the isprimitive function. For details, see Finding Primitive Polynomials in Primitive Polynomials and Element Representations.

example

ck = gfprimck(a,p) checks whether the degree-m GF(P) polynomial a is a primitive polynomial for GF(pm).

Examples

collapse all

This example show to determine whether a polynomial is primitive, irreducible but not primitive, or reducible in the Galois field GF(3⁴).

p = 3;
m = 4;

Use the default primitive polynomial for GF(34).

prim_poly = gfminpol(1, m, p);
ckprim = gfprimck(prim_poly, p)
ckprim = 
1

ckprim returns 1 because prim_poly is primitive.

Use an irreducible but not primitive polynomial.

notprimpoly = gfminpol(5, m, p);
cknotprim = gfprimck(notprimpoly, p)
cknotprim = 
0

cknotprim returns 0 because notprimpoly is irreducible but not primitive.

Use a reducible polynomial.

ckreducible = gfprimck([0 1 1], p)
ckreducible = 
-1

ckreducible returns -1 because [0 1 1] is a reducible polynomial.

Input Arguments

collapse all

Polynomial character vector or coefficients of polynomial in ascending order, specified as a character vector or a row vector. For example, in GF(5), '4 + 3x + 2x^3' and [4 3 0 2] are equivalent.

Data Types: single | double | char

Prime number, specified as a positive integer.

Data Types: single | double

Output Arguments

collapse all

Indicates the status of the input polynomial for the specified Galois field, returned as a 1, 0, or -1.

1 if the polynomial is primitive,

0 if the polynomial is irreducible but not primitive,

-1 if the polynomial is reducible.

Data Types: double

Algorithms

An irreducible polynomial over GF(p) of degree at least 2 is primitive if and only if it does not divide -1 + xk for any positive integer k smaller than pm-1.

References

[1] Clark, George C. Jr., and J. Bibb Cain, Error-Correction Coding for Digital Communications, New York, Plenum, 1981.

[2] Krogsgaard, K., and T., Karp, Fast Identification of Primitive Polynomials over Galois Fields: Results from a Course Project, ICASSP 2005, Philadelphia, PA, 2004.

Version History

Introduced before R2006a