- galois.FieldArray.additive_order() int | numpy.ndarray
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.
Notes¶
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 [1]: GF = galois.GF(3**2) In [2]: x = GF.elements; x Out[2]: GF([0, 1, 2, 3, 4, 5, 6, 7, 8], order=3^2) In [3]: order = x.additive_order(); order Out[3]: array([1, 3, 3, 3, 3, 3, 3, 3, 3]) In [4]: x * order Out[4]: GF([0, 0, 0, 0, 0, 0, 0, 0, 0], order=3^2)
In [5]: GF = galois.GF(3**2, repr="poly") In [6]: x = GF.elements; x Out[6]: GF([ 0, 1, 2, α, α + 1, α + 2, 2α, 2α + 1, 2α + 2], order=3^2) In [7]: order = x.additive_order(); order Out[7]: array([1, 3, 3, 3, 3, 3, 3, 3, 3]) In [8]: x * order Out[8]: GF([0, 0, 0, 0, 0, 0, 0, 0, 0], order=3^2)
In [9]: GF = galois.GF(3**2, repr="power") In [10]: x = GF.elements; x Out[10]: GF([ 0, 1, α^4, α, α^2, α^7, α^5, α^3, α^6], order=3^2) In [11]: order = x.additive_order(); order Out[11]: array([1, 3, 3, 3, 3, 3, 3, 3, 3]) In [12]: x * order Out[12]: GF([0, 0, 0, 0, 0, 0, 0, 0, 0], order=3^2)