Skip to content

Commit 4e34723

Browse files
committed
Revert "Replacing the generator with numpy vector operations from lu_decomposition."
This reverts commit ad217c6.
1 parent eccea26 commit 4e34723

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

arithmetic_analysis/lu_decomposition.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,15 @@ def lower_upper_decomposition(table: np.ndarray) -> tuple[np.ndarray, np.ndarray
8888

8989
lower = np.zeros((rows, columns))
9090
upper = np.zeros((rows, columns))
91-
92-
# in 'total', the necessary data is extracted through slices
93-
# and the sum of the products is obtained.
94-
9591
for i in range(columns):
9692
for j in range(i):
97-
total = np.sum(lower[i, :i] * upper[:i, j])
93+
total = sum(lower[i][k] * upper[k][j] for k in range(j))
9894
if upper[j][j] == 0:
9995
raise ArithmeticError("No LU decomposition exists")
10096
lower[i][j] = (table[i][j] - total) / upper[j][j]
10197
lower[i][i] = 1
10298
for j in range(i, columns):
103-
total = np.sum(lower[i, :i] * upper[:i, j])
99+
total = sum(lower[i][k] * upper[k][j] for k in range(j))
104100
upper[i][j] = table[i][j] - total
105101
return lower, upper
106102

0 commit comments

Comments
 (0)