title: Scipy - find bases of column space of matrix
body: <p>I'm trying to code up a simple Simplex algorithm, the first step of which is to find a basic feasible solution:</p>
  
  <ol>
  <li>Choose a set B of linearly independent columns of A</li>
  <li>Set all components of x corresponding to the columns not in B to zero.</li>
  <li>Solve the m resulting equations to determine the components of x. These are the basic variables.</li>
  </ol>
  
  <p>I know the solution will involve using <code>scipy.linalg.svd</code> (or <code>scipy.linalg.lu</code>) and some <code>numpy.argwhere</code> / <code>numpy.where</code> magic, but I'm not sure exactly how.</p>
  
  <p>Does anyone have a pure-Numpy/Scipy implementation of finding a basis (step 1) or, even better, all of the above?</p>
  
  <p>Example:</p>
  
  <pre><code>&gt;&gt;&gt; A
  array([[1, 1, 1, 1, 0, 0, 0],
         [1, 0, 0, 0, 1, 0, 0],
         [0, 0, 1, 0, 0, 1, 0],
         [0, 3, 1, 0, 0, 0, 1]])
  
  &gt;&gt;&gt; u, s, v = scipy.linalg.svd(A)
  &gt;&gt;&gt; non_zero, = numpy.where(s &gt; 1e-7)
  &gt;&gt;&gt; rank = len(non_zero)
  &gt;&gt;&gt; rank
  4
  &gt;&gt;&gt; for basis in some_unknown_function(A):
  ...     print(basis)
  {3, 4, 5, 6}
  {1, 4, 5, 6}
  </code></pre>
  
  <p>and so on.</p>