Skip to content

NTT: Number theoretic transform

Bulat-Ziganshin edited this page Nov 28, 2015 · 10 revisions

What one need to know in order to implement N*logN Reed-Solomon error-correction codes

NTT implementation

Prerequsites:

Topics:

Once you grasped all these topics, you can grab some FFT implementation and convert it to NTT.

NTT meaning

If source vector A = (A0, A1...A[n-1]) represents polynomial A(x) = A0 + A1*x + ... + A[n-1]*x**(n-1), then NTT(A,a) computes polynomial values at the points 1, a, a**2 ... a**(n-1), representing n roots of power n of 1 (if a is a primitive root of power n of 1). It's equivalent to multiplying vector A to Vandermonde Matrix defined by these points. So, NTT converts polynom coefficients to polynom values at these specific points, and iNTT (inverse NTT) reverses this transformation. iNTT is almost the same as NTT, i.e. iNTT(A,a) = NTT(A,-a)/n (with an element-wise division) reverses the effect of NTT(A,a).

This means that NTT(A,a) provides us the fast way to convert polynom coefficients A to values at a**i points and vice versa.

Clone this wiki locally