Prime Numbers
Prime Numbers Prime Numbers
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
- Page 472 and 473: 9.4 Enhancements for gcd and invers
- Page 474 and 475: 9.4 Enhancements for gcd and invers
- Page 476 and 477: 9.4 Enhancements for gcd and invers
- Page 478 and 479: 9.4 Enhancements for gcd and invers
- Page 480 and 481: 9.4 Enhancements for gcd and invers
- Page 482 and 483: 9.5 Large-integer multiplication 47
- Page 484 and 485: 9.5 Large-integer multiplication 47
- Page 486 and 487: 9.5 Large-integer multiplication 47
- Page 488 and 489: 9.5 Large-integer multiplication 47
- Page 490 and 491: 9.5 Large-integer multiplication 48
- Page 492 and 493: 9.5 Large-integer multiplication 48
- Page 494 and 495: 9.5 Large-integer multiplication 48
- Page 496 and 497: 9.5 Large-integer multiplication 48
- Page 498 and 499: 9.5 Large-integer multiplication 48
- Page 500 and 501: 9.5 Large-integer multiplication 49
- Page 502 and 503: 9.5 Large-integer multiplication 49
- Page 504 and 505: 9.5 Large-integer multiplication 49
- Page 506 and 507: 9.5 Large-integer multiplication 49
- Page 508 and 509: 9.5 Large-integer multiplication 49
- Page 510 and 511: 9.5 Large-integer multiplication 50
- Page 512 and 513: 9.5 Large-integer multiplication 50
- Page 514 and 515: 9.5 Large-integer multiplication 50
- Page 516 and 517: 9.5 Large-integer multiplication 50
- Page 518 and 519: 9.6 Polynomial arithmetic 509 can i
- Page 520 and 521: 9.6 Polynomial arithmetic 511 Incid
- Page 524 and 525: 9.6 Polynomial arithmetic 515 such
- Page 526 and 527: 9.6 Polynomial arithmetic 517 Note
- Page 528 and 529: 9.7 Exercises 519 (3) Write out com
- Page 530 and 531: 9.7 Exercises 521 where “do” si
- Page 532 and 533: 9.7 Exercises 523 9.23. How general
- Page 534 and 535: 9.7 Exercises 525 two (and thus, me
- Page 536 and 537: 9.7 Exercises 527 0 2 +3 2 +0 2 is
- Page 538 and 539: 9.7 Exercises 529 9.49. In the FFT
- Page 540 and 541: 9.7 Exercises 531 adjustment step.
- Page 542 and 543: 9.7 Exercises 533 9.69. Implement A
- Page 544 and 545: 9.8 Research problems 535 less than
- Page 546 and 547: 9.8 Research problems 537 1.66), na
- Page 548 and 549: 9.8 Research problems 539 9.82. A c
- Page 550 and 551: 542 Appendix BOOK PSEUDOCODE Becaus
- Page 552 and 553: 544 Appendix BOOK PSEUDOCODE } ...;
- Page 554 and 555: 546 Appendix BOOK PSEUDOCODE Functi
- Page 556 and 557: 548 REFERENCES [Apostol 1986] T. Ap
- Page 558 and 559: 550 REFERENCES [Bernstein 2004b] D.
- Page 560 and 561: 552 REFERENCES [Buchmann et al. 199
- Page 562 and 563: 554 REFERENCES [Crandall 1997b] R.
- Page 564 and 565: 556 REFERENCES [Dudon 1987] J. Dudo
- Page 566 and 567: 558 REFERENCES [Goldwasser and Kili
- Page 568 and 569: 560 REFERENCES [Joe 1999] S. Joe. A
- Page 570 and 571: 562 REFERENCES [Lenstra 1981] H. Le
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