Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

matlab. i recognize the answer will differ by hardware, but please give a solid answer for the part about the order of the matrix. provided

matlab. i recognize the answer will differ by hardware, but please give a solid answer for the part about the order of the matrix. image text in transcribed
provided lutx code
function [L,U,p] = lutx(A)
%LUTX Triangular factorization, textbook version
% [L,U,p] = lutx(A) produces a unit lower triangular matrix L,
% an upper triangular matrix U, and a permutation vector p,
% so that L*U = A(p,:)
% Copyright 2014 Cleve Moler
% Copyright 2014 The MathWorks, Inc.
[n,n] = size(A);
p = (1:n)';
for k = 1:n-1
% Find index of largest element below diagonal in k-th column
[r,m] = max(abs(A(k:n,k)));
m = m+k-1;
% Skip elimination if column is zero
if (A(m,k) ~= 0)
% Swap pivot row
if (m ~= k)
A([k m],:) = A([m k],:);
p([k m]) = p([m k]);
end
% Compute multipliers
i = k+1:n;
A(i,k) = A(i,k)/A(k,k);
% Update the remainder of the matrix
j = k+1:n;
A(i,j) = A(i,j) - A(i,k)*A(k,j);
end
end
% Separate result
L = tril(A,-1) + eye(n,n);
U = triu(A);
2.8. Modify the lutx function so that it uses explicit for loops instead of MATLAB vector notation. For example, one section of your modified program will read % Compute the multipliers for i = k+1:n A(i,k) = A(i,k)/A(k,k); end Compare the execution time of your modified lutx program with the origi- nal lutx program and with the built-in lu function by finding the order of the matrix for which each of the three programs takes about 10 s on your computer

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Navigating The Supply Chain Maze A Comprehensive Guide To Optimize Operations And Drive Success

Authors: Michael E Kirshteyn Ph D

1st Edition

B0CPQ2RBYC, 979-8870727585

More Books

Students also viewed these Databases questions