function [A]=chap_2_sect_6_prob_26(A) % slu Square lu factorization with now row exchanges, and overwritting A % % Written by: % -- % John L. Weatherwax 2006-03-28 % % email: wax@alum.mit.edu % % Please send comments and especially bug reports to the % above email address. % %----- [n,n]=size(A); tol=1.e-6; for k=1:n, if( abs(A(k,k))< tol ) disp(['Small pivot in column', int2str(k)]); end % cannot proceed without a row exchange for i=k+1:n A(i,k) = A(i,k)/A(k,k); % the kth pivot is now A(k,k) for j=k+1:n A(i,j) = A(i,j) - A(i,k)*A(k,j); end end end