Multiplying Big Numbers Using FFT

Click For Summary
Multiplying large numbers using the Fast Fourier Transform (FFT) is a well-researched topic, with numerous papers available. The discussion centers on a simpler algorithm for multiplying two big numbers, which involves treating the numbers as polynomials and using FFT for efficient convolution. The algorithm consists of four main steps: representing the numbers as polynomials, converting them into padded vectors, applying FFT to compute their convolution, and finally recovering the product. The complexity analysis indicates that the algorithm operates in m log(m) time, where m is the degree of the polynomials, and suggests that this is efficient compared to the n log(n) complexity noted in standard texts like CLRS. The confusion arises from the frequent mention of polynomial interpolation using roots of unity in academic papers, which appears to be a specific description of the FFT process. The necessity of this terminology is questioned, as it may seem extraneous to the core algorithm.
n+1
Messages
13
Reaction score
0
Multiplying big numbers is a very common application of the FFT, and as such, there are many papers on the subject available online.

However, these papers all use sophisticated algorithms where a simple one seems to work. My question is, what's wrong with the simple algorithm:

Multiplication of Two Big Numbers Algorithm:
Input: Two integers, a and b, stored in base B.
Step 1: Write a and b as polynomials in Z[B ], a(B) and b(B).Let m be the the larger of the two degrees.
Step 2: Rewrite a(B) and b(B) as 2m-dimensional vectors by padding with 0s. Denote these vectors by v_a and v_b.
Step 3: Use the FFT and Convolution Theorem to compute the Convolution of v_a and v_b quickly.
Step 4: Recover ab by reversing step 2 and 1.

Complexity Analysis
Let D = Max(a,b). Notice log(D) ~ m.
Step 1: 1. You're just reinterpreting what a list represents.
Step 2: m. You're at most adding 2m zeroes.
Step 3: m log(m).
Step 4: m. You're doing similar operations as in steps 1 and 2.
Conclusion: m log(m) or log(d) log(log(d)).
 
Technology news on Phys.org
CLRS discusses polynomial multiplication (Chapter 32). They verify that polynomial multiplication using the FFT has complexity n log(n).

I guess my confusion stemmed from talk about "the interpolation of polynomials using roots of unity." Every paper I read talks about this. As far as I can tell, this is just a problem-specific description of the FFT. I don't know why the authors are so eager about adding this extraneous information -- but again, they know way more about the subject than I do. Oh well.
 
Learn If you want to write code for Python Machine learning, AI Statistics/data analysis Scientific research Web application servers Some microcontrollers JavaScript/Node JS/TypeScript Web sites Web application servers C# Games (Unity) Consumer applications (Windows) Business applications C++ Games (Unreal Engine) Operating systems, device drivers Microcontrollers/embedded systems Consumer applications (Linux) Some more tips: Do not learn C++ (or any other dialect of C) as a...

Similar threads

  • · Replies 10 ·
Replies
10
Views
4K
Replies
9
Views
3K
Replies
25
Views
4K
Replies
41
Views
49K
  • · Replies 2 ·
Replies
2
Views
2K
Replies
33
Views
4K
  • · Replies 4 ·
Replies
4
Views
4K
Replies
3
Views
2K
  • · Replies 65 ·
3
Replies
65
Views
7K
  • · Replies 1 ·
Replies
1
Views
1K