From b7520c61a56e6570747cce0bbbd678e68d61dc3a Mon Sep 17 00:00:00 2001 From: Vitor Hideyoshi Date: Mon, 23 Nov 2020 08:48:55 -0300 Subject: [PATCH] gauss changed --- Source Code - Seals/process/process.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Source Code - Seals/process/process.py b/Source Code - Seals/process/process.py index facbd11..bc1541f 100644 --- a/Source Code - Seals/process/process.py +++ b/Source Code - Seals/process/process.py @@ -61,12 +61,17 @@ def gauss(a): l += 1 - while (a[k][i] == 0 and (k+1) < a.shape[0]): - k += 1 - - a[k] = a[k] - (a[k][i]/a[i][i])*a[i] + while (k < a.shape[0]): - k += 1 + if (a[k][i] == 0): + + k += 1 + + else: + + mult = a[k][i]/a[i][i] + a[k] = a[k] - mult*a[i] + k += 1 i += 1 @@ -103,7 +108,7 @@ def inverse(matrix): while (k < matrix.shape[0]): - if (k == i) or (matrix[i][i] == 0): + if (k == i) or (matrix[k][i] == 0) or (matrix[i][i] == 0): k += 1