title: Gauss-Jordan Elimination in python
body: <p>I am working on code to do Gauss-Jordan elimination in python. My directions are as follows:</p>
  
  <pre><code>def gauss_jordan(A):
  for each row k do
     i* &lt;- argmax_{k&lt;i&lt;n} |A_{ik}|
     if A_{i*k} = 0 then
       Matrix is not invertible
     end if
     Swap rows k and i*
     for each row j below k (i.e. j = k + 1,...,n) do
       f = A_{jk}/A_{kk}
       Aj = Aj - fA_{k}
     end for
  end for
  for each row k = n,..., 1 (i.e. in reverse) do
     A_{k} = A_{k}=A_{kk}
     for each row j above k (i.e. j = k -1,..., 1) do
       f = A_{jk}/A_{kk}  
       Aj = A_{j}-fA_{k}
     end for
  end for
  </code></pre>
  
  <p>So far I have:</p>
  
  <pre><code>def gauss_jordan(A):
  (h, w) = (len(A), len(A[0]))
  for y in range(0,h):          
      for pivot in range(y, h):   
          if A[pivot][y].value % 2 != 0: 
              break 
      else: 
          return None
  </code></pre>
  
  <p>Is this the correct start? I feel quite lost in where to go next. The input will be a Numpy array. Any thoughts are much appreciated!</p>