Polynomials over Galois Fields

This section contains classes and functions for creating polynomials over Galois fields.

Polynomial classes

Poly(coeffs[, field, order])

Create a polynomial \(f(x)\) over \(\mathrm{GF}(p^m)\).

Polynomial functions

poly_gcd(a, b)

Finds the greatest common divisor of two polynomials \(a(x)\) and \(b(x)\) over \(\mathrm{GF}(q)\).

poly_egcd(a, b)

Finds the polynomial multiplicands of \(a(x)\) and \(b(x)\) such that \(a(x)s(x) + b(x)t(x) = \mathrm{gcd}(a(x), b(x))\).

poly_pow(poly, power, modulus)

Efficiently exponentiates a polynomial \(f(x)\) to the power \(k\) reducing by modulo \(g(x)\), \(f(x)^k\ \textrm{mod}\ g(x)\).

poly_factors(poly)

Factors the polynomial \(f(x)\) into a product of \(n\) irreducible factors \(f(x) = g_0(x)^{k_0} g_1(x)^{k_1} \dots g_{n-1}(x)^{k_{n-1}}\) with \(k_0 \le k_1 \le \dots \le k_{n-1}\).

Special polynomial creation

irreducible_poly(characteristic, degree[, …])

Returns a monic irreducible polynomial \(f(x)\) over \(\mathrm{GF}(p)\) with degree \(m\).

irreducible_polys(characteristic, degree)

Returns all monic irreducible polynomials \(f(x)\) over \(\mathrm{GF}(p)\) with degree \(m\).

primitive_poly(characteristic, degree[, method])

Returns a monic primitive polynomial \(f(x)\) over \(\mathrm{GF}(p)\) with degree \(m\).

primitive_polys(characteristic, degree)

Returns all monic primitive polynomials \(f(x)\) over \(\mathrm{GF}(p)\) with degree \(m\).

conway_poly(characteristic, degree)

Returns the Conway polynomial \(C_{p,m}(x)\) over \(\mathrm{GF}(p)\) with degree \(m\).

matlab_primitive_poly(characteristic, degree)

Returns Matlab’s default primitive polynomial \(f(x)\) over \(\mathrm{GF}(p)\) with degree \(m\).

minimal_poly(element)

Computes the minimal polynomial \(m_e(x) \in \mathrm{GF}(p)[x]\) of a Galois field element \(e \in \mathrm{GF}(p^m)\).

Polynomial tests

is_monic(poly)

Determines whether the polynomial is monic, i.e. having leading coefficient equal to 1.

is_irreducible(poly)

Checks whether the polynomial \(f(x)\) over \(\mathrm{GF}(p)\) is irreducible.

is_primitive(poly)

Checks whether the polynomial \(f(x)\) over \(\mathrm{GF}(p)\) is primitive.