[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: reduced row echelon form

From: Dirk Laurie
Subject: Re: reduced row echelon form
Date: Mon, 16 Oct 2000 08:55:36 +0200

ben partan skryf:
> Is there a built-in command for get a reduced row echelon form of a
> matrix? Or is there an easy way to get one?

function [R,k]=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); r=sum(max(abs(U'))>tol);
for i=1:r, k=find(U(i,:)); j(i)=k(1); end
  % remove added columns if any, add correct number of zero rows
if n<p, R(:,n+1:p)=[]; end
if length(k)<m, R(m,n)=0; end

Consider the above code as alpha tested only.


Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:
How to fund new projects:
Subscription information:

reply via email to

[Prev in Thread] Current Thread [Next in Thread]