on-internet
← Community

Gauss-Jordan Elimination in python

Stack Overflow ·

I am working on code to do Gauss-Jordan elimination in python. My directions are as follows: def gauss_jordan(A): for each row k do i* <- argmax_{k<i<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 So far I have: def gauss_jordan(A): (h, w) = (len(A), len(A[0])) for y in range(0,h): for pivot in

Comments

Sign in or sign up to comment and upvote.

No comments yet.