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 (primitive polynomial) $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 table below LC04, p.42.

    Degree $k$ Modulus $p(X)$ Degree $k$ Modulus $p(X)$
    $1$ 0b11 $9$ 0b1000010001
    $2$ 0b111 $10$ 0b10000001001
    $3$ 0b1011 $11$ 0b100000000101
    $4$ 0b10011 $12$ 0b1000001010011
    $5$ 0b100101 $13$ 0b10000000011011
    $6$ 0b1000011 $14$ 0b100010001000011
    $7$ 0b10001001 $15$ 0b1000000000000011
    $8$ 0b100011101 $16$ 0b10001000000001011

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$.

primitive_element: FiniteBifieldElement[Self] property

A primitive element $\alpha$ of the finite field. It satisfies $p(\alpha) = 0$, where $p(X)$ is the modulus (primitive polynomial) of the finite field.

Examples:

>>> field1 = komm.FiniteBifield(3, modulus=0b1011)
>>> alpha1 = field1.primitive_element
>>> [alpha1**i for i in range(7)]
[0b1, 0b10, 0b100, 0b11, 0b110, 0b111, 0b101]
>>> field2 = komm.FiniteBifield(3, modulus=0b1101)
>>> alpha2 = field2.primitive_element
>>> [alpha2**i for i in range(7)]
[0b1, 0b10, 0b100, 0b101, 0b111, 0b11, 0b110]