[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: RREF (row reduce echelon form)
From: |
Francesco Potorti` |
Subject: |
Re: RREF (row reduce echelon form) |
Date: |
Wed, 24 Jan 2001 02:06:24 +0100 |
I seem to recall several years ago there was an octave command or function
"RREF" (row reduce echelon form), for whatever version of Octave
corresponded to Debian 1.2 or 1.3. Returning, I can't find "RREF". If
I'm just not seeing it, please tell me where to look, or how to setup.
If it's not part of Octave, is there somewhere fellow users share this
kind of code, so I don't have to reinvent the wheel?
I have a couple in my octave mail archive. Here is one:
Date: Tue, 16 May 2000 08:46:52 +0200 (SAST)
From: Dirk Laurie <address@hidden>
Subject: Re: Matlab rref equivalent?
In-reply-to: <address@hidden>
from <Stéfan van der address@hidden>
To: address@hidden (Stéfan van der Walt)
Cc: address@hidden
[...]
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);
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<p, R(:,n+1:p)=[]; end
if length(k)<m, R(m,n)=0; end
endfunction
Dirk
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------