10.12.2012 Views

Prime Numbers

Prime Numbers

Prime Numbers

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

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

}<br />

}<br />

Y = Y + J;<br />

m = m + J;<br />

}<br />

J =2∗ J;<br />

X = X − D/2;<br />

Y = Y − D;<br />

(X, Y )=(Y,X); // Swap pointers!<br />

3. [Make ping-pong parity decision]<br />

if(d even) return (complex data at X);<br />

return (complex data at Y );<br />

The useful loop aspect of this algorithm is the fact that the loop variable j<br />

runs contiguously (from J down), and so on a vector machine one may process<br />

chunks of data all at once, by picking up, then putting back, data as vectors.<br />

Incidentally, to perform an inverse FFT is extremely simple, once the<br />

forward FFT is implemented. One approach is simply to look at Definition<br />

9.5.3 and observe that the root g can be replaced by g −1 ,withafinaloverall<br />

normalization 1/D applied to an inverse FFT. But when complex fields are<br />

used, so that g −1 = g ∗ , the procedure for FFT −1 can be, if one desires, just<br />

a sequence:<br />

x = x ∗ ; // Conjugate the signal.<br />

X = FFT(x); // The usual FFT, with usual root g.<br />

X = X ∗ /D; // Final conjugate and normalize.<br />

Though these Cooley–Tukey and Gentleman–Sande FFTs are most often<br />

invoked over the complex numbers, so that the root is g = e 2πi/D ,say,they<br />

are useful also as number-theoretical transforms, with operations carried out<br />

in a finite ring or field. In either the complex or finite-field cases, it is common<br />

that a signal to be transformed has all real elements, in which case we call<br />

the signal “pure-real.” This would be so for complex signal x ∈ C D but such<br />

that xj = aj +0i for each j ∈ [0,D− 1]. It is important to observe that the<br />

analogous signal class can occur in certain fields, for example F p 2 when p ≡ 3<br />

(mod 4). For in such fields, every element can be represented as xj = aj + bji,<br />

and we can say that a signal x ∈ F D p 2 is pure-real if and only if every bj is zero.<br />

The point of the pure-real signal class designation is that in general, an FFT<br />

for pure-real signals has about 1/2 the usual complexity. This makes sense<br />

from an information-theoretical standpoint: Indeed, there is “half as much”<br />

data in a pure-real signal. A basic way to cut down thus the FFT complexity<br />

for pure-real signals is to embed half of a pure-real signal in the imaginary<br />

parts of a signal of half the length, i.e., to form a complex signal<br />

yj = xj + ix j+D/2<br />

for j ∈ [0,D/2 − 1]. Note that signal y now has length D/2. One then<br />

performs a full, half-length, complex FFT and then uses some reconstruction

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

Saved successfully!

Ooh no, something went wrong!