class galois.GF2(x: ElementLike | ArrayLike, dtype: DTypeLike | None = None, copy: bool = True, order: Literal['K', 'A', 'C', 'F'] = 'K', ndmin: int = 0)

A ndarray subclass over \(\mathrm{GF}(2)\).


This class is a pre-generated FieldArray subclass generated with galois.GF(2) and is included in the API for convenience.


This class is equivalent, and in fact identical, to the FieldArray subclass returned from the class factory GF().

In [1]: galois.GF2 is galois.GF(2)
Out[1]: True

In [2]: issubclass(galois.GF2, galois.FieldArray)
Out[2]: True

In [3]: print(
Galois Field:
  name: GF(2)
  characteristic: 2
  degree: 1
  order: 2
  irreducible_poly: x + 1
  is_primitive_poly: True
  primitive_element: 1

Create a FieldArray instance using GF2’s constructor.

In [4]: x = galois.GF2([1, 0, 1, 1]); x
Out[4]: GF([1, 0, 1, 1], order=2)

In [5]: isinstance(x, galois.GF2)
Out[5]: True


Only the class docstring is documented on this page. See FieldArray for all other classmethods, class properties, and methods inherited by GF2.

Last update: Jul 12, 2022