Modify the lutx function mentioned in the previous problem using explicit for lo
ID: 670168 • Letter: M
Question
Modify the lutx function mentioned in the previous problem using explicit for loops instead of MATLAB vector notation. For instance, one section of your new program might read % Compute the multipliers for i = k + 1: n L(i, k) = A(i, k)/A(k, k); end; Compare the original lutx with t with lutx after your loop modification and with the MATLAB function lu. Run the three codes on A=randn(100,100) and use the functions tic. toe referred to on p. 17 of Chapter One of the Moler book (or from typing help tic or help toe). We don't want to see your output, just the timings.Explanation / Answer
OUTPUT : Timings are to be dependent on - function [L,U,p,sig] = lutx(A) %LU Triangular factorization % [L,U,p,sig] = lutx(A) computes a unit lower triangular % matrix L, an upper triangular matrix U, a permutation % vector p, and a scalar sig, so that L*U = A(p,:) and % sig = +1 or -1 if p is an even or odd permutation.
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.