- class property galois.FieldArray.dtypes : List[dtype]
List of valid integer
numpy.dtype
values that are compatible with this finite field. Creating an array with an unsupported dtype will raise aTypeError
exception.For finite fields whose elements cannot be represented with
numpy.int64
, the only valid data type isnumpy.object_
.Examples¶
For small finite fields, all integer data types are acceptable, with the exception of
numpy.uint64
. This is because all arithmetic is done usingnumpy.int64
.In [1]: GF = galois.GF(31); GF.dtypes Out[1]: [numpy.uint8, numpy.uint16, numpy.uint32, numpy.int8, numpy.int16, numpy.int32, numpy.int64]
Some data types are too small for certain finite fields, such as
numpy.int16
for .In [2]: GF = galois.GF(7**5); GF.dtypes Out[2]: [numpy.uint16, numpy.uint32, numpy.int16, numpy.int32, numpy.int64]
Large fields must use
numpy.object_
which uses Pythonint
for its unlimited size.In [3]: GF = galois.GF(2**100); GF.dtypes Out[3]: [numpy.object_] In [4]: GF = galois.GF(36893488147419103183); GF.dtypes Out[4]: [numpy.object_]