# problem with rank and finding the submatrix of max rank

Discussion in 'MATLAB' started by isih Chagouel, May 11, 2010.

1. ### isih ChagouelGuest

I am facing the following quite awkward problem. In my algorithm I am generating a rectangular matrix of coefficients of size 11401*3721. This matrix has rank 3721 and when I am considering the augmented matrix which will be of size of course 11401*3722 the rank is less than the rank of the matrix of the coefficients of my system. Obviously mathematically this doesn't make any sense. Is there anything that I can do in order to fix this mistake?

As you can understand the matrices that I am dealing with are huge. In order to calculate the rank I need 2 minutes and to calculate the row reduced echelon form (an thus get the solution of the system) I need almost 1.30-2 hours. I might be mistaken, but does matlab in order to calculate the rank calculates discriminants? If so is there a way to extract a submatrix of maximal rank? I could always right a loop testing the ranks till I create this submatrix, but this takes a lot of computational time which is against the efficiency of my algorithm.

Sincerely yours,

Isaak Chagouel

isih Chagouel, May 11, 2010

2. ### Bruno LuongGuest

No, RANK as returns by Matlab is NUMERICAL RANK not Mathematical one. Roughly, when a new column is added, the method compares how significantly a new vector increases the the orthogonality to the span of the old vectors, relative to the spectral norm. This can implies the rank of the augmented matrix is reduce.

If you do numerical calculation, the mathematical RANK has little sense.
NO, stop using RREF to estimate the rank. This is a bad method numerically.
NO, Matlab uses SVD to compute the rank. You can edit the file RANK.M to see how it's done. SVD will mix all vectors together and you won't be able to tell which one contributes to the discriminants.

However you can use QR decomposition to estimate the RANK. I use here for sparse matrix (see SPORTH in the FEX link), you can use the same method for FULL matrix as well:

http://www.mathworks.com/matlabcentral/fileexchange/27550-sparse-null-space-and

Bruno

Bruno Luong, May 11, 2010