Content deleted Content added
Cronholm144 (talk | contribs) clean up and/or add/rm math rating template using AWB |
CRGreathouse (talk | contribs) cleanup, delete commented-out example |
||
Line 4:
The speed of this algorithm relies partly on the ability to do [[arithmetic shift|shift]]s faster than a standard multiply, with shifts typically taking [[linear time]] on a practical computer.
We assume two ''n''-digit numbers ''x'' and ''y'', represented in [[radix|base]] ''B''
:''x'' = ''x''<sub>1</sub>''B''<sup>''m''</sup> + ''x''<sub>2</sub>
Line 27:
Thus ''xy'' = ''X'' ''B''<sup>2m</sup> + ''Y'' + ''Z'' ''B''<sup>m</sup>; we have cut down the number of multiplications from four to three.
To compute these three products of ''m''-digit numbers, we can [[recursion|recursively]] employ Karatsuba multiplication again
Karatsuba multiplication works best when the two operands are of similar size; thus while one can theoretically choose ''m'' arbitrarily, the best time bound would be achieved by choosing ''m'' such that the subproducts are roughly equal, that is setting ''m'' to be about ''n''/2.
Line 49:
Implementations differ greatly on what the crossover point is when Karatsuba becomes faster than the classical algorithm, but generally numbers over 2<sup>320</sup> are faster with Karatsuba. [http://gmplib.org/manual/Karatsuba-Multiplication.html][http://ozark.hendrix.edu/~burch/proj/karat/comment1.html] [[Toom-Cook multiplication]] is a faster generalization of Karatsuba's, and is further surpassed by the fastest known, the [[Schönhage-Strassen algorithm]].
==References==
|