Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions arithmetic_analysis/gaussian_elimination.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ def retroactive_resolution(

x: NDArray[float64] = np.zeros((rows, 1), dtype=float)
for row in reversed(range(rows)):
total = 0
for col in range(row + 1, columns):
total += coefficients[row, col] * x[col]

total = np.dot(
[coefficients[row, col] for col in range(row + 1, columns)],
[x[col] for col in range(row + 1, columns)],
)
x[row, 0] = (vector[row] - total) / coefficients[row, row]

return x
Expand Down