help-octave
[Top][All Lists]
Advanced

[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: Wed, 18 Oct 2000 08:53:31 +0200

Paul Kienzle skryf:

> I did some speed comparisons between your function and mine, and in the
> process, discovered some problems:
> 
> 1) does not handle empty matrices
> 2) does not handle square matrices.  Perhaps the final test should be 
>    if length(j)<m rather than if length(k)<m ?
> 3) k is wrong for [R,k] = rref(...). Should return j instead of k?
> 4) sometimes gives singular matrix warning and returns the wrong matrix
> 5) Fails when find(U(i,:)) is empty
> 
> Note that your function is up to 5x faster for square A, but can be
> much, much slower for non-square A since it builds a square matrix
> in the process of solving.  I don't know how rref is usually used, so
> I don't know which approach is better.

Thanks for finding and correcting bugs 2 and 3.  Bugs 1 and 5 are also
easy to correct.  Bug 4 can't be corrected easily: it is caused by the
reliance on the `lu' function.  (I have never understood why `lu' must
take a square argument.  The underlying Fortran code is trivially
generalizable to the rectangular case: a simple question of changing
the termination index of certain loops.)

Given the fact that the RREF is used mainly for teaching and theoretical
purposes (the SVD is preferable in applications), your code is preferable,
since it directly reflects the way we teach students to compute the RREF.
If speed ever is an issue, an .oct function is the way to go.

Dirk 



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

Octave's home on the web:  http://www.che.wisc.edu/octave/octave.html
How to fund new projects:  http://www.che.wisc.edu/octave/funding.html
Subscription information:  http://www.che.wisc.edu/octave/archive.html
-----------------------------------------------------------------------



reply via email to

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