Galois Fields

This section contains classes and functions for creating Galois field arrays.

Galois field class creation

Class factory functions

GF(order[, irreducible_poly, …])

Factory function to construct a Galois field array class for \(\mathrm{GF}(p^m)\).

Field(order[, irreducible_poly, …])

Alias of galois.GF().

Abstract base classes

FieldArray(array[, dtype, copy, order, ndmin])

An array over \(\mathrm{GF}(p^m)\).

FieldClass(name, bases, namespace, **kwargs)

Defines a metaclass for all galois.FieldArray classes.

Pre-made Galois field classes

GF2(array[, dtype, copy, order, ndmin])

An array over \(\mathrm{GF}(2)\).

Prime field functions

Primitive roots

primitive_root(n[, start, stop, reverse])

Finds the smallest primitive root modulo \(n\).

primitive_roots(n[, start, stop, reverse])

Finds all primitive roots modulo \(n\).

is_primitive_root(g, n)

Determines if \(g\) is a primitive root modulo \(n\).

Extension field functions

Irreducible polynomials

irreducible_poly(order, degree[, method])

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

irreducible_polys(order, degree)

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

is_irreducible(poly)

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

Primitive polynomials

primitive_poly(order, degree[, method])

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

primitive_polys(order, degree)

Returns all monic primitive polynomials \(f(x)\) over \(\mathrm{GF}(q)\) 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\).

is_primitive(poly)

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

Primitive elements

primitive_element(irreducible_poly[, start, …])

Finds the smallest primitive element \(g(x)\) of the Galois field \(\mathrm{GF}(p^m)\) with degree-\(m\) irreducible polynomial \(f(x)\) over \(\mathrm{GF}(p)\).

primitive_elements(irreducible_poly[, …])

Finds all primitive elements \(g(x)\) of the Galois field \(\mathrm{GF}(p^m)\) with degree-\(m\) irreducible polynomial \(f(x)\) over \(\mathrm{GF}(p)\).

is_primitive_element(element, irreducible_poly)

Determines if \(g(x)\) is a primitive element of the Galois field \(\mathrm{GF}(p^m)\) with degree-\(m\) irreducible polynomial \(f(x)\) over \(\mathrm{GF}(p)\).

Minimal polynomials

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)\).