Native cyclic convolution of signed coefficient arrays #
The fixed program computes each coefficient by a loop over the first factor. Both arrays contain canonical signed words; their addresses and length are unsigned. The partner index is computed by an actual comparison and subtraction, including the wrap case. Multiplication and addition use the existing signed kernels, without extending the instruction basis.
This is the coefficient kernel needed by the native cyclic-ring Strassen counter in #1701; it is not matrix multiplication or modular triangle counting by itself.
The algorithm adapts the cyclic-convolution loop in the pinned Anthropic source, Programs/Sec3/Theorem17/Hashing/RingOps.lean, lines 174–196, at 16a5ce41304fcdaea4e0be7c132e1c361dc26da5. The encoded native implementation is original.
Base of the first canonical signed coefficient array.
Base of the second canonical signed coefficient array.
Base of the output coefficient array.
Runtime number of coefficients.
Current output coefficient.
Current summation index.
Computed cyclic partner index.
Canonical signed partial sum.
Address-calculation scratch.
Constant one, initialized by the program.
Compute the cyclic partner using unsigned arithmetic in the two disjoint cases.
Load the two actual signed coefficients at their computed addresses.
Compute one signed product from the actual input arrays.
Preserve the product as the right operand and load the partial sum as the left operand.
Retain the new partial sum and advance the inner counter.
One real signed product followed by signed accumulation and index advancement.
Compute and store a complete coefficient, then advance the output index.
The entire coefficient multiplication uses a fixed register bank and actual nested loops.