Prime Numbers

Prime Numbers Prime Numbers

thales.doa.fmph.uniba.sk
from thales.doa.fmph.uniba.sk More from this publisher
10.12.2012 Views

9.6 Polynomial arithmetic 513 where it is understood that xj = 0 for all j > D − 1. We also define a polynomial index function as ind(x, d) =min{j : j ≥ d; xj = 0}, or ind(x, d) = 0 if the stated set of j is empty. For example, rev(1 + 3t 2 +6t 3 +9t 5 + t 6 , 3) = 6 + 3t + t 3 , ind(1 + 3t 2 +6t 3 , 1) = 2. A remaindering algorithm can now be given: Algorithm 9.6.4 (Fast polynomial mod). Let x(t),y(t) be given polynomials with y(t) monic (high coefficient is 1). This algorithm returns the polynomial remainder x(t) mody(t). 1. [Initialize] if(deg(y) ==0) return 0; d =deg(x) − deg(y); if(d

514 Chapter 9 FAST ALGORITHMS FOR LARGE-INTEGER ARITHMETIC Whatever method used for polynomial gcd, the fast polynomial remaindering scheme of this section can be applied as desired for the internal polynomial mod operations. 9.6.3 Polynomial evaluation We next discuss polynomial evaluation techniques. The essential problem is to evaluate a polynomial x(t) = D−1 j=0 xjtj at, say, each of n field values t0,...,tn−1. It turns out that the entire sequence (x(t0),x(t1),...,x(tn−1)) canbeevaluatedin O n ln 2 min{n, D} field operations. We shall split the problem into three basic cases: (1) The arguments t0,...,tn−1 lie in arithmetic progression. (2) The arguments t0,...,tn−1 lie in geometric progression. (3) The arguments t0,...,tn−1 are arbitrary. Of course, case (3) covers the other two, but in (1), (2) it can happen that special enhancements apply. Algorithm 9.6.5 (Evaluation of polynomial on arithmetic progression). Let x(t) = D−1 j=0 xjtj . This algorithm returns the n evaluations x(a),x(a + d),x(a +2d),...,x(a +(n− 1)d). (The method attains its best efficiency when n is much greater than D.) 1. [Evaluate at first D points] for(0 ≤ j

9.6 Polynomial arithmetic 513<br />

where it is understood that xj = 0 for all j > D − 1. We also define a<br />

polynomial index function as<br />

ind(x, d) =min{j : j ≥ d; xj = 0},<br />

or ind(x, d) = 0 if the stated set of j is empty.<br />

For example,<br />

rev(1 + 3t 2 +6t 3 +9t 5 + t 6 , 3) = 6 + 3t + t 3 ,<br />

ind(1 + 3t 2 +6t 3 , 1) = 2.<br />

A remaindering algorithm can now be given:<br />

Algorithm 9.6.4 (Fast polynomial mod). Let x(t),y(t) be given polynomials<br />

with y(t) monic (high coefficient is 1). This algorithm returns the polynomial<br />

remainder x(t) mody(t).<br />

1. [Initialize]<br />

if(deg(y) ==0) return 0;<br />

d =deg(x) − deg(y);<br />

if(d

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

Saved successfully!

Ooh no, something went wrong!