def independent_square(A):
    N, M = A.shape
for colset in itertools.combinations(range(M), N):
    B = A[:, (colset)]
if not singular(B):
    return B
Obtaining an invertible square matrix from a non-square matrix of full rank in numpy or matlab