Galois Fields

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

Galois field classes

Class factory functions

GF(order[, irreducible_poly, ...])

Creates a Galois field array class for \(\mathrm{GF}(p^m)\).

Field(order[, irreducible_poly, ...])

Alias of galois.GF().

Abstract base classes

FieldArray(array_like[, dtype, copy, order, ...])

A Galois field array over \(\mathrm{GF}(p^m)\).

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

Defines a metaclass for all galois.FieldArray classes.

Pre-made Galois field array classes

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

A Galois field array over \(\mathrm{GF}(2)\).

Prime field functions

Primitive roots

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

Finds a primitive root modulo \(n\) in the range [start, stop).

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

Iterates through all primitive roots modulo \(n\) in the range [start, stop).

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[, reverse])

Iterates through 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[, reverse])

Iterates through 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[, method])

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

primitive_elements(irreducible_poly)

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

is_primitive_element(element, irreducible_poly)

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


Last update: Apr 03, 2022