galois.FieldArray.multiplicative_order()

Computes the multiplicative order $$\textrm{ord}(x)$$ of each element in $$x$$.

Returns:

An integer array of the multiplicative order of each element in $$x$$. The return value is a single integer if the input array $$x$$ 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.

The multiplicative order $$\textrm{ord}(x) = a$$ of $$x$$ in $$\mathrm{GF}(p^m)$$ is the smallest power $$a$$ such that $$x^a = 1$$. If $$a = p^m - 1$$, $$a$$ is said to be a generator of the multiplicative group $$\mathrm{GF}(p^m)^\times$$.

Note, multiplicative_order() should not be confused with order. The former returns the multiplicative order of FieldArray 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 $$\mathrm{GF}(3^2)$$.

In : GF = galois.GF(3**2)

In : x = GF.units; x
Out: GF([1, 2, 3, 4, 5, 6, 7, 8], order=3^2)

In : order = x.multiplicative_order(); order
Out: array([1, 2, 8, 4, 8, 8, 8, 4])

In : x ** order
Out: GF([1, 1, 1, 1, 1, 1, 1, 1], order=3^2)

In : GF = galois.GF(3**2, repr="poly")

In : x = GF.units; x
Out:
GF([     1,      2,      α,  α + 1,  α + 2,     2α, 2α + 1, 2α + 2],
order=3^2)

In : order = x.multiplicative_order(); order
Out: array([1, 2, 8, 4, 8, 8, 8, 4])

In : x ** order
Out: GF([1, 1, 1, 1, 1, 1, 1, 1], order=3^2)

In : GF = galois.GF(3**2, repr="power")

In : x = GF.units; x
Out: GF([  1, α^4,   α, α^2, α^7, α^5, α^3, α^6], order=3^2)

In : order = x.multiplicative_order(); order
Out: array([1, 2, 8, 4, 8, 8, 8, 4])

In : x ** order
Out: GF([1, 1, 1, 1, 1, 1, 1, 1], order=3^2)


The elements with $$\textrm{ord}(x) = 8$$ are multiplicative generators of $$\mathrm{GF}(3^2)^\times$$, which are also called primitive elements.

In : GF.primitive_elements
Out: GF([3, 5, 6, 7], order=3^2)

In : GF.primitive_elements
Out: GF([     α,  α + 2,     2α, 2α + 1], order=3^2)

In : GF.primitive_elements
Out: GF([  α, α^7, α^5, α^3], order=3^2)