Computes the additive order of each element in $$x$$.

Returns:

An integer array of the additive order of each element in $$x$$. The return value is a single integer if the input array $$x$$ is a scalar.

The additive order $$a$$ of $$x$$ in $$\mathrm{GF}(p^m)$$ is the smallest integer $$a$$ such that $$x a = 0$$. With the exception of 0, the additive order of every element is the finite field’s characteristic.

Examples

Compute the additive order of each element of $$\mathrm{GF}(3^2)$$.

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

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

In : order = x.additive_order(); order
Out: array([1, 3, 3, 3, 3, 3, 3, 3, 3])

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

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

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

In : order = x.additive_order(); order
Out: array([1, 3, 3, 3, 3, 3, 3, 3, 3])

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

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

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

In : order = x.additive_order(); order
Out: array([1, 3, 3, 3, 3, 3, 3, 3, 3])

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