@@ -1070,30 +1070,30 @@ function factorise_lu_pivot(A)
1070
1070
L = zeros (n, n)
1071
1071
U = zeros (n, n)
1072
1072
p = fill (0 , n)
1073
- Aᵏ = float (copy (A)) # Make a copy of A and ensure that all entries
1073
+ Ak = float (copy (A)) # Make a copy of A and ensure that all entries
1074
1074
# are converted to floating-point numbers
1075
1075
1076
1076
for k in 1 : n- 1 # Algorithm steps
1077
- p[k] = argmax (abs .(Aᵏ [:, k])) # Find row with maximal pivot
1077
+ p[k] = argmax (abs .(Ak [:, k])) # Find row with maximal pivot
1078
1078
1079
- U[k, :] = Aᵏ [p[k], :] # Copy pivot row to U, use U now instead of Aᵏ ,
1079
+ U[k, :] = Ak [p[k], :] # Copy pivot row to U, use U now instead of Ak ,
1080
1080
# which is again updated in-place
1081
1081
for i in 1 : n # Row loop: Note the full range as any row may
1082
1082
# be non-zero
1083
- L[i, k] = Aᵏ [i, k] / U[k, k]
1083
+ L[i, k] = Ak [i, k] / U[k, k]
1084
1084
for j = 1 : n # Column loop: Again full range
1085
- Aᵏ [i, j] = Aᵏ [i, j] - L[i, k] * U[k, j]
1085
+ Ak [i, j] = Ak [i, j] - L[i, k] * U[k, j]
1086
1086
end
1087
1087
end
1088
1088
end
1089
- p[n] = argmax (abs .(Aᵏ [:, n]))
1090
- U[n, n] = Aᵏ [p[n], n]
1091
- L[:, n] = Aᵏ [:, n] / U[n, n]
1089
+ p[n] = argmax (abs .(Ak [:, n]))
1090
+ U[n, n] = Ak [p[n], n]
1091
+ L[:, n] = Ak [:, n] / U[n, n]
1092
1092
1093
1093
# To simplify assembling L we so far kept the rows in the same order
1094
1094
# as in A. To make the matrix upper triangular we also apply the column
1095
1095
# permutation p before returning the results.
1096
- LowerTriangular (L[p, :]), UpperTriangular (U), p
1096
+ (; L = LowerTriangular (L[p, :]), U = UpperTriangular (U), p= p)
1097
1097
end
1098
1098
1099
1099
# ╔═╡ 24df3f6a-8ac3-492b-b4e7-80029af6918d
@@ -1120,13 +1120,13 @@ fac.p
1120
1120
md " In contrast we obtain:"
1121
1121
1122
1122
# ╔═╡ 8f06e886-6ebb-4a16-a1c5-8123e09ef723
1123
- factorise_lu_pivot (D)[ 1 ] # L
1123
+ factorise_lu_pivot (D). L
1124
1124
1125
1125
# ╔═╡ 88000701-f480-4efd-93b8-50b60c9d5d95
1126
- factorise_lu_pivot (D)[ 2 ] # U
1126
+ factorise_lu_pivot (D). U
1127
1127
1128
1128
# ╔═╡ f79f92bc-e50b-4e5c-a82e-555269fa80b5
1129
- factorise_lu_pivot (D)[ 3 ] # p
1129
+ factorise_lu_pivot (D). p
1130
1130
1131
1131
# ╔═╡ 3e110a7e-1272-4c50-80f6-290f61844952
1132
1132
md """
@@ -2094,9 +2094,9 @@ uuid = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b"
2094
2094
version = "3.1.0"
2095
2095
2096
2096
[[deps.MIMEs]]
2097
- git-tree-sha1 = "1833212fd6f580c20d4291da9c1b4e8a655b128e "
2097
+ git-tree-sha1 = "c64d943587f7187e751162b3b84445bbbd79f691 "
2098
2098
uuid = "6c6e2e6c-3030-632d-7369-2d6c69616d65"
2099
- version = "1.0 .0"
2099
+ version = "1.1 .0"
2100
2100
2101
2101
[[deps.MacroTools]]
2102
2102
git-tree-sha1 = "72aebe0b5051e5143a079a4685a46da330a40472"
0 commit comments