Executable additive NTT algorithms #
Generic function-backed and array-backed additive NTT implementations over a finite field, with an explicitly supplied binary-subfield algebra and independent basis vectors. The function-backed transform mirrors the abstract stages; the array-backed transform caches subspace-polynomial constants and twiddle tables.
CompPoly.Fields.Binary.AdditiveNTT.Correctness relates these implementations to the
abstract algorithm and its evaluation specification. Concrete tower instances and the
compatibility entry point remain in CompPoly.Fields.Binary.AdditiveNTT.Impl.
The coefficient tiling, twiddle factors, and descending butterfly stages follow the Lin–Chung–Han additive NTT presentation in [DP24], Algorithm 2. The array-backed path caches quantities used by these same stages.
References #
The product of a function over the list of finite indices equals its finite product.
Map the numeric mask k to the sum of the first i basis vectors selected by its bits,
as an element of their linear span.
Instances For
Compute the stage-i twiddle factor by summing normalized subspace-polynomial
evaluations selected by the bits of u.
Instances For
Perform stage i on the coefficient buffer b, pairing entries whose indices differ
in bit i and applying the corresponding twiddle factor.
Instances For
Transform 2 ^ ℓ novel-basis coefficients into 2 ^ (ℓ + R_rate) values by first
tiling the coefficients and then applying stages ℓ - 1 down to 0. The basis has length
r, and ℓ + R_rate < r bounds the evaluation domain.
Instances For
Starting from acc, iterate acc ↦ acc * (acc + constants[k]) for indices
k from j to constants.size - 1. Return acc unchanged when constants.size ≤ j.
For j ≤ constants.size, if the initial accumulator is W_j(x) and the remaining
constants are W_k(β_k), the result is W_{constants.size}(x).
Instances For
Evaluate a subspace polynomial using cached constants W_k(β_k).
Starting from W_0(x) = x, each cached constant advances the recurrence
W_{k+1}(x) = W_k(x) * (W_k(x) + W_k(β_k)).
Instances For
Extend the supplied constants array, starting at index k and stopping before i.
Each step evaluates the polynomial recurrence encoded by the current array at β_k
and appends the result. Return the array unchanged when i ≤ k.
If the supplied array has length k and entry j is W_j(β_j) for every j < k,
each appended entry has the same interpretation at its index.
Instances For
Precompute all twiddle factors for one additive NTT stage.
The table entry for u is the subset sum of the cached normalized values
selected by the set bits of u.
Instances For
Array update for one additive NTT stage.
The twiddles array is intended to store the values of computableTwiddleFactor
for this stage, indexed by u. Missing entries in either input array are read as zero.
Instances For
Fast additive NTT stage driver over an Array L state.
The state is expected to contain the initialized output buffer. Each stage
updates that buffer using the array transition from
computableNTTStageArray.