Skip to content

Commit

Permalink
Don't compute factorization twice
Browse files Browse the repository at this point in the history
See JuliaLang#4732 and d46936b. Ugh.
  • Loading branch information
timholy committed Nov 4, 2013
1 parent d46936b commit 5cc1652
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions base/linalg/umfpack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -265,15 +265,17 @@ Ac_ldiv_B{Tb<:Complex}(fact::UmfpackLU{Float64}, b::Vector{Tb}) = fact'\b
At_ldiv_B{T<:UMFVTypes}(S::SparseMatrixCSC{T}, b::Vector{T}) = solve(lufact(S), b, UMFPACK_Aat)
At_ldiv_B{Ts<:UMFVTypes,Tb<:Number}(S::SparseMatrixCSC{Ts}, b::Vector{Tb}) = At_ldiv_B(S, convert(Vector{Ts}, b))
function At_ldiv_B{Tb<:Complex}(S::SparseMatrixCSC{Float64}, b::Vector{Tb})
r = At_ldiv_B(S, [convert(Float64,real(be)) for be in b])
i = At_ldiv_B(S, [convert(Float64,imag(be)) for be in b])
F = lufact(S)
r = solve(F, [convert(Float64,real(be)) for be in b], UMFPACK_Aat)
i = solve(F, [convert(Float64,imag(be)) for be in b], UMFPACK_Aat)
Complex128[r[k]+im*i[k] for k = 1:length(r)]
end
Ac_ldiv_B{T<:UMFVTypes}(S::SparseMatrixCSC{T}, b::Vector{T}) = solve(lufact(S), b, UMFPACK_At)
Ac_ldiv_B{Ts<:UMFVTypes,Tb<:Number}(S::SparseMatrixCSC{Ts}, b::Vector{Tb}) = Ac_ldiv_B(S, convert(Vector{Ts}, b))
function Ac_ldiv_B{Tb<:Complex}(S::SparseMatrixCSC{Float64}, b::Vector{Tb})
r = Ac_ldiv_B(S, [convert(Float64,real(be)) for be in b])
i = Ac_ldiv_B(S, [convert(Float64,imag(be)) for be in b])
F = lufact(S)
r = solve(F, [convert(Float64,real(be)) for be in b], UMFPACK_At)
i = solve(F, [convert(Float64,imag(be)) for be in b], UMFPACK_At)
Complex128[r[k]+im*i[k] for k = 1:length(r)]
end

Expand Down

0 comments on commit 5cc1652

Please sign in to comment.