Zech logarithms
- Cost
- word operations for every field operation; field operations and words of memory to build the tables.
The multiplicative group of a finite field is cyclic of order . If is a generator, every nonzero element is for a unique , its discrete logarithm, and multiplication, division and powering of elements become addition, subtraction and multiplication of logarithms modulo . Addition needs a table: Jacobi introduced, and Zech tabulated, the function with
now called the Zech (or Jacobi) logarithm [LN1997] [Hub1990]. The representation is attractive whenever a table of size is affordable; fq_default uses it for , and the module fq_zech allows .
Arithmetic with logarithms#
In fq_zech an element is stored as one word: its logarithm , or for zero (playing the role of ). Then, with all logarithms taken modulo and the special value for zero handled separately,
- , , ;
- the Frobenius map is and the -th root is ;
- for odd (the unique element of order 2), and for , so negation adds or nothing;
- for odd , is a square if and only if is even, since the squares form the subgroup of index 2; its square roots are . For every element is a square, and the square root of is or ( is odd);
- for , , where is "infinite" (the sum is zero) when ; subtraction is addition of .
So every operation except table construction costs a few word operations and one memory access. When the table does not fit in the cache, the memory access dominates: for the polynomial representation fq_nmod is already faster (see Arithmetic in finite fields).
Building the tables#
Let be the defining polynomial and the class of in . To index elements by integers, write an element in the polynomial representation as with and map it to the integer , its coefficients read as digits in base . This is a bijection between and , with and .
Input: a monic irreducible of degree over .
Output: the tables and for , and for ; or failure if is not primitive.
- Set for , and .
- For : let ; if , fail. Set and ; if is a constant , set . Set .
- For each : let if and otherwise; set (with for the element 0).
Theorem 1. Algorithm 1 fails if and only if is not a primitive element of . Otherwise it computes the tables correctly, with multiplications in and further word operations.
Proof. The loop in step 2 visits . These are pairwise distinct if and only if the order of is at least , that is, if is primitive; since is injective and , a repeated value of occurs exactly when two of the powers coincide. If is primitive, every nonzero element is reached once, so for every , and and are the stated tables. In step 3, is for the element with : adding 1 increases the constant coefficient by one, except that wraps to 0, which subtracts from . Hence for , , with the value when .
The tables take words for , for and for ; the temporary table takes another words. Because the construction fails for a non-primitive , it doubles as a primitivity test: fq_zech_ctx_init_fq_nmod_ctx_check returns 0 in that case. Conway polynomials are primitive by definition, and other fq_zech contexts are created with random primitive polynomials (Defining polynomials).
Conversions, norm and trace#
The table gives the polynomial representation of directly: its coefficients are the base- digits of , which is how fq_zech_get_fq_nmod and the polynomial multiplication of fq_zech_poly convert elements. Conversely, is computed as a sum of the terms with Zech additions.
The norm of is , and it is for the monic minimal polynomial of ; it is a generator of , since has order . The context stores it (prime_root), and then:
- , one exponentiation modulo (
fq_zech_norm); - the elements of are the powers , so an element of the prime field with logarithm corresponds to the integer ;
fq_zech_tracesums the conjugates with Zech additions and converts the result in this way.
Use in FLINT#
- The tables are built by
fq_zech_ctx_init_fq_nmod_ctx_check, which is called by allfq_zech_ctx_initfunctions and byfq_defaultwhen it chooses the Zech representation. fq_zech_add,fq_zech_sub,fq_zech_neg,fq_zech_mul,fq_zech_inv,fq_zech_pow,fq_zech_frobenius,fq_zech_pth_root,fq_zech_sqrt,fq_zech_is_square,fq_zech_normandfq_zech_traceimplement the formulas above.- The generic
grcontext offq_zechhas a dot product working directly with logarithms, used by the classical polynomial multiplication offq_zech_poly(through_gr_poly_mullow_classical); long polynomial products convert to the polynomial representation (Multiplying polynomials over finite fields).
Referenced from#
- Frobenius map, norm, trace and roots (algorithm)
- fq_zech.h (module)
References#
- [LN1997] R. Lidl and H. Niederreiter. Finite Fields. Second edition, Encyclopedia of Mathematics and its Applications 20, Cambridge University Press, 1997.
- [Hub1990] K. Huber. Some comments on Zech's logarithms. IEEE Transactions on Information Theory 36:4 (1990), 946–950.
The FLINT team, “Zech logarithms,” FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev, 2026. https://flintlib.org/doc/algorithms/finite-fields/zech-logarithms.html (generated 2026-11-02).
@misc{flint-doc-algorithms-finite-fields-zech-logarithms,
author = {{The FLINT team}},
title = {{Zech logarithms}},
howpublished = {FLINT: Fast Library for Number Theory, documentation, version 3.7.0-dev},
year = {2026},
url = {https://flintlib.org/doc/algorithms/finite-fields/zech-logarithms.html},
note = {Generated 2026-11-02}
}