Number Theoretic Transform is a Fast Fourier transform theorem generalization. It is obtained by the replacement of e^(-2piik/N) with an nth primitive unity root. So this means, instead of the complex numbers C, use transform over the quotient ring Z/pZ. The theory is based on and uses the concepts of finite fields and number theory.
Number Theoretic Transform modulus need to be prime necessarily. But if it is prime, it makes things simpler. One can perform the NTT with a composite modulus. For modulus :
- nth root of unity existence
- multiplicative inverse of n
A number-theoretic transform is basically a Fourier transform. Also, suppose that a Normal Discrete Fourier Transform is given and it can be done in matrix form by multiplying the data with a Fourier Matrix. Let us suppose N = 4. Then, the matrix can be –
[ 1 1 1 1 ] [ 1 w w^2 w^3 ] [ 1 w^2 w^4 w^6 ] [ 1 w^3 w^6 w^9 ]
sympy.discrete.transforms.ntt( ) :
It can Number Theoretic Transform (NTT) of the sequence.
It specializes over the Discrete Fourier Transform (DFT) quotient ring with Z/pZ for the prime na complexstead of acomplex numbers.
Automatically the sequence is padded with zero to the right because the radix-2 FFT requires the sample point number as a power of 2.
Parameters : -> seq : [iterable] sequence on which DFT is to be applied. -> prime no. : [Integer] prime modulus for NTT to perform on. Returns : Number Theoretic Transform
Example 1 :
NTT : [93, 114, 732, 659]
Example 2 :
NTT : [651, 276, 690, 533]
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Python | Inverse Number Theoretic Transformation
- Negative transformation of an image using Python and OpenCV
- Python | Fast Fourier Transformation
- Python | Intensity Transformation Operations on Images
- Python | Inverse Fast Walsh Hadamard Transformation
- Python | Inverse Fast Fourier Transformation
- Perspective Transformation - Python OpenCV
- Log transformation of an image using Python and OpenCV
- Python OpenCV - Affine Transformation
- Box-Cox Transformation using Python
- NLP | Chunk Tree to Text and Chaining Chunk Transformation
- Python | Find the Number Occurring Odd Number of Times using Lambda expression and reduce function
- Number of ways to divide a given number as a set of integers in decreasing order
- Get the number of rows and number of columns in Pandas Dataframe
- Minimum number of squares whose sum equals to a given number N | Set-3
- Find the position of number that is multiple of certain number
- Analysis of Different Methods to find Prime Number in Python
- Print number with commas as 1000 separators in Python
- Python program to count number of vowels using sets in given string
- Python | Minimum number of subsets with distinct elements using Counter
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.