galois.is_primitive_element¶
- galois.is_primitive_element(element, irreducible_poly)¶
Determines if \(g(x)\) is a primitive element of the Galois field \(\mathrm{GF}(p^m)\) with degree-\(m\) irreducible polynomial \(f(x)\) over \(\mathrm{GF}(p)\).
- Parameters¶
- Returns¶
True
if \(g(x)\) is a primitive element of \(\mathrm{GF}(p^m)\) with irreducible polynomial \(f(x)\).- Return type¶
Notes
The number of primitive elements of \(\mathrm{GF}(p^m)\) is \(\phi(p^m - 1)\), where \(\phi(n)\) is the Euler totient function, see
galois.euler_phi()
.Examples
In [1]: GF = galois.GF(3) In [2]: f = galois.Poly([1,1,2], field=GF); f Out[2]: Poly(x^2 + x + 2, GF(3)) In [3]: galois.is_irreducible(f) Out[3]: True In [4]: galois.is_primitive(f) Out[4]: True In [5]: g = galois.Poly.Identity(GF); g Out[5]: Poly(x, GF(3)) In [6]: galois.is_primitive_element(g, f) Out[6]: True
In [7]: GF = galois.GF(3) In [8]: f = galois.Poly([1,0,1], field=GF); f Out[8]: Poly(x^2 + 1, GF(3)) In [9]: galois.is_irreducible(f) Out[9]: True In [10]: galois.is_primitive(f) Out[10]: False In [11]: g = galois.Poly.Identity(GF); g Out[11]: Poly(x, GF(3)) In [12]: galois.is_primitive_element(g, f) Out[12]: False
Last update:
Feb 09, 2022