@@ -24,31 +24,32 @@ struct 🦋workspace{T}
2424 U:: Matrix{T}
2525 V:: Matrix{T}
2626 out:: Vector{T}
27+ tmp:: Vector{T}
2728 n:: Int
2829 function 🦋workspace (A, b, :: Val{SEED} = Val (888 )) where {SEED}
2930 n = size (A, 1 )
30- out = similar (b, n )
31+ out = similar (b)
3132 if (n % 4 != 0 )
3233 A = pad! (A)
3334 xn = 4 - n % 4
3435 b = [b; rand (xn)]
3536 end
37+ tmp = similar (b)
3638 U, V = (similar (A), similar (A))
3739 ws = 🦋generate_random! (A)
3840 materializeUV (U, V, ws)
39- new {eltype(A)} (A, b, ws, U, V, out, n)
41+ new {eltype(A)} (A, b, ws, U, V, out, tmp, n)
4042 end
4143end
4244
4345function 🦋solve! (workspace: :🦋workspace, thread)
44- (;A, b, ws, U, V, out, n) = workspace
46+ (;A, b, ws, U, V, out, tmp, n) = workspace
4547 🦋mul! (A, ws)
4648 F = RecursiveFactorization. lu! (A, Val (false ), thread)
4749
48- mul! (b, U' , b)
49- ldiv! (b, UnitLowerTriangular (F. factors), b, thread)
50- ldiv! (b, UpperTriangular (F. factors), b, thread)
51- mul! (b, V, b)
50+ mul! (tmp, U' , b)
51+ ldiv! (F, tmp, thread)
52+ mul! (b, V, tmp)
5253 out .= @view b[1 : n]
5354 out
5455end
0 commit comments