Multiplication of polynomials

Size: px
Start display at page:

Download "Multiplication of polynomials"

Transcription

1 Multiplication of polynomials M. Gastineau IMCCE - Observatoire de Paris - CNRS UMR828 77, avenue Denfert Rochereau 7514 PARIS FRANCE gastineau@imcce.fr Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

2 Different products Full All terms are computed Truncated in the partial or total degree of the variables Special truncation to select terms satisfying a rule Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

3 Available methods Naive method efficient for low degree or for sparse polynomials Karatsuba s algorithm efficient for intermediate degree and dense polynomials reduce the number of multiplications FFT method efficient only for large degree Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

4 Naive multiplication A(x) = da max i=da min a i x i and B(x) = db max i=db min b i x i Perform the multiplication of all terms C(x) = da max +db max k=da min +db min c k x k with c k = if A, B and C, have r, s and t terms i+j=k a i b j rs multiplications and rs-t additions complexity : O(rs) Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

5 Multiplication for univariate polynomials stored as vector Algorithm 1: Compute the full product of univariate polynomials A and B represented with a dense vector Input: A: polynomial {da min, da max, array of coefficients a } Input: B: polynomial {db min, db max, array of coefficients b } Output: C: polynomial {dc min, dc max, array of coefficients c } dc min da min + db min dc max da max + db max C create a polynomial with minimal degree dc min and maximal degree dc max for k dc min to dc max do c[k] a[da min ] b[k da min ] for j da min + 1 to da max do c[k] c[k] + a[j] b[k j] return C Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

6 Multiplication for recursive dense vector 1/2 Function mulfull(a,b) Compute the full product of multivariate polynomials A and B represented with a recursive dense vector Input: A: multivariate polynomial {da min, da max, array of coefficients a} Input: B: multivariate polynomial {db min, db max, array of coefficients b} Output: C: multivariate polynomial {dc min, dc max, array of coefficients c} dc min da min + db min dc max da max + db max C create a polynomial with minimal dc min and maximal dc max degree for k dc min to dc max do c[k] mulfull (a[da min ], b[k da min ]) for j da min + 1 to da max do fmafull (a[j], b[k j], c[k]) return C Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

7 Multiplication for recursive dense vector 2/2 Procedure fmafull(a,b,c ) Compute the full fused multiplicationaddition C = C + A B with A, B and C multivariate polynomials represented as recursive dense vector Input: A: multivariate polynomial {da min, da max, array of coefficients a} Input: B: multivariate polynomial {db min, db max, array of coefficients b} Input: C: multivariate polynomial {dc min, dc max, array of coefficients c } Output: C: multivariate polynomial newdc min da min + db min newdc max da max + db max if newdc min < dc min or dc max < newdc max then dc min min(newdc min, dc min ) dc max max(newdc max, dc max ) resize C for k dc min to dc max do c[k] mulfull (a[da min ], b[k da min ]) for j da min + 1 to da max do fmafull (a[j], b[k j], c[k]) if c contains at its beginning or at its then adjust dc min adjust dc max resize C Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

8 Multiplication for univariate polynomials stored as list Function mulfull(a,b) Compute the full product of univariate polynomials A and B represented with a list Input: A: polynomial { list of ( coefficients a, degree δ a ) } Input: B: polynomial { list of ( coefficients b, degree δ b ) } Output: C: polynomial { list of ( coefficients c, degree δ c )} C create a empty polynomial foreach element in A do D create a empty polynomial foreach element in B do add to the tail of D an element (a b, δ a + δ b ) C C + D return C Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

9 Multiplication for recursive list Procedure fmafull(a,b,c ) Compute the full fused multiplicationaddition C = C + A B with A, B and C multivariate polynomials represented as recursive list Input: A: polynomial { list of ( coefficients a, degree δ a ) } Input: B: polynomial { list of ( coefficients b, degree δ b ) } Input: C: polynomial { list of ( coefficients c, degree δ c ) } Output: C: polynomial { list of ( coefficients c, degree δ c ) } iter head of C foreach element in A do // avoid to scan to C when the loop on B is finished iterb iter foreach element in B do // find after iterb in C if the degree δ a + δ b is present while current degree δ c referenced by iterb < δ a + δ b do iterb next element after iterb if δ c = δ a + δ b then fmafull (a, b, c) if c = then remove the element referenced by iterb else insert an element (mulfull (a, b), δ a + δ b ) just before iterb if current element is the first element of B then iter iterb Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

10 Multiplication for flat vector 1/2 variables exponents coefficients X X 1 2 m 1 2 m 1 n 1 st term 2 nd term 65 th term 66 th term 64*(m-1)+1 term 64*(m-1)+2 term 64 th term 128 th term 64*m term How to sort terms? search and shift operations too slow need an intermediate and adjustable storage : BURST TRIE Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

11 Multiplication for flat vector 2/2 Burst tries trie node = dense container leaf node = sparse container 3 + 5z + 7z y + 9zy + 13zyx + 8z 2 x 2 + 9x 4 Burst trie Coe!cients Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

12 Homogeneous block A = da max δ=da min BH δ (a), B = db max δ=db min BH δ (b) a i X d 1 1 Xd Xd n n b j X d 1 1 Xd Xd n n = a i b j X d 1+d 1 1 X d 2+d X d n+d n n with C = A B = dc max δ=dc min BH δ (c) dc min = da min + db min dc max = da max + db max BH δ (c) = BH i (a) BH j (b) i+j=δ Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

13 Homogeneous block Function fmafull(bh δ (a), BH δ (b), BH δ+δ (c)) Compute the full fused multiplication-addition BH δ+δ (c) = BH δ+δ (c) + BH δ (a) BH δ (b) Input: BH δ (a) : homogeneous blocks { degree δ, a : array of r coeff. } Input: BH δ (b) : homogeneous blocks { degree δ, b : array of s coeff. } Input: BH δ+δ (c) : homog. blocks { degree δ + δ, c : array of t coeff. } Output: BH δ+δ (c) : homog. blocks { degree δ + δ, c : array of t coeff.} for i 1 to r do for j 1 to s do l get location of the term in BH δ+δ (c) BH δ+δ (c)[l] BH δ+δ (c)[l] + BH δ (a)[i] BH δ (b)[j] Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

14 Homogeneous block using functions Function fmafull(bh δ (a), BH δ (b), BH δ+δ (c)) Compute the full fused multiplication-addition BH δ+δ (c) = BH δ+δ (c) + BH δ (a) BH δ (b) using functions to compute location Input: BH δ (a) : homogeneous blocks { degree δ, a : array of r coeff. } Input: BH δ (b) : homogeneous blocks { degree δ, b : array of s coeff.s } Input: BH δ+δ (c) : homog. blocks { degree δ + δ, c : array of t coeff. } Output: BH δ+δ (c) : homog. blocks { degree δ + δ, c : array of t coeff.} for i 1 to r do expoa get array of exponents from the location i in BH δ for j 1 to s do expob get array of exponents from the location j in BH δ expoc expoa + expob l get location of the term with exponents expoc in BH δ+δ BH δ+δ (c)[l] BH δ+δ (c)[l] + BH δ (a)[i] BH δ (b)[j] Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

