Skip to content

nttmul

polynomial · scripts/polynomial/nttmul.m

: c = nttmul (a, b, p)

Exact polynomial multiplication modulo prime p via NTT.

a and b are coefficient vectors in the same order as for conv. Returns mod (conv (a, b), p) computed as intt (ntt (a) .* ntt (b)) with a transform length at least numel (a) + numel (b) - 1 that divides p-1.

This is exact over GF(p) (no floating-point round-off), which is the purpose of the number-theoretic transform for polynomial products.