10.12.2012 Views

Prime Numbers

Prime Numbers

Prime Numbers

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

502 Chapter 9 FAST ALGORITHMS FOR LARGE-INTEGER ARITHMETIC<br />

There is one more important aspect of the DGT convolution: All mod<br />

operations are with respect to Mersenne primes, and so an implementation<br />

can enjoy the considerable speed advantage we have previously encountered<br />

for such special cases of the modulus.<br />

9.5.6 Schönhage method<br />

The pioneering work in [Schönhage and Strassen 1971], [Schönhage 1982],<br />

based on Strassen’s ideas for using FFTs in large-integer multiplication,<br />

focuses on the fact that a certain number-theoretical transform is possible—<br />

using exclusively integer arithmetic—in the ring Z2 m +1. Thisissometimes<br />

called a Fermat number transform (FNT) (see Exercise 9.52) and can be used<br />

within a certain negacyclic convolution approach as follows (we are grateful<br />

to P. Zimmermann for providing a clear exposition of the method, from which<br />

description we adapted our rendition here):<br />

Algorithm 9.5.23. [Fast multiplication (mod 2 n +1) (Schönhage)] Given<br />

two integers 0 ≤ x, y < 2 n +1, this algorithm returns the product xy mod (2 n +<br />

1).<br />

1. [Initialize]<br />

Choose FFT size D =2 k dividing n;<br />

Writing n = DM, set a recursion length n ′ ≥ 2M + k such that D divides<br />

n ′ , i.e., n ′ = DM ′ ;<br />

2. [Decomposition]<br />

Split x and y into D parts of M bits each, and store these parts, considered<br />

as residues modulo (2n′ +1), in two respective arrays A0,...,AD−1 and<br />

B0,...,BD−1, taking care that an array element could in principle have<br />

n ′ +1bits later on;<br />

3. [Prepare DWT by weighting the A, B signals]<br />

for(0 ≤ j

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!