15 Homogeneous block using addressing tables Construction of the addressing table for the product of blocks in 3 variables with exponent tables of degree 1 and 2. T addr 2,1 = t T addr 1,2 T exp 1 + T exp 2 = T exp T addr 1, Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

16 Execution time to build the tables of exponents build the tables of exponents for homogeneous blocks in 1 variables up to the degree time (s) number of terms (in Millions) Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

17 Execution time to build the addressing tables product of two homogeneous blocks in 5 variables up to the total degree 4 1 initialization after initialization time (s) muliplication operations (in Millions) Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

18 Overhead to load the addressing tables from disk 3 25 execution time overhead (%) total degree of the addressing table Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

19 Homogeneous blocks BH(X,Y,Z) BH BH 1 BH 2 BH 3 BH P (x, y, z) = 3 + 5z + 7z y + 9yz + 13xyz + 8x 2 z 2 + 9x 4 Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

20 Compacted homogeneous blocks BHC BHC(X,Y,Z) BHC 1 BHC 2 BHC 3 BHC Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

21 Homogeneous block using addressing tables Function fmafull(bh δ (a), BH δ (b), T addr δ,δ, BH δ+δ (c)) Compute the full fused multiplication-addition BH δ+δ (c) = BH δ+δ (c) + BH δ (a) BH δ (b) using the addressing table Input: BH δ (a) : homogeneous blocks { degree δ, a : array of r coeff. } Input: BH δ (b) : homogeneous blocks { degree δ, b : array of s coeff. } Input: BH δ+δ (c) : homog. blocks { degree δ + δ, c : array of t coeff. } Input: T addr δ,δ : addressing table of degree δ, δ Output: BH δ+δ (c) : homog. blocks { degree δ + δ, c : array of t coefficients } for i 1 to r do for j 1 to s do l T addr δ,δ [i, j] BH δ+δ (c)[l] BH δ+δ (c)[l] + BH δ (a)[i] BH δ (b)[j] Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

22 Homogeneous block using addressing tables Function fmafull(bh δ (a), BH δ (b), T addr δ,δ, BH δ+δ (c)) Compute the full fused multiplication-addition BH δ+δ (c) = BH δ+δ (c) + BH δ (a) BH δ (b) using the addressing table Input: BH δ (a) : homogeneous blocks { degree δ, a : array of r coeff. } Input: BH δ (b) : homogeneous blocks { degree δ, b : array of s coeff. } Input: BH δ+δ (c) : homog. blocks { degree δ + δ, c : array of t coeff. } Input: T addr δ,δ : addressing table of degree δ, δ Output: BH δ+δ (c) : homog. blocks { degree δ + δ, c : array of t coefficients } for i 1 to r do for j 1 to s do ll T addr δ,δ δ,δ [BHC [i, j] δ (a).index[i], BHC δ (b).index[j]] BH δ+δ (c)[l] BH δ+δ (c)[l] + BH δ (a)[i] BH δ (b)[j] Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

23 Homogeneous block using addressing tables Function fmafull(bh δ (a), BH δ (b), T addr δ,δ, BH δ+δ (c)) Compute the full fused multiplication-addition BH δ+δ (c) = BH δ+δ (c) + BH δ (a) BH δ (b) using the addressing table Input: BH δ (a) : homogeneous blocks { degree δ, a : array of r coeff. } Input: BH δ (b) : homogeneous blocks { degree δ, b : array of s coeff. } Input: BH δ+δ (c) : homog. blocks { degree δ + δ, c : array of t coeff. } Input: T addr δ,δ : addressing table of degree δ, δ Output: BH δ+δ (c) : homog. blocks { degree δ + δ, c : array of t coefficients } for i 1 to r do for j 1 to s do l T addr δ,δ [i, j] BH δ+δ (c)[l] BH δ+δ (c)[l] + BH δ (a)[i] BH δ (b)[j] Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

24 Cache blocking technique BH! (a) BH! (a) BH! (b) BH! (b) normal flow flow with cache blocking Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

25 Cache blocking technique Input: BH δ (a) : homogeneous blocks { degree δ, a : array of r coeff. } Input: BH δ (b) : homogeneous blocks { degree δ, b : array of s coeff. } Input: T addr δ,δ : addressing table of degree δ, δ Input: BH δ+δ (c) : homog. blocks { degree δ + δ, c : array of t coeff. } Input: chunksize : chunk size { arrays of two integers} Output: BH δ+δ (c) : homog. blocks { degree δ + δ, c : array of t coeff.} iteri r/chunksize[1] /* number of chunks for the loop i */ iterj s/chunksize[2] /* number of chunks for the loop j */ for ci to iteri 1 do for cj to iterj 1 do for bi 1 to chunksize[1] do for bj 1 to chunksize[2] do i ci iteri + bi j cj iterj + bj l T addr δ,δ [i, j] BH δ+δ (c)[l] BH δ+δ (c)[l] + BH δ (a)[i] BH δ (b)[j] /* if s not divisible by chunksize[2] */ for bi 1 to chunksize[1] do for j iterj chunksize[2] to s do i ci iteri + bi l T addr δ,δ [i, j] BH δ+δ (c)[l] BH δ+δ (c)[l] + BH δ (a)[i] BH δ (b)[j] Function fmafull(bh δ (a), BH δ (b), T addr δ,δ, chunksize, BH δ+δ (c)) Compute the full fused multiplication-addition using the addressing table and cache blocking technique /* if r not divisible by chunksize[1] */ for i iteri chunksize[1] to r do for j 1 to s do l T addr δ,δ [i, j]; BH δ+δ (c)[l] BH δ+δ (c)[l] + BH δ (a)[i] BH δ (b)[j] Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

26 Benchmark of the cache blocking technique 1 Factor of the reduction of the execution time for the product of two homogeneous blocks in 8 variables of degree 7 G5 processor Core2 duo processor Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

27 Benchmark of the cache blocking technique 1 Factor of the reduction of the execution time of the product of two homogeneous blocks in 8 variables of degree 9 double precision quadruple precision Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

28 Benchmarks s (s + 1) with s = (1 + x + y + z + t + u) 14 CAS representation time (s) Ginac tree 4137 Maple 1 DAG Singular 3..2 list Maxima recursive list Mathematica 5.2 tree TRIP.99 recursive vector 13.5 TRIP.99 recursive list TRIP.99 flat vector 28.1 TRIP.99 homogeneous blocks (with initialization) 5.44 (after initialization).57 Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

29 Effect of the sparsity of the polynomials s s with s containing some terms of (1 + x 1 + x 2 + x 3 + x 4 + x 5 ) recursive list recursive vector flat vector homogeneous block compacted homogeneous block.6.5 time (s) number of terms Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

30 full product VxV with different representations The serie V has 352 terms and the result has terms V (λ, λ, X, X, Y, Y, X, X, Y, Y ) = X d 1 X d 2 Y d 3 Y d 4 X d 5 X d 6 Y d 7 Y d 8 e ı(k 1λ+k 2 λ ) d 1 + d 2 + d 3 + d 4 + d 5 + d 6 + d 7 + d 8 = 7 CAS representation time (s) Maple 1 DAG Mathematica 5.2 tree TRIP.99 recursive vector 2.91 TRIP.99 recursive list 2.32 TRIP.99 flat vector 1.97 TRIP.99 homogeneous blocks (with initialization) (after initialization) TRIP.99 compacted homogeneous blocks (with initialization) 17.7 (after initialization) TRIP.99 d alembert blocks (with initialization) (after initialization) 8.55 TRIP.99 compacted d alembert blocks (with initialization) 11.1 (after initialization) 1.25 Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

