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$.
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$.
Examples:
>>> field = komm.FiniteBifield(4)
>>> x = field(0b1011)
>>> y = field(0b1100)
>>> x + y
0b111
>>> x * y
0b1101
>>> x / y
0b10
__init__()
Constructor for the class.
Parameters:
-
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)
characteristic
property
The characteristic $2$ of the finite field.
degree
property
The degree $k$ of the finite field.
modulus
property
The modulus (primitive polynomial) $p(X)$ of the finite field.
order
property
The order (number of elements) of the finite field. It is given by $2^k$.
primitive_element
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]
inverse()
Returns the multiplicative inverse of a given element.
logarithm()
Returns the logarithm of a given element, with respect to a given base. If no base is given, the primitive element is used as the base.
power()
Returns a given power of a given element.
conjugates()
staticmethod
Returns the conjugates of a given element. See LC04, Sec. 2.5.
minimal_polynomial()
staticmethod
Returns the minimal polynomial of a given element. See LC04, Sec. 2.5.
__call__()
Constructs elements of the finite field.