While going through a MIT lecture in MITOpencourseware (6.006 lecture 12), I came across the mention of 4 multiplication algorithms (to multiply two n-digit numbers) -
- Ordinary naive approach with O(n^2) complexity
- Karatsuba algorithm - O(n^1.584)
- Toom-Cook(Toom3) - O(n^1.465)
- Schonhage-Strassen - O(nlog(n)log(log(n)))
Now the thing to investigate was at which threshold points (i.e., values of n) did one method overtake the other as a better algorithm. It was mentioned that all the above are in gmpy package.
In order to try this out I referred to the gmpy2 package documentation at the following link - https://gmpy2.readthedocs.io/en/latest/intro.html
However on skimming through portions of this documentation it seemed that gmpy2 is more about dealing with large numbers. In particular I did not find separate functions implementing each of these above 4 algorithms. So are there any portions of gmpy2 where these algorithms are implemented so I may plot the running times of these algorithms against n (num of digits)?