31 full product VxV for different degrees 3 25 recursive vector recursive list flat vector BH BHC BHDAL BHDALC 2 time (s) degree Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

32 Karatsuba's algorithm Idea : one multiplication could be avoided for polynomial of degree 1 Let A and B polynomials A(X) = a + a 1 X and B(X) = b + b 1 X The naive multiplication C = AB is C(X) = a b + (a b 1 + a 1 b )X 1 + a 1 b 1 X 2 But the coefficient of X 1 could be written as a b 1 + a 1 b = (a + a 1 )(b + b 1 ) a b a 1 b 1 we need to perform 3 multiplications and 4 additions instead of 4 multiplications and 1 addition. could be applied recursively to polynomials of degree 2 k -1 complexity O(n 1.59 ) Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

33 Karatsuba's algorithm Algorithm 11: Compute the full product of two polynomials A and B using the Karatsuba s multiplication algorithm Input: A : polynomial of degree at most n 1 with n = 2 k for k N Input: B : polynomial of degree at most n 1 Output: C : polynomial if n = 1 then return C AB C 1 A () B () by a recursive call C 2 A (1) B (1) by a recursive call C 3 A () + A (1) C 4 B () + B (1) C 5 C 3 C 4 by a recursive call C 6 C 5 C 1 C 2 C C 1 + C 6 X n/2 + C 2 X n return C Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

34 Univariate polynomials Truncated product (a + a 1 X a n X n + O(X n )) (b + b 1 X b n X n + O(X n )) = (c + c 1 X c n X n + O(X n )) Multivariate polynomials keep the term a i X d 1 1 Xd Xd n n bj X d 1 1 Xd Xd n n if d 1 + d 1 + d 2 + d d n + d n T if truncation is performed only on some variables, truncated variables must be ordered Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

35 Truncated product on polynomials stored as recursive list Function fmatruncated(a,b,c, T ) Compute the truncated fused multiplication-addition C = C + A B with A, B and C multivariate polynomials represented as recursive list Input: A: polynomial { list of ( coefficients a, degree δ a ) } Input: B: polynomial { list of ( coefficients b, degree δ b ) } Input: C: polynomial { list of ( coefficients c, degree δ c )} Input: T : degree of the truncation Output: C: polynomial { list of ( coefficients c, degree δ c )} if variable of A is truncated then iter head of C foreach element in A such that δ a T do /* avoid to scan to C when the loop on B is finished */ iterb iter foreach element in B such that δ a + δ b T do /* find after iterb in C if the degree δ a + δ b is present */ while current degree δ c referenced by iterb < δ a + δ b do iterb next element after iterb if δ c = δ a + δ b then fmatruncated (a, b, c, T δ a + δ b ) if c = then remove the element referenced by iterb else insert an element (multruncated (a, b, T δ a + δ b ), δ a + δ b ) just before iterb if current element is the first element of B then iter iterb else fmafull (A,B,C) Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

36 Truncated product on homogeneous blocks Let A = BH δ (a), B = BH δ (b) Truncated product on the total degree C = A B = T BH δ (c) with BH δ (c) = δ= δ BH n (a) BH δ n (b) n= use the full product of 2 homogeneous blocks use less addressing tables than for the full product Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

37 Truncated product - benchmarks 6 5 recursive vector recursive list flat vector BH BHC BHDAL BHDALC degree Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

38 Special truncated product in degree Perform the product of two Poisson series but we only want to keep terms which have specific values for k1 and k2 e.g., S 1 S 2 = S, we want only terms such that and S = a i X d 1 1 Xd Xd n n exp ı(k 1λ+k 2 λ ) k 1 = k 2 = very easy for the recursive representation if the series are correctly ordered. Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

39 Special truncated product on magnitude is kept if a i X d 1 1 Xd Xd n n b j X d 1 1 Xd Xd n n a i b j ɛ brut-force method Algorithm 1: Compute the truncated product of the series A and B in the amplitude of their coefficients Input: A: serie a i x i ordered by decreasing amplitude Input: B: serie b i x i ordered by decreasing amplitude Input: ɛ : thresold > Output: C: series C = AB with all coefficients greater than ɛ C create an empty polynomial foreach coefficient a i such that a i b ɛ do foreach coefficient b j such that b j ɛ / a i do C C + a i b j x i+j return C order the series on the magnitude of the coefficient? Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

40 Special truncated product on magnitude Let a variable ɛ, and a small parameter ɛ such that ɛ p = ɛ with p N. Each coefficient a i of the serie A(x) could be written as a i = a ix i ɛ k with k = log a i log ɛ and a i = a i ɛ k A (ɛ, x) = k ( j a jx j )ɛ k A(x) = A (ɛ, x) The truncated product A(x) B(x) on the amplitude of the coefficient is transformed to a truncated product A (ɛ, x) B (ɛ, x) on the variable ɛ. The degree of truncation is p. Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

41 Special truncated product in amplitude source code s1 =(1+.5 x ) ˆ 3 ; s2 =(1+.4 x ) ˆ 4 ; / i n t r o d u c e the v a r i a b l e eps in s1 and s2 / s1e=s e r e p s ( s1, eps,. 1 ) ; s2e=s e r e p s ( s2, eps,. 1 ) ; / d e f i n e the t r uncature on amplitude to (. 1 ) ˆ 2 / t r =({eps, 2 } ) ; usetronc ( t r ) ; / perform the product / s3e=s1e s2e ; / remove the v a r i a b l e eps from s3e / s3=i n v s e r e p s ( s3e, eps,. 1 ) ; Execution of the previous source code by trip s1(x) = *x +.75*x** *x**3 s2(x) = *x +.96*x** *x** E-6*x**4 s1e(x,eps) = *x +.75*x**2*eps** *x**3*eps**3 s2e(x,eps) = *x +.96*x**2*eps** *x**3*eps** *x**4*eps**5 tr = ( { eps, 2 } ) s3e(x,eps) = *x +.24*x** *x**2*eps** *x**3*eps**2 s3(x) = *x +.411*x** *x**3 Table 4.6: Source code and execution by TRIP of the truncated product of two series Advanced School on Specific Algebraic Manipulators, 27, M. Gastineau, ASD/IMCCE/CNRS

Sparse Polynomial Multiplication and Division in Maple 14

Sparse Polynomial Multiplication and Division in Maple 14 Sparse Polynomial Multiplication and Division in Maple 4 Michael Monagan and Roman Pearce Department of Mathematics, Simon Fraser University Burnaby B.C. V5A S6, Canada October 5, 9 Abstract We report

More information

Polynomial multiplication and division using heap.

Polynomial multiplication and division using heap. Polynomial multiplication and division using heap. Michael Monagan and Roman Pearce Department of Mathematics, Simon Fraser University. Abstract We report on new code for sparse multivariate polynomial

