mirror of
https://github.com/TheAlgorithms/Python.git
synced 2025-07-05 09:21:13 +08:00
Add flake8-builtins to pre-commit and fix errors (#7105)
Ignore `A003` Co-authored-by: Christian Clauss <cclauss@me.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Dhruv Manilawala <dhruvmanila@gmail.com>
This commit is contained in:
@ -33,11 +33,11 @@ def retroactive_resolution(
|
||||
|
||||
x: NDArray[float64] = np.zeros((rows, 1), dtype=float)
|
||||
for row in reversed(range(rows)):
|
||||
sum = 0
|
||||
total = 0
|
||||
for col in range(row + 1, columns):
|
||||
sum += coefficients[row, col] * x[col]
|
||||
total += coefficients[row, col] * x[col]
|
||||
|
||||
x[row, 0] = (vector[row] - sum) / coefficients[row, row]
|
||||
x[row, 0] = (vector[row] - total) / coefficients[row, row]
|
||||
|
||||
return x
|
||||
|
||||
|
@ -147,14 +147,14 @@ def strictly_diagonally_dominant(table: NDArray[float64]) -> bool:
|
||||
is_diagonally_dominant = True
|
||||
|
||||
for i in range(0, rows):
|
||||
sum = 0
|
||||
total = 0
|
||||
for j in range(0, cols - 1):
|
||||
if i == j:
|
||||
continue
|
||||
else:
|
||||
sum += table[i][j]
|
||||
total += table[i][j]
|
||||
|
||||
if table[i][i] <= sum:
|
||||
if table[i][i] <= total:
|
||||
raise ValueError("Coefficient matrix is not strictly diagonally dominant")
|
||||
|
||||
return is_diagonally_dominant
|
||||
|
Reference in New Issue
Block a user