19.07.2014 Views

Contents - Student subdomain for University of Bath

Contents - Student subdomain for University of Bath

Contents - Student subdomain for University of Bath

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

136 CHAPTER 4. MODULAR METHODS<br />

Algorithm 18 (Sparse g.c.d.)<br />

Input: A, B polynomials in R[y][x].<br />

Output: gcd(A, B)<br />

Figure 4.12: Algorithm 18: Sparse g.c.d.<br />

A c := cont x (A); A := A/A c ; # Using Algorithm 16, which<br />

B c := cont x (B); B := B/B c ; # calls this algorithm recursively<br />

g :=Algorithm 18(lc x (A), lc x (B));<br />

# one fewer variable<br />

G :=failed<br />

while G =failed # Expect only one iteration<br />

G :=Algorithm 19(g, gA, gB);<br />

return pp x (G)× Algorithm 18(A c , B c ); # one fewer variable<br />

Figure 4.13: Algorithm 19: Inner sparse g.c.d.<br />

Algorithm 19 (Inner sparse g.c.d.)<br />

Input: g leading coefficient; A, B polynomials in R[y][x].<br />

Output: gcd(A, B), but with leading coefficient g<br />

or failed if we don’t have the Zippel assumption<br />

d n := min(deg yn<br />

(A), deg yn<br />

(B)) # (over)estimate <strong>for</strong> deg yn<br />

(gcd(A, B))<br />

v 0 :=random(lc(A), lc(B)); #assumed good and satisfying Zippel <strong>for</strong> gcd(A, B);<br />

P 0 :=Algorithm 19(g| yn=v 0<br />

, A| yn=v 0<br />

, B| yn=v 0<br />

)<br />

if P 0 =failed<br />

return failed # Don’t try again<br />

d x := deg x (P 0 )<br />

i := 0<br />

while i < d<br />

v :=random(lc(A), lc(B)); #assumed good<br />

P i+1 :=Algorithm 20(Sk(P 0 ), g| yn=v, A| yn=v, B| yn=v)<br />

if deg x (P i+1 ) > d x # Either v j in Algorithm 20 or<br />

continue round the loop # | yn=v was not a good evaluation<br />

if deg x (P i+1 ) < d x<br />

return failed # | yn=v 0<br />

was not a good evaluation<br />

i := i + 1; v i := v # store v and the corresponding P<br />

C :=Algorithm 42({P i }, {v i }) # Reconstruct<br />

if C divides both A and B<br />

return C<br />

else return failed<br />

random(lc(A), lc(B)) chooses a value not annihilating both leading coefficients

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

Saved successfully!

Ooh no, something went wrong!