More information

x 9 or x > 10 Name: Class: Date: 1 How many natural numbers are between 1.5 and 4.5 on the number line?

x 9 or x > 10 Name: Class: Date: 1 How many natural numbers are between 1.5 and 4.5 on the number line? 1 How many natural numbers are between 1.5 and 4.5 on the number line? 2 How many composite numbers are between 7 and 13 on the number line? 3 How many prime numbers are between 7 and 20 on the number

More information

Between Sparse and Dense Arithmetic

Between Sparse and Dense Arithmetic Between Sparse and Dense Arithmetic Daniel S. Roche Computer Science Department United States Naval Academy NARC Seminar November 28, 2012 The Problem People want to compute with really big numbers and

More information

Consider the following example of a linear system:

Consider the following example of a linear system: LINEAR SYSTEMS Consider the following example of a linear system: Its unique solution is x + 2x 2 + 3x 3 = 5 x + x 3 = 3 3x + x 2 + 3x 3 = 3 x =, x 2 = 0, x 3 = 2 In general we want to solve n equations

More information

Sparse Polynomial Division Using a Heap

Sparse Polynomial Division Using a Heap Sparse Polynomial Division Using a Heap Michael Monagan Department of Mathematics, Simon Fraser University Burnaby B.C. V5A 1S6, Canada Roman Pearce Department of Mathematics, Simon Fraser University Burnaby

More information

Lecture 7: Dynamic Programming I: Optimal BSTs

Lecture 7: Dynamic Programming I: Optimal BSTs 5-750: Graduate Algorithms February, 06 Lecture 7: Dynamic Programming I: Optimal BSTs Lecturer: David Witmer Scribes: Ellango Jothimurugesan, Ziqiang Feng Overview The basic idea of dynamic programming

More information

COMP 633: Parallel Computing Fall 2018 Written Assignment 1: Sample Solutions

COMP 633: Parallel Computing Fall 2018 Written Assignment 1: Sample Solutions COMP 633: Parallel Computing Fall 2018 Written Assignment 1: Sample Solutions September 12, 2018 I. The Work-Time W-T presentation of EREW sequence reduction Algorithm 2 in the PRAM handout has work complexity

More information

Algorithms and Their Complexity

Algorithms and Their Complexity CSCE 222 Discrete Structures for Computing David Kebo Houngninou Algorithms and Their Complexity Chapter 3 Algorithm An algorithm is a finite sequence of steps that solves a problem. Computational complexity

More information

Saturday, April 23, Dependence Analysis

Saturday, April 23, Dependence Analysis Dependence Analysis Motivating question Can the loops on the right be run in parallel? i.e., can different processors run different iterations in parallel? What needs to be true for a loop to be parallelizable?

More information

1 Quick Sort LECTURE 7. OHSU/OGI (Winter 2009) ANALYSIS AND DESIGN OF ALGORITHMS

1 Quick Sort LECTURE 7. OHSU/OGI (Winter 2009) ANALYSIS AND DESIGN OF ALGORITHMS OHSU/OGI (Winter 2009) CS532 ANALYSIS AND DESIGN OF ALGORITHMS LECTURE 7 1 Quick Sort QuickSort 1 is a classic example of divide and conquer. The hard work is to rearrange the elements of the array A[1..n]

More information

Dense Arithmetic over Finite Fields with CUMODP

Dense Arithmetic over Finite Fields with CUMODP Dense Arithmetic over Finite Fields with CUMODP Sardar Anisul Haque 1 Xin Li 2 Farnam Mansouri 1 Marc Moreno Maza 1 Wei Pan 3 Ning Xie 1 1 University of Western Ontario, Canada 2 Universidad Carlos III,

More information

BLAS: Basic Linear Algebra Subroutines Analysis of the Matrix-Vector-Product Analysis of Matrix-Matrix Product

BLAS: Basic Linear Algebra Subroutines Analysis of the Matrix-Vector-Product Analysis of Matrix-Matrix Product Level-1 BLAS: SAXPY BLAS-Notation: S single precision (D for double, C for complex) A α scalar X vector P plus operation Y vector SAXPY: y = αx + y Vectorization of SAXPY (αx + y) by pipelining: page 8

More information

Randomized Sorting Algorithms Quick sort can be converted to a randomized algorithm by picking the pivot element randomly. In this case we can show th

Randomized Sorting Algorithms Quick sort can be converted to a randomized algorithm by picking the pivot element randomly. In this case we can show th CSE 3500 Algorithms and Complexity Fall 2016 Lecture 10: September 29, 2016 Quick sort: Average Run Time In the last lecture we started analyzing the expected run time of quick sort. Let X = k 1, k 2,...,

More information

Divide and Conquer: Polynomial Multiplication Version of October 1 / 7, 24201

Divide and Conquer: Polynomial Multiplication Version of October 1 / 7, 24201 Divide and Conquer: Polynomial Multiplication Version of October 7, 2014 Divide and Conquer: Polynomial Multiplication Version of October 1 / 7, 24201 Outline Outline: Introduction The polynomial multiplication

More information

Enumerate all possible assignments and take the An algorithm is a well-defined computational

Enumerate all possible assignments and take the An algorithm is a well-defined computational EMIS 8374 [Algorithm Design and Analysis] 1 EMIS 8374 [Algorithm Design and Analysis] 2 Designing and Evaluating Algorithms A (Bad) Algorithm for the Assignment Problem Enumerate all possible assignments

More information

In-place Arithmetic for Univariate Polynomials over an Algebraic Number Field

In-place Arithmetic for Univariate Polynomials over an Algebraic Number Field In-place Arithmetic for Univariate Polynomials over an Algebraic Number Field Seyed Mohammad Mahdi Javadi 1, Michael Monagan 2 1 School of Computing Science, Simon Fraser University, Burnaby, B.C., V5A

More information

Chapter 2. Divide-and-conquer. 2.1 Strassen s algorithm

Chapter 2. Divide-and-conquer. 2.1 Strassen s algorithm Chapter 2 Divide-and-conquer This chapter revisits the divide-and-conquer paradigms and explains how to solve recurrences, in particular, with the use of the master theorem. We first illustrate the concept

More information

New Arithmetic Algorithms for Hereditarily Binary Natural Numbers

New Arithmetic Algorithms for Hereditarily Binary Natural Numbers New Arithmetic Algorithms for Hereditarily Binary Natural Numbers Paul Tarau Department of Computer Science and Engineering University of North Texas SYNASC 2014 research supported by NSF grant 1423324

More information

Divide and Conquer Strategy

Divide and Conquer Strategy Divide and Conquer Strategy Algorithm design is more an art, less so a science. There are a few useful strategies, but no guarantee to succeed. We will discuss: Divide and Conquer, Greedy, Dynamic Programming.

More information

Linear Algebra and Eigenproblems

Linear Algebra and Eigenproblems Appendix A A Linear Algebra and Eigenproblems A working knowledge of linear algebra is key to understanding many of the issues raised in this work. In particular, many of the discussions of the details

More information

Lecture 6 September 21, 2016

Lecture 6 September 21, 2016 ICS 643: Advanced Parallel Algorithms Fall 2016 Lecture 6 September 21, 2016 Prof. Nodari Sitchinava Scribe: Tiffany Eulalio 1 Overview In the last lecture, we wrote a non-recursive summation program and

More information

Sparse Polynomial Division Using a Heap

Sparse Polynomial Division Using a Heap Sparse Polynomial Division Using a Heap Michael Monagan Department of Mathematics, Simon Fraser University Burnaby B.C. V5A 1S6, Canada Roman Pearce Department of Mathematics, Simon Fraser University Burnaby

More information

Integer Multiplication

Integer Multiplication Integer Multiplication in almost linear time Martin Fürer CSE 588 Department of Computer Science and Engineering Pennsylvania State University 1/24/08 Karatsuba algebraic Split each of the two factors

More information

Algebraic Expressions

Algebraic Expressions Algebraic Expressions 1. Expressions are formed from variables and constants. 2. Terms are added to form expressions. Terms themselves are formed as product of factors. 3. Expressions that contain exactly

More information

Appendix C Vector and matrix algebra

Appendix C Vector and matrix algebra Appendix C Vector and matrix algebra Concepts Scalars Vectors, rows and columns, matrices Adding and subtracting vectors and matrices Multiplying them by scalars Products of vectors and matrices, scalar

More information

Problem. Problem Given a dictionary and a word. Which page (if any) contains the given word? 3 / 26

Problem. Problem Given a dictionary and a word. Which page (if any) contains the given word? 3 / 26 Binary Search Introduction Problem Problem Given a dictionary and a word. Which page (if any) contains the given word? 3 / 26 Strategy 1: Random Search Randomly select a page until the page containing

More information

Divide and Conquer algorithms

Divide and Conquer algorithms Divide and Conquer algorithms Another general method for constructing algorithms is given by the Divide and Conquer strategy. We assume that we have a problem with input that can be split into parts in

More information

Computing the Monodromy Group of a Plane Algebraic Curve Using a New Numerical-modular Newton-Puiseux Algorithm

Computing the Monodromy Group of a Plane Algebraic Curve Using a New Numerical-modular Newton-Puiseux Algorithm Computing the Monodromy Group of a Plane Algebraic Curve Using a New Numerical-modular Newton-Puiseux Algorithm Poteaux Adrien XLIM-DMI UMR CNRS 6172 Université de Limoges, France SNC'07 University of

More information

Towards High Performance Multivariate Factorization. Michael Monagan. This is joint work with Baris Tuncer.

Towards High Performance Multivariate Factorization. Michael Monagan. This is joint work with Baris Tuncer. Towards High Performance Multivariate Factorization Michael Monagan Center for Experimental and Constructive Mathematics Simon Fraser University British Columbia This is joint work with Baris Tuncer. The

More information

Computational Complexity. This lecture. Notes. Lecture 02 - Basic Complexity Analysis. Tom Kelsey & Susmit Sarkar. Notes

Computational Complexity. This lecture. Notes. Lecture 02 - Basic Complexity Analysis. Tom Kelsey & Susmit Sarkar. Notes Computational Complexity Lecture 02 - Basic Complexity Analysis Tom Kelsey & Susmit Sarkar School of Computer Science University of St Andrews http://www.cs.st-andrews.ac.uk/~tom/ twk@st-andrews.ac.uk

More information

Introduction, basic but important concepts

Introduction, basic but important concepts Introduction, basic but important concepts Felix Kubler 1 1 DBF, University of Zurich and Swiss Finance Institute October 7, 2017 Felix Kubler Comp.Econ. Gerzensee, Ch1 October 7, 2017 1 / 31 Economics

More information

CSE 4502/5717 Big Data Analytics Spring 2018; Homework 1 Solutions

CSE 4502/5717 Big Data Analytics Spring 2018; Homework 1 Solutions CSE 502/5717 Big Data Analytics Spring 2018; Homework 1 Solutions 1. Consider the following algorithm: for i := 1 to α n log e n do Pick a random j [1, n]; If a[j] = a[j + 1] or a[j] = a[j 1] then output:

More information

Sorting Algorithms. We have already seen: Selection-sort Insertion-sort Heap-sort. We will see: Bubble-sort Merge-sort Quick-sort

Sorting Algorithms. We have already seen: Selection-sort Insertion-sort Heap-sort. We will see: Bubble-sort Merge-sort Quick-sort Sorting Algorithms We have already seen: Selection-sort Insertion-sort Heap-sort We will see: Bubble-sort Merge-sort Quick-sort We will show that: O(n log n) is optimal for comparison based sorting. Bubble-Sort

More information

shelat 16f-4800 sep Matrix Mult, Median, FFT

shelat 16f-4800 sep Matrix Mult, Median, FFT L5 shelat 16f-4800 sep 23 2016 Matrix Mult, Median, FFT merge-sort (A, p, r) if p

More information

Activity selection. Goal: Select the largest possible set of nonoverlapping (mutually compatible) activities.

Activity selection. Goal: Select the largest possible set of nonoverlapping (mutually compatible) activities. Greedy Algorithm 1 Introduction Similar to dynamic programming. Used for optimization problems. Not always yield an optimal solution. Make choice for the one looks best right now. Make a locally optimal

More information

Fundamental Algorithms

Fundamental Algorithms Chapter 2: Sorting, Winter 2018/19 1 Fundamental Algorithms Chapter 2: Sorting Jan Křetínský Winter 2018/19 Chapter 2: Sorting, Winter 2018/19 2 Part I Simple Sorts Chapter 2: Sorting, Winter 2018/19 3

More information

Fundamental Algorithms

Fundamental Algorithms Fundamental Algorithms Chapter 2: Sorting Harald Räcke Winter 2015/16 Chapter 2: Sorting, Winter 2015/16 1 Part I Simple Sorts Chapter 2: Sorting, Winter 2015/16 2 The Sorting Problem Definition Sorting

More information

Digital Trees and Memoryless Sources: from Arithmetics to Analysis

Digital Trees and Memoryless Sources: from Arithmetics to Analysis Digital Trees and Memoryless Sources: from Arithmetics to Analysis Philippe Flajolet, Mathieu Roux, Brigitte Vallée AofA 2010, Wien 1 What is a digital tree, aka TRIE? = a data structure for dynamic dictionaries

More information

Fast Polynomial Multiplication

Fast Polynomial Multiplication Fast Polynomial Multiplication Marc Moreno Maza CS 9652, October 4, 2017 Plan Primitive roots of unity The discrete Fourier transform Convolution of polynomials The fast Fourier transform Fast convolution

More information

Lesson 7: Algebraic Expressions The Commutative and Associative Properties

Lesson 7: Algebraic Expressions The Commutative and Associative Properties : Algebraic Expressions The Commutative and Associative Properties Four Properties of Arithmetic: The Commutative Property of Addition: If a and b are real numbers, then a + b = b + a. The Associative

More information

Fast Polynomial Reduction. Nikolay Vassiliev Steklov Inst. оf Math. St.Petersburg

