How to obtain the minimum square full rank sub-matrix in a sparse matrix?
Show older comments
Dear All,
For a given sparse matrix, I am looking for the minimum square full-rank sub-matrix which is formed by nonzero columns for the selected rows.
If we know the rows in the sparse matrix A to be selected, the minimum square sub-matrix which should be full rank can be obtained using the following steps:
- Select the rows (we should know which rows to select);
- Remove all the zero columns, then we get a sub-matrix B, which should be square and full rank.
For example, a given sparse matrix as below:
A =[1 0 -1 0 0 0 0
-1 -1 0 0 0 0 0
0 0 0 0 -1 0 -1
-1 3 0 0 0 -1 0
0 -1 0 0 0 1 0
4 -1 -1 -1 0 0 0
-1 0 0 2 -1 0 0
0 0 0 -1 2 0 0
0 0 -1 0 0 0 -1];
The minimum square matrix is 3 by 3 for the example given above, which is formed by rows 2, 4 and 5 (please note: all nonzero elements in these 3 rows must be considered). B = [-1 -1 0 0 0 0 0; -1 3 0 0 0 -1 0; 0 -1 0 0 0 1 0]. Discard the zero columns in B, we obtain the minimum full-rank square matrix is: [-1 -1 0; -1 3 -1; 0 -1 1].
I am wondering if there exist Matlab functions to find the minimum square full rank sub-matrix for a given sparse matrix. The sparse matrix size is 1000 by 1000.
Thanks a lot and happy holidays.
Benson
10 Comments
John D'Errico
on 1 Dec 2018
Edited: John D'Errico
on 1 Dec 2018
For a 1000x1000 matrix? There can easily be billions of such full rank submatrices, and certainly billions of matrices to consider. That your matrix is sparse will reduce the number, but also make things slower to compute. I'd ask if you really, desperately need to do this, or if there is something simpler you can try to do.
Start by computing the rank of your matrix. It will give an upper limit on the size of the sub-matrices you need to consider.
Benson Gou
on 1 Dec 2018
Matt J
on 4 Dec 2018
The minimum square matrix is 3 by 3
The 1x1 matrix A(1) or the 2x2 matrix A(1:2,1:2) are full rank. Why don't they count?
Benson Gou
on 4 Dec 2018
Bruno Luong
on 4 Dec 2018
Your description is confusing to us.
Given a (n x m) matrix with rank k, there is maximal a square submatrix (k x k) full rank (=k). Maximal because any (k + 1) x (k x 1) will not be invertible (since the matrix is rank k). It is possible to find it.
I minimal invertible matrix is (1 x 1). It is also possible to find it, but it will be just a scalar different than 0, and it's trivial fo find it.
It does NOT exist a minimal submatrix invertible of 3 x 3, that does not make sense.
So we don't know what you look for: maximal, minimal, all possible full rank squares?
If you want the later, John has already warned that you might run into a huge number of combination.
So this thread will remain answered until those points are resolved.
Benson Gou
on 4 Dec 2018
Bruno Luong
on 4 Dec 2018
Edited: Bruno Luong
on 4 Dec 2018
No, it's not clear: why can't you select B = A(1,1). That's a submatrix of full-rank and square and minima! Done!!!!
@Bruno, because the submatrix A(1,1) cannot be extracted in the two step process that Benson described in his last comment. If you select just the first row, as you propose, and remove all the zero columns, you get the matrix [1,-1] which is not square.
It seems to me that the question is equivalent to the following: find a permutation of the rows and columns of A achieving the block triangular form
[P 0
Q R]
with the smallest possible non-singular matrix P. (If you can do this, then P will be the desired sub-matrix.)
Benson Gou
on 4 Dec 2018
Accepted Answer
More Answers (0)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!