Skip to content

Instantly share code, notes, and snippets.

@shivaluma
Created March 28, 2018 12:29
Show Gist options
  • Save shivaluma/08a28a9171ba24ca5513eac2159fce4e to your computer and use it in GitHub Desktop.
Save shivaluma/08a28a9171ba24ca5513eac2159fce4e to your computer and use it in GitHub Desktop.
BacThang := proc (A) local hang, cot, i, j, k, d, check; hang := rowdim(A); cot := coldim(A); i := 1; j := 1; while i <= hang and j <= cot do if A[i, j] <> 0 then for k from i+1 to cot do addrow(A, i, k, -A[k, j]/A[i, j]) end do; i := i+1; j := j+1 else check := false; for d from i+1 to m do if A[d, j] <> 0 then check := true; swaprow(A, d, i); break end if end do; if check = false then j := j+1 end if end if end do; return A end proc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment