Skip to content

komm.FiniteBifield

Finite field with binary characteristic. Objects of this class represent a finite field $\mathrm{GF}(2^k)$ (also known as Galois field), with characteristic $2$ and degree $k$.

Attributes:

  • degree (int)

    Degree $k$ of the finite field. Must be a positive integer.

  • modulus (Optional[BinaryPolynomial | int])

    Modulus $p(X)$ of the field, specified either as a binary polynomial or as an integer to be converted to the former. Must be an irreducible polynomial. If not specified, the modulus is chosen from the list of default primitive polynomials.

Examples:

>>> field = komm.FiniteBifield(4)
>>> field
FiniteBifield(4)
>>> (field.characteristic, field.degree, field.order)
(2, 4, 16)
>>> field.modulus
BinaryPolynomial(0b10011)
>>> field = komm.FiniteBifield(4, modulus=0b11001)
>>> field
FiniteBifield(4, modulus=0b11001)
>>> (field.characteristic, field.degree, field.order)
(2, 4, 16)
>>> field.modulus
BinaryPolynomial(0b11001)

Construction of elements

To construct elements of the finite field, call the finite field object. For example, field(0b1101) will construct the element whose polynomial representation is $X^3 + X^2 + 1$.

Algebraic structure

The following operations are supported: addition (+), subtraction (-), multiplication (*), division (/), and exponentiation (**).

Examples:

>>> field = komm.FiniteBifield(4)
>>> x = field(0b1011)
>>> y = field(0b1100)
>>> x + y
0b111
>>> x - y
0b111
>>> x * y
0b1101
>>> x / y
0b10
>>> x**2
0b1001

Further methods on elements

The following methods are available on elements of the finite field:

  • logarithm(base): Returns the logarithm of the element, with respect to a given base.
  • conjugates(): Returns the conjugates of the element.
  • minimal_polynomial(): Returns the minimal polynomial of the element.

For more details, see LC04, Sec. 2.5.

Examples:

>>> field = komm.FiniteBifield(4)
>>> x = field(0b1011)
>>> base = field(0b10)
>>> x.logarithm(base)
7
>>> x.conjugates()
[0b1011, 0b1001, 0b1101, 0b1110]
>>> x.minimal_polynomial()
BinaryPolynomial(0b11001)

characteristic: int property

The characteristic $2$ of the finite field.

order: int property

The order (number of elements) of the finite field. It is given by $2^k$.