galois.GF2

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)\).

Important

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

Examples

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.GF2.properties)
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

Note

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


Last update: May 18, 2022