Hi,
I'm trying to modify this code that performs an LU decompositon for a matrix A via column operations. The default code is written for row operations.
I don't understand what the code is doing though for the row operations. Does anyone mind explaining what is going on line-by-line? I know how to do LU decomposition by hand, but I don't have a really good idea what the script is doing.
I'll include the programme for you.
Thank You!
function [L,U] = mylu(A)n = size(A,1);for k = 1:n if A(k,k)==0 warning('LU factorization fails'); L = []; U = []; return; end i = k+1:n; A(i,k) = A(i,k)/A(k,k); A(i,i) = A(i,i)-A(i,k)*A(k,i);endL = tril(A,-1)+eye(n); U = triu(A);
Best Answer