- galois.FieldArray.multiplicative_order() integer | ndarray
Computes the multiplicative order
of each element in .- Returns¶
An integer array of the multiplicative order of each element in
. The return value is a single integer if the input array is a scalar.- Raises¶
ArithmeticError – If zero is provided as an input. The multiplicative order of 0 is not defined. There is no power of 0 that ever results in 1.
Notes¶
The multiplicative order
of in is the smallest power such that . If , is said to be a generator of the multiplicative group .Note,
multiplicative_order()
should not be confused withorder
. The former returns the multiplicative order ofFieldArray
elements. The latter is a property of the field, namely the finite field’s order or size.Examples¶
Compute the multiplicative order of each non-zero element of
.In [1]: GF = galois.GF(3**2, display="poly") In [2]: x = GF.units; x Out[2]: GF([ 1, 2, α, α + 1, α + 2, 2α, 2α + 1, 2α + 2], order=3^2) In [3]: order = x.multiplicative_order(); order Out[3]: array([1, 2, 8, 4, 8, 8, 8, 4]) In [4]: x ** order Out[4]: GF([1, 1, 1, 1, 1, 1, 1, 1], order=3^2)
The elements with
are multiplicative generators of , which are also called primitive elements.In [5]: GF.primitive_elements Out[5]: GF([ α, α + 2, 2α, 2α + 1], order=3^2)