Assume you have an NxM matrix A of full rank, where M>N. If we denote the columns by C_i (with dimensions Nx1), then we can write the matrix as
A = [C_1, C_2, ..., C_M]
How can you obtain the first linearly independent columns of the original matrix A, so that you can construct a new NxN matrix B that is an invertible matrix with a non-zero determinant.
B = [C_i1, C_i2, ..., C_iN]
How can you find the indices {i1, i2, ..., iN} either in matlab or python numpy? Can this be done using singular value decomposition? Code snippets will be very welcome.
EDIT: To make this more concrete, 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)
So given a matrix M, one would need to find the indices of a set of N linearly independent column vectors.