Skip to content

Instantly share code, notes, and snippets.

@dccxi
dccxi / mtx_inv.py
Created September 4, 2017 18:32
Pure Python Matrix Inverse
def mtx_inv(M):
I = mtx_idt(len(M))
MI = [M[i]+I[i] for i in xrange(len(M))]
for i in xrange(len(MI)):
if MI[i][i] == 0:
temp = M[i]
M[i] = M[i+1]
M[i+1] = temp
if MI[i][i] != 1:
h = MI[i][i]