From help-octave-request at bevo dot che dot wisc dot edu Tue Jan 19 08:11:18 1999 Subject: Re: Row Reduced Eschelon Form? From: Dirk Laurie To: sk8mini at ccs dot neu dot edu (Bryan May) Cc: help-octave at bevo dot che dot wisc dot edu Date: Tue, 19 Jan 1999 16:16:13 +0200 (SAT) Bryan May wrote: > > Is there a version of matlab's rref() for octave. I looked throught the > linear algebra documentation and couldn't find anything on it. Any ideas? > The equivalent is quite easy to write as an m-file. function R=rref(A,tol) % reduced row echelon form [m,n]=size(A); p=max(m,n); if nargin<2, tol=p*eps*norm(A,inf); end % pad matrix with zeros to make it square if m~=n, A(p,p)=0; end [L,U,P]=lu(A); k=find(abs(diag(U))>tol); R=U(k,k)\U(k,:); % remove added columns if any, add correct number of zero rows if n