Question: 1 2 3 For the following problems, consider the code below: for (i = 0; i < 5; i++) { for (j=0; j <
1 2 3 For the following problems, consider the code below: for (i = 0; i < 5; i++) { for (j=0; j < 5; j++) A[i+1][j+1] = A[i+1][j1] + A[i][j-1]; 4 } (a) Draw the iteration space graph for the following piece of code (be careful about the index expressions and the loop order!). (b) What are the distance vectors? The direction vectors? (c) Can the loops be interchanged? Why or why not? (d) Can the following two loops be fused? Why or why not? Explain your answer in terms of dependences between the loops. 1 for (i=1; i < 10; i++) 2 3 4 A[i-1] = B[i+1]; for (i=1; i < 10; i++) A[i+2] = A[i-1]; Activate W Go to Settings
Step by Step Solution
3.40 Rating (153 Votes )
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
