Menu

[Solved]-Question 1 35 Points Matrix Chain Multiplication Matrix Chain Order P Array M N P Length 1 Q37293396

Question 1 (3.5 points) Matrix chain multiplication. MATRIX-CHAIN-ORDER (p) array m n p、length-1 2 let ] and s..n 1,2..n] be

Question 1 (3.5 points) Matrix chain multiplication. MATRIX-CHAIN-ORDER (p) array m n p、length-1 2 let ] and s..n 1,2..n] be new tables 3 for1 to n 5 for12 to n // 1 is the chain length for i= l to n-1+1 j-1 m[i, j] = 00 for ki to j -1 10 0 0 0 12 13 14 return m and s Let R[i,j] be the number of times that table entry m[i,j] is referenced while computing other table entries in a call of MATRIX-CHAIN-ORDER. a) In computing m[1,3], how many other entries are referenced? What are they? Which entries are referenced exactly once? b) What are R[1,1], R[2,2], R[3,3], R[4,4]? c) Let Ni be the number of iterations executed in the i-loop. Express N with n and l Let Nk be the number of iterations executed in the k-loop. Express Nk with /. d) Within each iteration of the k-loop, m is referenced twice. Therefore, the total number of n times that m is referenced is ΣΙ_2 NAO . 2 . Show that ΣΙ-2 NiNk . 2 Hint: You will find the equation Σ-1 12 : = n(n+1)(2n+ 1) useful. Show transcribed image text Question 1 (3.5 points) Matrix chain multiplication. MATRIX-CHAIN-ORDER (p) array m n p、length-1 2 let ] and s..n 1,2..n] be new tables 3 for1 to n 5 for12 to n // 1 is the chain length for i= l to n-1+1 j-1 m[i, j] = 00 for ki to j -1 10 0 0 0 12 13 14 return m and s Let R[i,j] be the number of times that table entry m[i,j] is referenced while computing other table entries in a call of MATRIX-CHAIN-ORDER. a) In computing m[1,3], how many other entries are referenced? What are they? Which entries are referenced exactly once? b) What are R[1,1], R[2,2], R[3,3], R[4,4]? c) Let Ni be the number of iterations executed in the i-loop. Express N with n and l Let Nk be the number of iterations executed in the k-loop. Express Nk with /. d) Within each iteration of the k-loop, m is referenced twice. Therefore, the total number of n times that m is referenced is ΣΙ_2 NAO . 2 . Show that ΣΙ-2 NiNk . 2 Hint: You will find the equation Σ-1 12 : = n(n+1)(2n+ 1) useful.

Expert Answer


Answer to Question 1 (3.5 points) Matrix chain multiplication. MATRIX-CHAIN-ORDER (p) array m n p、length-1 2 let ] and s..n 1,2…. . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *