This repository contains a basic implementation in C of the Karatsuba algorithm for multiplying two polynomials in
Given two polynomials
$A(X) = P_0(X) \times Q_0(X)$ $B(X) = (P_0(X) + P_1(X)) \times (Q_0(X) + Q_1(X))$ $C(X) = P_1(X) \times Q_1(X)$
Finally, the result of the multiplication, a polynomial of degree
Below is a simple evaluation of this implementation compared to the naive algorithm.
The graph below shows the evolution of the time taken by each method to multiply two randomly-generated polynomials as their degrees increase.
The executable was compiled with the optimization flag -O3
.
This plot was generated by filling