galois.GF_factory¶
-
galois.
GF_factory
(characteristic, degree, prim_poly=None, target='cpu', mode='auto', rebuild=False)[source]¶ Factory function to construct Galois field array classes of type \(\mathrm{GF}(p^m)\).
- Parameters
characteristic (int) – The prime characteristic \(p\) of the field \(\mathrm{GF}(p^m)\).
degree (int) – The prime characteristic’s degree \(m\) of the field \(\mathrm{GF}(p^m)\).
prim_poly (galois.Poly, optional) – The primitive polynomial of the field. Default is
None
which will use the Conway polynomial obtained fromgalois.conway_poly
.target (str) – The
target
keyword argument fromnumba.vectorize
, either"cpu"
,"parallel"
, or"cuda"
.mode (str, optional) – The type of field computation, either
"auto"
,"lookup"
, or"calculate"
. The default is"auto"
. The “lookup” mode will use Zech log, log, and anti-log lookup tables for speed. The “calculate” mode will not store any lookup tables, but perform field arithmetic on the fly. The “calculate” mode is designed for large fields that cannot store lookup tables in RAM. Generally, “calculate” will be slower than “lookup”. The “auto” mode will determine whether to use “lookup” or “calculate” based on the field size. For “auto”, field’s withorder <= 2**16
will use the “lookup” mode.rebuild (bool, optional) – Indicates whether to force a rebuild of the lookup tables. The default is
False
.
- Returns
A new Galois field class that is a sublcass of
galois.GF
.- Return type
galois.GF2, galois.GF2m, galois.GFp, galois.GFpm