title: gaussian elimination to solve Ax=b in matlab for boolean matrices
body: <p>Apologies for the extremely long post.
  I have the following code where I am tying to calculate Ax=b using matlab and gaussian elimination. When I compare my output with the actual expected output, the output is partially correct. I am not sure where I am actually going wrong. 
  Including the code and sample matrices too. </p>
  
  <pre><code>[ grow, gcol ] = size(generator_matrix);
  for i = 1 : grow - 1
      if ( generator_matrix(i,i) == 0 )
          t =  min ( find ( generator_matrix(i+1:grow,i) ~= 0 ) + i );
          temp = generator_matrix(i,:);
          generator_matrix(i,:) = generator_matrix(t,:);
          generator_matrix(t,:) = temp;
          tb = encoded_data(i,:);
          encoded_data(i,:)=encoded_data(t,:);
          encoded_data(t,:) = tb;
      end;
      for j = i+1 : grow
          m = -generator_matrix(j,i) / generator_matrix(i,i);
          generator_matrix(j,i) = 0;
          generator_matrix(j, i+1:grow) = generator_matrix(j, i+1:grow) + m * generator_matrix(i, i+1:grow);
          encoded_data(j,:) = mod(encoded_data(j,:) + m * encoded_data(i,:),2);
      end;
  end;
  
  
  x(grow,:) = encoded_data(grow,:) / generator_matrix(grow, grow);
  for i = grow - 1 : -1 : 1
      x(i,:) = mod(( encoded_data(i,:) - sum ( x(i+1:grow) .* generator_matrix(i, i+1:grow) ) ),2) / generator_matrix(i,i);
  end;
  </code></pre>
  
  <p>Sample values are :
  the values of generator matrix are </p>
  
  <pre><code>    [ 1 1 1 1          
      0 1 0 0
      0 0 1 0
      0 0 0 1]    
  </code></pre>
  
  <p>the value of encoded data </p>
  
  <pre><code> [  1 1 1 1 0
      0 0 0 0 1
      0 1 1 1 0
      0 0 1 0 0 ]
  </code></pre>
  
  <p>The value of x is supposed to be ( but the output that I am currently getting is not the matrix below) </p>
  
  <pre><code>     [1 1 1 1 0
        0 0 0 0 1
        0 1 1 1 0
        0 0 1 0 0 ]
  </code></pre>
  
  <p>Any suggestions or hints will be very helpful. </p>
  
  <p>I have tried to execute the code for larger matrices too 20x20 but I am not getting the right results. 
  Bhavya </p>