Presentation is loading. Please wait.

Presentation is loading. Please wait.

Advanced Algebraic Algorithms on Integers and Polynomials Prepared by John Reif, Ph.D. Analysis of Algorithms.

Similar presentations


Presentation on theme: "Advanced Algebraic Algorithms on Integers and Polynomials Prepared by John Reif, Ph.D. Analysis of Algorithms."— Presentation transcript:

1 Advanced Algebraic Algorithms on Integers and Polynomials Prepared by John Reif, Ph.D. Analysis of Algorithms

2 Integer and Polynomial Computations a)Newton Iteration: application to division b)Evaluation and Interpolation via Chinese Remaindering Main Lecture Material: Algorithms on Integers Advanced Lecture Material: Extension of Algorithms to Polynomials

3 Taylor Expansion

4 Taylor Expansion (cont’d) To find root f(x), use Newton Iteration: Example: –To find reciprocal of x choose find root

5 Application of Newton Iteration to Reciprocal of an Integer Input integer x, accuracy bound k Initialize if x has n bits

6 Application of Newton Iteration to Reciprocal of an Integer (cont’d) Theorem Integer Reciprocal can be computed to accuracy 2 -n in O(log n) integer mults and additions.

7 Steven Cooks’s Improvement (His Harvard Ph.D. Thesis) Key Trick: Since we need only compute y k up to 2 k+1 bit accuracy of error on kth stage Total Time Cost Where M(n) is time cost to multiply two n bit integers

8 Other Applications of Newton Iterations on Integers O(M(n)) time algorithms: Quotient + divisor of integer division Square root Sin, cosine, etc. Used in practice!

9 Reciprocal = polynomial r(x) where and (x) has degree < n-1 Advanced Topic: Extension to Polynomial Reciprocal Definition of Polynomial Reciprocal

10 Algorithm : Reciprocal (P(x)) Input polynomial degree n-1, n is power of 2

11 Proof of the Reciprocal Algorithm Theorem: The Algorithm Correctly Computes Reciprocal(P(x)) Proof by induction

12 Proof Algorithm Computes Reciprocal (P(x)) (cont’d) By induction hypothesis, if

13 Proof Algorithm Computes Reciprocal (P(x)) (cont’d) At line [3] we compute

14 Proof Algorithm Computes Reciprocal (P(x)) (cont’d)

15 Modular Arithmetic Assume relatively prime P 0, P 1, …, P k-1 Let given x, 0  x < p

16 Applications to Arithmetic But doesn’t extend to division (overflow problems)

17 Super Moduli Computation Input p 0, p 1, …, p k-1, where p i < 2 b Output Super modular Tree:

18 Super Moduli Computation (cont’d) Time Cost

19 Algorithm Residue Computation Input Output x 0, x 1, …, x k-1, when x i =x mod P i i=0, and k-1 Recursive algorithm [1] compute quotient and remainders:

20 Algorithm Residue Computation (cont’d) [2] recursively compute [3] output for i = 0, 1, …, k-1

21 Time Cost for Residue Computation Let D(n) = time cost for integer division = O(M(n)) Total Time for input size n = k· b

22 Proof of Algorithm for Residue Computation Idea of Proof of algorithm Uses fact: if x = q v + r and v mod P i = 0, then X mod P i = r mod P i

23 Advanced Topic: Residue Computation on Polynomials Input moduli P 0 (x), P 1 (x), …, P k-1 (x) and each degree  d and relatively prime Algorithm uses similar Super modular Tree tre, but using polynomials rather than integers

24 Advanced Topic: Residue Computation on Polynomials (cont’d) Output for i=0, …, k-1 Q i (x) = Q(x) mod P i (x) Q(x) has degree  kd Theorem The Residue Computation can be done in time O(M(n) log n) where n = k· d Proof Idea use same algorithm as in integer case

25 Advanced Topic: Multipoint Evaluation of Polynomials by Residue Computation Input polynomial f(x) degree n-1 and points x 0, x 1, …, x n-1 [1] for i=0, …, n-1 let P i (x) = (x-x i ) [2] By Residue Algorithm Computer for i=0, …, n-1 f(x i ) = f(x) mod P i (x) [3] output f(x 0 ), …, f(x n-1 ) Time Cost O(M(n) log n), = O(n(log n) 2 )

26 Polynomial Interpolation Input evaluation points x 0, …, x n-1 values y 0, …, y n-1 Output P(x) where y k = P(x k ) for k=0, …, n-1

27 Polynomial Interpolation (cont’d) Interpolation formula: Where

28 Proof of Polynomial Interpolation Proof uses identities:

29 Using Chinese Remaindering for Integer Interpolation Input relatively prime P 0, P 1, …, P n-1 and y i  {0,…P i-1 } for i=0,…,n-1 Problem compute y <  P i s.t. y i = y mod P i i=0, …, n-1

30 Generalized Interpolation Formula: Where proof Using Chinese Remaindering for Integer Interpolation

31 Advanced Topic: Preconditioned Interpolation Preconditioned Case assumes coefficients { a k | k=0, …, n-1} precomputed Use Divide & Conquer

32 Preconditioned Interpolation (cont’d)

33 Time Cost for Preconditioned Interpolation Assuming {a 0, …, a n-1 } precomputed

34 Precomputation of {a 0, …, a n-1 } 1)Compute 2)Compute b k where b k P k = P mod (P k ) 2 by Residue Computation O(M(n) log n) 3)Compute a k = (b k ) -1 mod P k by Extended GCD algorithm

35 Proof of Precomputation of {a 0, …, a n-1 } proof

36 Precomputation of {a 0, …, a n-1 } for Polynomial Interpolations Here P i = (x-x i ) for i=0, …, n-1  reduces to multipoint evaluation of derivative of Q(x) O(M(n) log n) time!

37 Conclusion Polynomial and Integer Computations use similar divide and conquer techniques to solve: 1.Multiplication 2.Division 3.Interpolation and evaluation Open Problem Reduce from time O(M(n)log n) to O(M(n))

38 Newton Iteration and Polynomial Computation Prepared by John Reif, Ph.D. Analysis of Algorithms


Download ppt "Advanced Algebraic Algorithms on Integers and Polynomials Prepared by John Reif, Ph.D. Analysis of Algorithms."

Similar presentations


Ads by Google