Skip to content

Commit c83fb06

Browse files
fixes
1 parent 5a46825 commit c83fb06

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/butterflylu.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,10 @@ function 🦋generate_random!(A, ::Val{SEED} = Val(888)) where {SEED}
2121
end
2222

2323
function 🦋workspace(A, B::Matrix{T}, U::Adjoint{T, Matrix{T}}, V::Matrix{T}, ::Val{SEED} = Val(888)) where {T, SEED}
24-
A = pad!(A)
24+
M = size(A, 1)
25+
if (M % 4 != 0)
26+
A = pad!(A)
27+
end
2528
B = similar(A)
2629
ws = 🦋generate_random!(copyto!(B, A))
2730
🦋mul!(copyto!(B, A), ws)

test/runtests.jl

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,14 @@ end
8181
for i in 790 : 810
8282
A = wilkinson(i)
8383
b = rand(i)
84-
U, V, F = RecursiveFactorization.🦋workspace(A, A', A)
85-
M, N = size(A)
84+
U, V, F = RecursiveFactorization.🦋workspace(A, A, A', A)
85+
M = size(A, 1)
8686
xn = 4 - M % 4
87-
b_ext = [b; rand(xn)]
88-
x = V * (F \ (U * b_ext))
89-
@test norm(A * x[1:M] .- b) <= 1e-10
87+
if (M % 4 != 0)
88+
xn = 4 - M % 4
89+
b = [b; rand(xn)]
90+
end
91+
x = V * (F \ (U * b))
92+
@test norm(A * x[1:M] .- b[1:M]) <= 1e-10
9093
end
9194
end

0 commit comments

Comments
 (0)