This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def gauss(A): | |
m = len(A) | |
assert all([len(row) == m + 1 for row in A[1:]]), "Matrix rows have non-uniform length" | |
n = m + 1 | |
for k in range(m): | |
pivots = [abs(A[i][k]) for i in range(k, m)] | |
i_max = pivots.index(max(pivots)) + k | |
# Check for singular matrix |