Re:Thinking About Recursion
by dreamcompiler on Thursday March 09, 2017 @12:31AM
(#13827227)
Ordinary scalar multiplication can itself be expressed recursively, e.g. (2734 * 5896). Break each number into two parts and the answer is (27 * 96 * 100) + (34 * 58 * 100) + (27 * 58 * 100 * 100) + (34 * 96).
Fine.
Now what is (27 * 96)?
(2 * 6 * 10) + (7 * 9 * 10) + (2 * 9 * 10 * 10) + (7 * 6).
etc.
[In real life you'd do this in binary and the multiplies by 10 become shifts.]
This is not usually the fastest way to do scalar multiplication, but it illustrates that:
1. Ordinary scalar multiplication is polynomial multiplication.
2. Polynomial multiplication is convolution.
3. And since we can [sometimes] speed up convolution by moving it to the Fourier domain, we can multiply numbers by taking their FFTs first, doing an elementwise multiplication, and then taking an inverse FFT. This actually pays off on very large numbers.
Fine.
Now what is (27 * 96)? (2 * 6 * 10) + (7 * 9 * 10) + (2 * 9 * 10 * 10) + (7 * 6). etc. [In real life you'd do this in binary and the multiplies by 10 become shifts.]
This is not usually the fastest way to do scalar multiplication, but it illustrates that:
1. Ordinary scalar multiplication is polynomial multiplication.
2. Polynomial multiplication is convolution.
3. And since we can [sometimes] speed up convolution by moving it to the Fourier domain, we can multiply numbers by taking their FFTs first, doing an elementwise multiplication, and then taking an inverse FFT. This actually pays off on very large numbers.
Multiplication is fun stuff.