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.

9.5 Large-integer multiplication 475<br />

Evaluate symbolically z(j) =x(j)y(j) for each j ∈ [1 − D, D − 1], sothat<br />

each z(j) is cast in terms of the original coefficients of the x and y<br />

polynomials;<br />

3. [Reconstruction]<br />

Solve symbolically for the coefficients zj in the following linear system of<br />

(2D − 1) equations:<br />

z(t) = 2D−2<br />

k=0 zkt k , t ∈ [1 − D, D − 1];<br />

4. [Report scheme]<br />

Report a list of the (2D − 1) relations, each relation casting zj in terms of<br />

the original x, y coefficients;<br />

The output of this algorithm will be a set of formulae that give the coefficients<br />

of the polynomial product z(t) = x(t)y(t) in terms of the coefficients of<br />

the original polynomials. But this is precisely what is meant by integer<br />

multiplication, if each polynomial corresponds to a D-digit representation in<br />

a fixed base B.<br />

To underscore the Toom–Cook idea, we note that all of the Toom–Cook<br />

multiplies occur in the [Evaluation] step of Algorithm 9.5.1. We give next<br />

a specific multiplication algorithm that requires five such multiplies. The<br />

previous, symbolic, algorithm was used to generate the actual relations of<br />

this next algorithm:<br />

Algorithm 9.5.2 (Explicit D = 3 Toom–Cook integer multiplication).<br />

For integers x, y given in base B as<br />

x = x0 + x1B + x2B 2 ,<br />

y = y0 + y1B + y2B 2 ,<br />

this algorithm returns the base-B digits of the product z = xy, using the<br />

theoretical minimum of 2D − 1=5multiplications for acyclic convolution of<br />

length-3 sequences.<br />

1. [Initialize]<br />

r0 = x0 − 2x1 +4x2;<br />

r1 = x0 − x1 + x2;<br />

r2 = x0;<br />

r3 = x0 + x1 + x2;<br />

r4 = x0 +2x1 +4x2;<br />

s0 = y0 − 2y1 +4y2;<br />

s1 = y0 − y1 + y2;<br />

s2 = y0;<br />

s3 = y0 + y1 + y2;<br />

s4 = y0 +2y1 +4y2;<br />

2. [Toom–Cook multiplies]<br />

for(0 ≤ j

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

Saved successfully!

Ooh no, something went wrong!