Fast Polynomial Reduction. Nikolay Vassiliev Steklov Inst. оf Math. St.Petersburg Fast Polynomial Reduction Nikolay Vassiliev Steklov Inst. оf Math. St.Petersburg CADE2009, Papmlona, 2009 30 October Outline of the talk Gröbner bases and normal forms in commutative and differential algebra

More information

Computational Complexity - Pseudocode and Recursions

Computational Complexity - Pseudocode and Recursions Computational Complexity - Pseudocode and Recursions Nicholas Mainardi 1 Dipartimento di Elettronica e Informazione Politecnico di Milano nicholas.mainardi@polimi.it June 6, 2018 1 Partly Based on Alessandro

More information

A matrix over a field F is a rectangular array of elements from F. The symbol

A matrix over a field F is a rectangular array of elements from F. The symbol Chapter MATRICES Matrix arithmetic A matrix over a field F is a rectangular array of elements from F The symbol M m n (F ) denotes the collection of all m n matrices over F Matrices will usually be denoted

More information

ON THE CONTINUED FRACTION EXPANSION OF THE UNIQUE ROOT IN F(p) OF THE EQUATION x 4 + x 2 T x 1/12 = 0 AND OTHER RELATED HYPERQUADRATIC EXPANSIONS

ON THE CONTINUED FRACTION EXPANSION OF THE UNIQUE ROOT IN F(p) OF THE EQUATION x 4 + x 2 T x 1/12 = 0 AND OTHER RELATED HYPERQUADRATIC EXPANSIONS ON THE CONTINUED FRACTION EXPANSION OF THE UNIQUE ROOT IN F(p) OF THE EQUATION x 4 + x 2 T x 1/12 = 0 AND OTHER RELATED HYPERQUADRATIC EXPANSIONS by A. Lasjaunias Abstract.In 1986, Mills and Robbins observed

More information

Weighted Activity Selection

