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.

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

3. [Dyadic product]<br />

Z = X ∗ Y ;<br />

4. [Inverse transform]<br />

z = DWT −1 (Z, a);<br />

5. [Round digits]<br />

z = round(z); // Elementwise rounding to nearest integer.<br />

6. [Adjust carry in variable base]<br />

carry =0;<br />

for(0 ≤ n 0 as a high digit of z;<br />

z = z mod p; // Via carry loop or special-form mod.<br />

return z;<br />

As this scheme is somewhat intricate, an example is appropriate. Consider<br />

multiplication modulo the Mersenne number p =2 521 − 1. We take q = 521<br />

and choose signal length D = 16. Then the signal d of Theorem 9.5.18 can be<br />

seen to be<br />

d = (33, 33, 32, 33, 32, 33, 32, 33, 33, 32, 33, 32, 33, 32, 33, 32),<br />

and the weight signal will be<br />

a = 1, 2 7/16 , 2 7/8 , 2 5/16 , 2 3/4 , 2 3/16 , 2 5/8 , 2 1/16 , 2 1/2 , 2 15/16 ,<br />

2 3/8 , 2 13/16 , 2 1/4 , 2 11/16 , 2 1/8 , 2 9/16 .<br />

In a typical floating-point FFT implementation, this a signal is, of course,<br />

given inexact elements. But in Theorem 9.5.18 the weighted convolution (as<br />

calculated approximately, just prior to the [Round digits] step of Algorithm<br />

9.5.19) consists of exact integers. Thus, the game to be played is to choose<br />

signal length D to be as small as possible (the smaller, the faster the FFTs<br />

that do the DWT), while not allowing the rounding errors to give incorrect<br />

elements of z. Rigorous theorems on rounding error are hard to come by,<br />

although there are some observations—some rigorous and some not so—in<br />

[Crandall and Fagin 1994] and references therein. More modern treatments<br />

include the very useful book [Higham 1996] and the paper [Percival 2003] on<br />

generalized IBDWT; see Exercise 9.48.<br />

9.5.5 Number-theoretical transform methods<br />

The DFT of Definition 9.5.3 can be defined over rings and fields other than the<br />

traditional complex field. Here we give some examples of transforms over finite

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

Saved successfully!

Ooh no, something went wrong!