Code covered by the BSD License  

Highlights from
Fast Reduced Row Echelon Form

5.0

5.0 | 4 ratings Rate this file 6 Downloads (last 30 days) File Size: 2.42 KB File ID: #21583
image thumbnail

Fast Reduced Row Echelon Form

by Armin Ataei

 

25 Sep 2008 (Updated 11 Jan 2013)

A much faster version of MATLAB's RREF

| Watch this File

File Information
Description

For full matrices, the algorithm is based on the vectorization of MATLAB's RREF function. A typical speed-up range is about 2-4 times of the MATLAB's RREF function. However, the actual speed-up depends on the size of A. The speed-up is quite considerable if the number of columns in A is considerably larger than the number of its rows or when A is not dense.

For sparse matrices, the algorithm ignores the tol value and uses sparse QR to compute the rref form, improving the speed by a few orders of magnitude.

Authors: Armin Ataei, Ashish Myles

Required Products MATLAB
MATLAB release MATLAB 7.14 (R2012a)
Tags for This File  
Everyone's Tags
frref, linear algebra, reduced row echelon form, rref
Tags I've Applied
Add New Tags Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (6)
10 Jan 2013 Ashish Myles  
16 Nov 2012 Armin Ataei

@Angela YANG: Please note that the function frref(A,tol) may compute a slightly different value for the variable "tol" if it ommitted. This is most likely why you got different results when you compared the two. You can try the following code instead:
n = 100;
tol = 1e-6;
A = magic(n);
B = rref(A,tol);
C = frref(A,tol);
error = max(abs(B(:)-C(:)))
-----------------
In my case I got error = 8.4867e-011.
I should also point out that, as you know, A = magic(n) produces a square matrix and therefore A basically corresponds to a linear system of equations with n equations and n-1 variables. It is therefore very likely that such system has no solution at all and its frref does in fact confirm that. Hope this helps.

27 Oct 2012 Angela YANG

When I test it for magic matrix, it gave the different answer with matlab.

16 Feb 2011 Babak

Very fast and robust. It may not be a bad idea to preallocate 'jb' and then delete the empty elements. Otherwise, awesome!

02 Oct 2008 Nikola Toljic

Very good.

01 Oct 2008 Yi Cao

It is indead very fast compared to native MATLAB rref. However, I just wonder when the function is most useful.

Updates
29 Sep 2008

Screenshot was resized.

11 Jan 2013

Added support for sparse matrices, which improves the speed-up a few orders of magnitude compared to the previous version of frref.

11 Jan 2013

Support for sparse matrices was added, which improves the speed-up by a couple orders of magnitude compared to the previous version of frref.

Contact us