classmethod galois.FieldArray.compile(mode: 'auto' | 'jit-lookup' | 'jit-calculate' | 'python-calculate')

Recompile the just-in-time compiled ufuncs for a new calculation mode.

This function updates ufunc_mode.

Parameters:
mode: 'auto' | 'jit-lookup' | 'jit-calculate' | 'python-calculate'

The ufunc calculation mode.

  • "auto": Selects "jit-lookup" for fields with order less than \(2^{20}\), "jit-calculate" for larger fields, and "python-calculate" for fields whose elements cannot be represented with numpy.int64.

  • "jit-lookup": JIT compiles arithmetic ufuncs to use Zech log, log, and anti-log lookup tables for efficient computation. In the few cases where explicit calculation is faster than table lookup, explicit calculation is used.

  • "jit-calculate": JIT compiles arithmetic ufuncs to use explicit calculation. The "jit-calculate" mode is designed for large fields that cannot or should not store lookup tables in RAM. Generally, the "jit-calculate" mode is slower than "jit-lookup".

  • "python-calculate": Uses pure-Python ufuncs with explicit calculation. This is intended for fields whose elements cannot be represented with numpy.int64 and instead use numpy.object_ with Python int (which has arbitrary precision). However, this mode can be used for any field, enabling the code to run without Numba JIT compilation.