I cannot use double subscripts, 2d arrays, or nested for loops for this problem.
ID: 3829313 • Letter: I
Question
I cannot use double subscripts, 2d arrays, or nested for loops for this problem. Here is the algorithm I have come up with so far:
L0[1] = sqrt(a[1]);
L1[1] = 1 / L0[1];
L2[1] = b[1] / L0[1];
L0[2] = sqrt(a[2] - (L1[1] / L0[1]) * (L1[1] / L0[1]));
L1[2] = (0 - (L2[1]) * (L1[1])) / L0[2];
L0[3] = sqrt(a[3] - (L2[1]) * (L2[1]) - (L1[2]) * (L1[2]));
for(i = 3; i <= n; i++) {
L2[i-2] = (b[i-2] - b[i-3] * b[i-4]) / b[i-2];
L1[i-1] = (L0[i] - (L2[i]) * (L1[i])) / L0[i];
L0[i] = sqrt(L0[i] - (L1[i]) * (L1[i]) - (L2[i]) * (L2[i]));
}
I'm not sure if I should add or change anything in this solution.
1) Let A be a symmetric pentadiagonal positive definite matrix of the form Cal 1 0 0 0 a, 0 bo 0 a 0 ba 0 0 2 0 b 0 bn 0 an n-4 m-2 0 b am-1 an n-2 Write an algorithm that generates a lower-triangular L such that A -LL'. That is, construct the vectors LO, LI, L2 so that LO L1 LO 0 L2 L1 LO 0 0 L2 LO L1 n-2 Use the given single subscripting and fully exploit the sparsity pattern. Assume that n 23. Hint: The number of special cases can be reduced by working one row at a time.Explanation / Answer
Algorithm looks Good.
In addition, you have to use a seperate extra for loop condition for the algorithm to be correct.
for(i:3 ; <n : i++)
{..
L0[i] = sqrt(L0[i] - (L1[i]) * (L1[i]) - (L2[i]) * (L1[i]));
..
}
Hope this Works !!
Thanks.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.