Skip to content

Commit 5f558fc

Browse files
fixes
1 parent 20874ff commit 5f558fc

File tree

3 files changed

+17
-10
lines changed

3 files changed

+17
-10
lines changed

.vscode/settings.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

src/butterflylu.jl

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ end
2222
function 🦋workspace(A, ::Val{SEED} = Val(888)) where {SEED}
2323
A = pad!(A)
2424
B = similar(A);
25-
ws = 🦋generate!(B)
25+
ws = 🦋generate_random!(B)
2626
🦋mul!(copyto!(B, A), ws)
2727
U, V, B = materializeUV(B, ws)
2828
F = RecursiveFactorization.lu!(B, Val(false))
29-
A, B, U, V, F
29+
A, U, V, F
3030
end
3131

3232
const butterfly_workspace = 🦋workspace;
@@ -126,8 +126,18 @@ end
126126
function pad!(A)
127127
M, N = size(A)
128128
xn = 4 - M % 4
129-
A = [A zeros(N, xn)
130-
zeros(xn, N) I(xn)
131-
]
132-
A
129+
A_new = similar(A, M + xn, N + xn)
130+
for j in 1 : N, i in 1 : M
131+
@inbounds A_new[i, j] = A[i, j]
132+
end
133+
134+
for j in M + 1 : M + xn, i in 1:M
135+
@inbounds A_new[i, j] = 0
136+
@inbounds A_new[j, i] = 0
137+
end
138+
139+
for i in M + 1 : M + xn, j in N + 1 : N + xn
140+
@inbounds A_new[i,j] = i == j
141+
end
142+
A_new
133143
end

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ end
8181
for i in 790 : 810
8282
A = wilkinson(i)
8383
b = rand(i)
84-
A_ext, B, U, V, F = RecursiveFactorization.🦋workspace(A)
84+
A_ext, U, V, F = RecursiveFactorization.🦋workspace(A)
8585
M, N = size(A)
8686
xn = 4 - M % 4
8787
b_ext = [b; rand(xn)]

0 commit comments

Comments
 (0)