rref
Reduced row echelon form of a matrix.
(u, ind)=rref(a)
(u, ind)=rref(a, tol)
Inputs
a A matrix.
tol A small positive real number.
Outputs
u The reduced row echelon form of a , with the same number of rows as a .
ind A vector of integers.


Description
If a is square matrix of full rank, u is the identity matrix of the same size.

If a is an mXn matrix with m>n , u is of the form [ I P;0 0] where I is the identity matrix of size length(ind) , with p a matrix containing non-zero elements.

If a is an mXn matrix of full rank with m<n , u is of the form [ I P] where I is the identity. Otherwise, u is of the form [I P; 0 p] as for the case m>n .

The estimated rank of the matrix can be obtained from length(ind) . The elements of the vector ind are the row indices of the columns of a which were used for pivoting during the construction of rref.


Example
>>a=[1 2 3 ;5 6 7 ; 9  10 11];
>>(rrf,ind)=rref(a)
>>rrf
    1.0000         0   -1.0000
         0    1.0000    2.0000
         0         0         0

>>ind
          1
          2

>>// length(ind) is the same as rank(a)
>>rank(a)
         2