Suppose you have a full-rank matrix NxM A , where M>N If we denote the columns on C_i (with dimensions Nx1 ), we can write the matrix as
A = [C_1, C_2, ..., C_M]
How can you get the first linearly independent columns of the original matrix A , so that you can build a new matrix NxN B , which is an invertible matrix with a nonzero determinant.
B = [C_i1, C_i2, ..., C_iN]
How can you find indices {i1, i2, ..., iN} either matlab or python numpy? Is it possible to do this by expanding on singular values? Code snippets will be very welcome.
EDIT: To make this more specific, consider the following python code
from numpy import * from numpy.linalg.linalg import det M = [[3, 0, 0, 0, 0], [0, 0, 1, 0, 0], [0, 0, 0, 0, 1], [0, 2, 0, 0, 0]] M = array(M) I = [0,1,2,4] assert(abs(det(M[:,I])) > 1e-8)
Therefore, given the matrix M, we need to find the indices of the set N linearly independent column vectors.