Weighted Activity Selection Weighted Activity Selection Problem This problem is a generalization of the activity selection problem that we solvd with a greedy algorithm. Given a set of activities A = {[l, r ], [l, r ],..., [l n,

More information

1 Matrices and Systems of Linear Equations

1 Matrices and Systems of Linear Equations March 3, 203 6-6. Systems of Linear Equations Matrices and Systems of Linear Equations An m n matrix is an array A = a ij of the form a a n a 2 a 2n... a m a mn where each a ij is a real or complex number.

More information

COMP 182 Algorithmic Thinking. Algorithm Efficiency. Luay Nakhleh Computer Science Rice University

COMP 182 Algorithmic Thinking. Algorithm Efficiency. Luay Nakhleh Computer Science Rice University COMP 182 Algorithmic Thinking Algorithm Efficiency Luay Nakhleh Computer Science Rice University Chapter 3, Sections 2-3 Reading Material Not All Correct Algorithms Are Created Equal We often choose the

More information

Introduction to Algorithms 6.046J/18.401J/SMA5503

Introduction to Algorithms 6.046J/18.401J/SMA5503 Introduction to Algorithms 6.046J/8.40J/SMA5503 Lecture 3 Prof. Piotr Indyk The divide-and-conquer design paradigm. Divide the problem (instance) into subproblems. 2. Conquer the subproblems by solving

More information

Divisible Load Scheduling

Divisible Load Scheduling Divisible Load Scheduling Henri Casanova 1,2 1 Associate Professor Department of Information and Computer Science University of Hawai i at Manoa, U.S.A. 2 Visiting Associate Professor National Institute

More information

Towards abstract and executable multivariate polynomials in Isabelle

Towards abstract and executable multivariate polynomials in Isabelle Towards abstract and executable multivariate polynomials in Isabelle Florian Haftmann Andreas Lochbihler Wolfgang Schreiner Institute for Informatics Institute of Information Security RISC TU Munich ETH

More information

Introduction to Data Mining

Introduction to Data Mining Introduction to Data Mining Lecture #12: Frequent Itemsets Seoul National University 1 In This Lecture Motivation of association rule mining Important concepts of association rules Naïve approaches for

More information

ALGEBRA I FORM I. Textbook: Algebra, Second Edition;Prentice Hall,2002

ALGEBRA I FORM I. Textbook: Algebra, Second Edition;Prentice Hall,2002 ALGEBRA I FORM I Textbook: Algebra, Second Edition;Prentice Hall,00 Prerequisites: Students are expected to have a knowledge of Pre Algebra and proficiency of basic math skills including: positive and

More information

Computer Science & Engineering 423/823 Design and Analysis of Algorithms

Computer Science & Engineering 423/823 Design and Analysis of Algorithms Computer Science & Engineering 423/823 Design and Analysis of s Lecture 09 Dynamic Programming (Chapter 15) Stephen Scott (Adapted from Vinodchandran N. Variyam) 1 / 41 Spring 2010 Dynamic programming

More information

Exact Arithmetic on a Computer

Exact Arithmetic on a Computer Exact Arithmetic on a Computer Symbolic Computation and Computer Algebra William J. Turner Department of Mathematics & Computer Science Wabash College Crawfordsville, IN 47933 Tuesday 21 September 2010

More information

Algorithms. Jordi Planes. Escola Politècnica Superior Universitat de Lleida

Algorithms. Jordi Planes. Escola Politècnica Superior Universitat de Lleida Algorithms Jordi Planes Escola Politècnica Superior Universitat de Lleida 2016 Syllabus What s been done Formal specification Computational Cost Transformation recursion iteration Divide and conquer Sorting

More information

CSE548, AMS542: Analysis of Algorithms, Spring 2014 Date: May 12. Final In-Class Exam. ( 2:35 PM 3:50 PM : 75 Minutes )

CSE548, AMS542: Analysis of Algorithms, Spring 2014 Date: May 12. Final In-Class Exam. ( 2:35 PM 3:50 PM : 75 Minutes ) CSE548, AMS54: Analysis of Algorithms, Spring 014 Date: May 1 Final In-Class Exam ( :35 PM 3:50 PM : 75 Minutes ) This exam will account for either 15% or 30% of your overall grade depending on your relative

More information

Computer Science & Engineering 423/823 Design and Analysis of Algorithms

Computer Science & Engineering 423/823 Design and Analysis of Algorithms Computer Science & Engineering 423/823 Design and Analysis of Algorithms Lecture 03 Dynamic Programming (Chapter 15) Stephen Scott and Vinodchandran N. Variyam sscott@cse.unl.edu 1/44 Introduction Dynamic

More information

A first order divided difference

A first order divided difference A first order divided difference For a given function f (x) and two distinct points x 0 and x 1, define f [x 0, x 1 ] = f (x 1) f (x 0 ) x 1 x 0 This is called the first order divided difference of f (x).

More information

Parallel Integer Polynomial Multiplication Changbo Chen, Svyatoslav Parallel Integer Covanov, Polynomial FarnamMultiplication

Parallel Integer Polynomial Multiplication Changbo Chen, Svyatoslav Parallel Integer Covanov, Polynomial FarnamMultiplication Parallel Integer Polynomial Multiplication Parallel Integer Polynomial Multiplication Changbo Chen 1 Svyatoslav Covanov 2,3 Farnam Mansouri 2 Marc Moreno Maza 2 Ning Xie 2 Yuzhen Xie 2 1 Chinese Academy

More information

Advanced Analysis of Algorithms - Midterm (Solutions)

Advanced Analysis of Algorithms - Midterm (Solutions) Advanced Analysis of Algorithms - Midterm (Solutions) K. Subramani LCSEE, West Virginia University, Morgantown, WV {ksmani@csee.wvu.edu} 1 Problems 1. Solve the following recurrence using substitution:

More information

Permutations and Polynomials Sarah Kitchen February 7, 2006

Permutations and Polynomials Sarah Kitchen February 7, 2006 Permutations and Polynomials Sarah Kitchen February 7, 2006 Suppose you are given the equations x + y + z = a and 1 x + 1 y + 1 z = 1 a, and are asked to prove that one of x,y, and z is equal to a. We

More information

Math 671: Tensor Train decomposition methods

Math 671: Tensor Train decomposition methods Math 671: Eduardo Corona 1 1 University of Michigan at Ann Arbor December 8, 2016 Table of Contents 1 Preliminaries and goal 2 Unfolding matrices for tensorized arrays The Tensor Train decomposition 3

More information

ELEMENTARY LINEAR ALGEBRA

ELEMENTARY LINEAR ALGEBRA ELEMENTARY LINEAR ALGEBRA K R MATTHEWS DEPARTMENT OF MATHEMATICS UNIVERSITY OF QUEENSLAND First Printing, 99 Chapter LINEAR EQUATIONS Introduction to linear equations A linear equation in n unknowns x,

More information

On the Complexity of Mapping Pipelined Filtering Services on Heterogeneous Platforms

On the Complexity of Mapping Pipelined Filtering Services on Heterogeneous Platforms On the Complexity of Mapping Pipelined Filtering Services on Heterogeneous Platforms Anne Benoit, Fanny Dufossé and Yves Robert LIP, École Normale Supérieure de Lyon, France {Anne.Benoit Fanny.Dufosse

More information

Fast Multipole Methods: Fundamentals & Applications. Ramani Duraiswami Nail A. Gumerov

Fast Multipole Methods: Fundamentals & Applications. Ramani Duraiswami Nail A. Gumerov Fast Multipole Methods: Fundamentals & Applications Ramani Duraiswami Nail A. Gumerov Week 1. Introduction. What are multipole methods and what is this course about. Problems from physics, mathematics,

More information

Course Notes for EE227C (Spring 2018): Convex Optimization and Approximation

Course Notes for EE227C (Spring 2018): Convex Optimization and Approximation Course Notes for EE7C (Spring 018): Convex Optimization and Approximation Instructor: Moritz Hardt Email: hardt+ee7c@berkeley.edu Graduate Instructor: Max Simchowitz Email: msimchow+ee7c@berkeley.edu October

More information

Chapter 1 Divide and Conquer Polynomial Multiplication Algorithm Theory WS 2015/16 Fabian Kuhn

Chapter 1 Divide and Conquer Polynomial Multiplication Algorithm Theory WS 2015/16 Fabian Kuhn Chapter 1 Divide and Conquer Polynomial Multiplication Algorithm Theory WS 2015/16 Fabian Kuhn Formulation of the D&C principle Divide-and-conquer method for solving a problem instance of size n: 1. Divide

More information

Local Parametrization and Puiseux Expansion

Local Parametrization and Puiseux Expansion Chapter 9 Local Parametrization and Puiseux Expansion Let us first give an example of what we want to do in this section. Example 9.0.1. Consider the plane algebraic curve C A (C) defined by the equation

More information

What s the best data structure for multivariate polynomials in a world of 64 bit multicore computers?

What s the best data structure for multivariate polynomials in a world of 64 bit multicore computers? What s the best data structure for multivariate polynomials in a world of 64 bit multicore computers? Michael Monagan Center for Experimental and Constructive Mathematics Simon Fraser University British

More information

Loop Parallelization Techniques and dependence analysis

Loop Parallelization Techniques and dependence analysis Loop Parallelization Techniques and dependence analysis Data-Dependence Analysis Dependence-Removing Techniques Parallelizing Transformations Performance-enchancing Techniques 1 When can we run code in

More information

CS483 Design and Analysis of Algorithms

CS483 Design and Analysis of Algorithms CS483 Design and Analysis of Algorithms Lecture 6-8 Divide and Conquer Algorithms Instructor: Fei Li lifei@cs.gmu.edu with subject: CS483 Office hours: STII, Room 443, Friday 4:00pm - 6:00pm or by appointments

More information

Chapter 1 Divide and Conquer Algorithm Theory WS 2016/17 Fabian Kuhn

Chapter 1 Divide and Conquer Algorithm Theory WS 2016/17 Fabian Kuhn Chapter 1 Divide and Conquer Algorithm Theory WS 2016/17 Fabian Kuhn Formulation of the D&C principle Divide-and-conquer method for solving a problem instance of size n: 1. Divide n c: Solve the problem

More information

Scientific Computing: An Introductory Survey

Scientific Computing: An Introductory Survey Scientific Computing: An Introductory Survey Chapter 12 Prof. Michael T. Heath Department of Computer Science University of Illinois at Urbana-Champaign Copyright c 2002. Reproduction permitted for noncommercial,

More information

How to Multiply. 5.5 Integer Multiplication. Complex Multiplication. Integer Arithmetic. Complex multiplication. (a + bi) (c + di) = x + yi.

How to Multiply. 5.5 Integer Multiplication. Complex Multiplication. Integer Arithmetic. Complex multiplication. (a + bi) (c + di) = x + yi. How to ultiply Slides by Kevin Wayne. Copyright 5 Pearson-Addison Wesley. All rights reserved. integers, matrices, and polynomials Complex ultiplication Complex multiplication. a + bi) c + di) = x + yi.

More information

INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR Design and Analysis of Algorithms Department of Mathematics MA21007/Assignment-2/Due: 18 Aug.

INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR Design and Analysis of Algorithms Department of Mathematics MA21007/Assignment-2/Due: 18 Aug. INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR Design and Analysis of Algorithms Department of Mathematics MA21007/Assignment-2/Due: 18 Aug. 2015 Problem 1. Computing Fibonacci Numbers The Fibonacci numbers

More information

Algorithmic Approach to Counting of Certain Types m-ary Partitions

Algorithmic Approach to Counting of Certain Types m-ary Partitions Algorithmic Approach to Counting of Certain Types m-ary Partitions Valentin P. Bakoev Abstract Partitions of integers of the type m n as a sum of powers of m (the so called m-ary partitions) and their

More information

DM559 Linear and Integer Programming. Lecture 3 Matrix Operations. Marco Chiarandini

DM559 Linear and Integer Programming. Lecture 3 Matrix Operations. Marco Chiarandini DM559 Linear and Integer Programming Lecture 3 Matrix Operations Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark Outline and 1 2 3 and 4 2 Outline and 1 2

More information

The divide-and-conquer strategy solves a problem by: 1. Breaking it into subproblems that are themselves smaller instances of the same type of problem

The divide-and-conquer strategy solves a problem by: 1. Breaking it into subproblems that are themselves smaller instances of the same type of problem Chapter 2. Divide-and-conquer algorithms The divide-and-conquer strategy solves a problem by: 1. Breaking it into subproblems that are themselves smaller instances of the same type of problem. 2. Recursively

More information

CS 1110: Introduction to Computing Using Python Sequence Algorithms

CS 1110: Introduction to Computing Using Python Sequence Algorithms CS 1110: Introduction to Computing Using Python Lecture 22 Sequence Algorithms [Andersen, Gries, Lee, Marschner, Van Loan, White] Final Exam: Announcements May 18 th, 9am-11:30am Location: Barton Hall

More information

CHAPTER 1 POLYNOMIALS

CHAPTER 1 POLYNOMIALS 1 CHAPTER 1 POLYNOMIALS 1.1 Removing Nested Symbols of Grouping Simplify. 1. 4x + 3( x ) + 4( x + 1). ( ) 3x + 4 5 x 3 + x 3. 3 5( y 4) + 6 y ( y + 3) 4. 3 n ( n + 5) 4 ( n + 8) 5. ( x + 5) x + 3( x 6)

More information

Problem Set 2 Solutions

Problem Set 2 Solutions Introduction to Algorithms October 1, 2004 Massachusetts Institute of Technology 6.046J/18.410J Professors Piotr Indyk and Charles E. Leiserson Handout 9 Problem Set 2 Solutions Reading: Chapters 5-9,

More information

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2. Chapter 1 LINEAR EQUATIONS 11 Introduction to linear equations A linear equation in n unknowns x 1, x,, x n is an equation of the form a 1 x 1 + a x + + a n x n = b, where a 1, a,, a n, b are given real

More information

Parallel Sparse Polynomial Division Using Heaps

Parallel Sparse Polynomial Division Using Heaps Parallel Sparse Polynomial Division Using Heaps Michael Monagan Department of Mathematics Simon Fraser University Burnaby, B.C. V5A S6, CANADA. mmonagan@cecm.sfu.ca Roman Pearce Department of Mathematics

More information

Tight Timing Estimation With the Newton-Gregory Formulae

Tight Timing Estimation With the Newton-Gregory Formulae CPC 2003 p.1/30 Tight Timing Estimation With the Newton-Gregory Formulae Robert van Engelen Kyle Gallivan Burt Walsh Florida State University CPC 2003 p.2/30 Introduction Worst-case execution time (WCET)

More information

CISC 235: Topic 1. Complexity of Iterative Algorithms

CISC 235: Topic 1. Complexity of Iterative Algorithms CISC 235: Topic 1 Complexity of Iterative Algorithms Outline Complexity Basics Big-Oh Notation Big-Ω and Big-θ Notation Summations Limitations of Big-Oh Analysis 2 Complexity Complexity is the study of

More information

Anatomy of SINGULAR talk at p. 1

Anatomy of SINGULAR talk at p. 1 Anatomy of SINGULAR talk at MaGiX@LIX 2011- p. 1 Anatomy of SINGULAR talk at MaGiX@LIX 2011 - Hans Schönemann hannes@mathematik.uni-kl.de Department of Mathematics University of Kaiserslautern Anatomy

More information

ELEMENTARY LINEAR ALGEBRA

ELEMENTARY LINEAR ALGEBRA ELEMENTARY LINEAR ALGEBRA K. R. MATTHEWS DEPARTMENT OF MATHEMATICS UNIVERSITY OF QUEENSLAND Second Online Version, December 1998 Comments to the author at krm@maths.uq.edu.au Contents 1 LINEAR EQUATIONS

More information

Balanced Dense Polynomial Multiplication on Multicores

Balanced Dense Polynomial Multiplication on Multicores Balanced Dense Polynomial Multiplication on Multicores Yuzhen Xie SuperTech Group, CSAIL MIT joint work with Marc Moreno Maza ORCCA, UWO ACA09, Montreal, June 26, 2009 Introduction Motivation: Multicore-enabling

More information

CSCI 3110 Assignment 6 Solutions

CSCI 3110 Assignment 6 Solutions CSCI 3110 Assignment 6 Solutions December 5, 2012 2.4 (4 pts) Suppose you are choosing between the following three algorithms: 1. Algorithm A solves problems by dividing them into five subproblems of half

More information

9. Numerical linear algebra background

9. Numerical linear algebra background Convex Optimization Boyd & Vandenberghe 9. Numerical linear algebra background matrix structure and algorithm complexity solving linear equations with factored matrices LU, Cholesky, LDL T factorization

More information

Algebra I. Book 2. Powered by...

Algebra I. Book 2. Powered by... Algebra I Book 2 Powered by... ALGEBRA I Units 4-7 by The Algebra I Development Team ALGEBRA I UNIT 4 POWERS AND POLYNOMIALS......... 1 4.0 Review................ 2 4.1 Properties of Exponents..........

More information

In practice one often meets a situation where the function of interest, f(x), is only represented by a discrete set of tabulated points,

In practice one often meets a situation where the function of interest, f(x), is only represented by a discrete set of tabulated points, 1 Interpolation 11 Introduction In practice one often meets a situation where the function of interest, f(x), is only represented by a discrete set of tabulated points, {x i, y i = f(x i ) i = 1 n, obtained,

More information

Advanced Data Structures

Advanced Data Structures Simon Gog gog@kit.edu - Simon Gog: KIT The Research University in the Helmholtz Association www.kit.edu Predecessor data structures We want to support the following operations on a set of integers from

More information

9. Numerical linear algebra background

9. Numerical linear algebra background Convex Optimization Boyd & Vandenberghe 9. Numerical linear algebra background matrix structure and algorithm complexity solving linear equations with factored matrices LU, Cholesky, LDL T factorization

More information

Chapter 1: Systems of linear equations and matrices. Section 1.1: Introduction to systems of linear equations

Chapter 1: Systems of linear equations and matrices. Section 1.1: Introduction to systems of linear equations Chapter 1: Systems of linear equations and matrices Section 1.1: Introduction to systems of linear equations Definition: A linear equation in n variables can be expressed in the form a 1 x 1 + a 2 x 2

More information

Systems of Linear Equations and Matrices

Systems of Linear Equations and Matrices Chapter 1 Systems of Linear Equations and Matrices System of linear algebraic equations and their solution constitute one of the major topics studied in the course known as linear algebra. In the first

More information

Cylindrical Algebraic Decomposition in Coq

Cylindrical Algebraic Decomposition in Coq Cylindrical Algebraic Decomposition in Coq MAP 2010 - Logroño 13-16 November 2010 Assia Mahboubi INRIA Microsoft Research Joint Centre (France) INRIA Saclay Île-de-France École Polytechnique, Palaiseau

More information

Pipelined Computations

Pipelined Computations Chapter 5 Slide 155 Pipelined Computations Pipelined Computations Slide 156 Problem divided into a series of tasks that have to be completed one after the other (the basis of sequential programming). Each

More information

Homework 10 Solution

Homework 10 Solution CS 174: Combinatorics and Discrete Probability Fall 2012 Homewor 10 Solution Problem 1. (Exercise 10.6 from MU 8 points) The problem of counting the number of solutions to a napsac instance can be defined

More information