-
classmethod galois.FieldArray.Range(start: ElementLike, stop: ElementLike, step: int =
1
, dtype: DTypeLike | None =None
) Self Creates a 1-D array with a range of elements.
- Parameters:¶
- start: ElementLike¶
The starting element (inclusive).
- stop: ElementLike¶
The stopping element (exclusive).
- step: int =
1
¶ The increment between elements. The default is 1.
- dtype: DTypeLike | None =
None
¶ The
numpy.dtype
of the array elements. The default isNone
which represents the smallest unsigned data type for thisFieldArray
subclass (the first element indtypes
).
- Returns:¶
A 1-D array of a range of elements.
Examples¶
For prime fields, the increment is simply a finite field element, since all elements are integers.
In [1]: GF = galois.GF(31) In [2]: GF.Range(10, 20) Out[2]: GF([10, 11, 12, 13, 14, 15, 16, 17, 18, 19], order=31) In [3]: GF.Range(10, 20, 2) Out[3]: GF([10, 12, 14, 16, 18], order=31)
For extension fields, the increment is the integer increment between finite field elements in their integer representation.
In [4]: GF = galois.GF(3**3) In [5]: GF.Range(10, 20) Out[5]: GF([10, 11, 12, 13, 14, 15, 16, 17, 18, 19], order=3^3) In [6]: GF.Range(10, 20, 2) Out[6]: GF([10, 12, 14, 16, 18], order=3^3)
In [7]: GF = galois.GF(3**3, repr="poly") In [8]: GF.Range(10, 20) Out[8]: GF([ α^2 + 1, α^2 + 2, α^2 + α, α^2 + α + 1, α^2 + α + 2, α^2 + 2α, α^2 + 2α + 1, α^2 + 2α + 2, 2α^2, 2α^2 + 1], order=3^3) In [9]: GF.Range(10, 20, 2) Out[9]: GF([ α^2 + 1, α^2 + α, α^2 + α + 2, α^2 + 2α + 1, 2α^2], order=3^3)