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.6 Polynomial arithmetic 511<br />

Incidentally, if polynomial multiplication in rings is done via fast integer<br />

convolution (recall that acyclic convolution is sufficient, and so zero-padded<br />

cyclic will do), then one may obtain a different expression for the complexity<br />

bound. For the Nussbaumer Algorithm 9.5.25 one requires O(M(ln m)D ln D)<br />

bit operations, where M is the usual integer-multiplication complexity. It is<br />

interesting to compare these various estimates for polynomial multiplication<br />

(see Exercise 9.70).<br />

9.6.2 Fast polynomial inversion and remaindering<br />

Let x(t) = D−1<br />

j=0 xjt j be a polynomial. If x0 = 0,thereisaformalinversion<br />

1/x(t) =1/x0 − (x1/x 2 0)t +(x 2 1/x 3 0 − x2/x 2 0)t 2 + ···<br />

that admits of rapid evaluation, by way of a scheme we have already invoked<br />

for reciprocation, the celebrated Newton method. We describe the scheme in<br />

the case that x0 = 1, from which case generalizations are easily inferred. In<br />

what follows, the notation<br />

z(t) modt k<br />

is a polynomial remainder (which we cover later), but in this setting it is<br />

simple truncation: The result of the mod operation is a polynomial consisting<br />

of the terms of polynomial z(t) through order t k−1 inclusive. Let us define,<br />

then, a truncated reciprocal,<br />

R[x, N] =x(t) −1 mod t N+1<br />

as the series of 1/x(t) through degree t N ,inclusive.<br />

Algorithm 9.6.2 (Fast polynomial inversion). Let x(t) be a polynomial<br />

with first coefficient x0 = 1. This algorithm returns the truncated reciprocal<br />

R[x, N] through a desired degree N.<br />

1. [Initialize]<br />

g(t) =1; // Degree-zero polynomial.<br />

n =1; // Working degree precision.<br />

2. [Newton loop]<br />

while(n N+1) n = N +1;<br />

h(t) =x(t) modt n ; // Simple truncation.<br />

h(t) =h(t)g(t) modt n ;<br />

g(t) =g(t)(2 − h(t)) mod t n ; // Newton iteration.<br />

}<br />

return g(t);<br />

One point that should be stressed right off is that in principle, an operation<br />

f(t)g(t) modt n is simple truncation of a product (the operands usually<br />

themselves being approximately of degree n). This means that within

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

Saved successfully!

Ooh no, something went wrong!