# gfprimck

Check whether polynomial over Galois field is primitive

## Syntax

```ck = gfprimck(a) ck = gfprimck(a,p) ```

## Description

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.

`ck = gfprimck(a)` checks whether the degree-m GF(2) polynomial `a` is a primitive polynomial for GF(2m), where m = length(`a`) - 1. The output `ck` is as follows:

• -1 if `a` is not an irreducible polynomial

• 0 if `a` is irreducible but not a primitive polynomial for GF(`p`m)

• 1 if `a` is a primitive polynomial for GF(`p`m)

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

`a` is either a polynomial character vector or a row vector representing the polynomial by listing its coefficients in ascending order. For example, in GF(5), `'4 + 3x + 2x^3'` and ```[4 3 0 2]``` are equivalent.

This function considers the zero polynomial to be “not irreducible” and considers all polynomials of degree zero or one to be primitive.

## Examples

Characterization of Polynomials contains examples.

## 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

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

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