<< gf_default_primitive_polynomial Primitive and minimal polynomials gf_minimal_polynomial >>

Galois Fields >> Galois Fields > Primitive and minimal polynomials > gf_is_primitive_polynomial

gf_is_primitive_polynomial

Tests whether a polynomial over GF(p) is primitive

Syntax

tf = gf_is_primitive_polynomial(f, p, n)

Arguments

f

Polynomial of degree n: a row of exactly n + 1 integer coefficients in 0 .. p-1, constant term first, with a non-zero last coefficient.

p

Prime number: the characteristic of the field, at most 2^20.

n

Degree of f: an integer from 1 to 20, with p^n ≤ 2^20.

tf

T if f is primitive over GF(p), F otherwise.

Description

A polynomial f of degree n over GF(p) is primitive when it is irreducible and its roots have multiplicative order p^n - 1, so that they generate the multiplicative group of GF(p^n). Only primitive polynomials can be used with gf_create_field.

The test computes the order of x modulo f: f is primitive exactly when f(0) ≠ 0 and that order is p^n - 1. The polynomial does not need to be monic.

Examples

gf_is_primitive_polynomial([1 1 0 0 1], 2, 4)   // T: 1 + x + x^4
gf_is_primitive_polynomial([1 0 0 1 1], 2, 4)   // T: 1 + x^3 + x^4
gf_is_primitive_polynomial([1 1 1 1 1], 2, 4)   // F: irreducible, but x^5 = 1

See also

History

VersionDescription
2.0.0

Refactoring of the function/toolbox. Returns a boolean.


Report an issue
<< gf_default_primitive_polynomial Primitive and minimal polynomials gf_minimal_polynomial >>