Skip to content

Commit

Permalink
make complex ldive allcoate less (#156)
Browse files Browse the repository at this point in the history
  • Loading branch information
SobhanMP authored Jun 23, 2022
1 parent 176ef64 commit 7745517
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/solvers/umfpack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -860,19 +860,24 @@ function _AqldivB_kernel!(X::StridedMatrix{T}, lu::UmfpackLU{T},
end
function _AqldivB_kernel!(x::StridedVector{Tb}, lu::UmfpackLU{Float64},
b::StridedVector{Tb}, transposeoptype) where Tb<:Complex
r, i = similar(b, Float64), similar(b, Float64)
solve!(r, lu, Vector{Float64}(real(b)), transposeoptype)
solve!(i, lu, Vector{Float64}(imag(b)), transposeoptype)
r = similar(b, Float64)
i = similar(b, Float64)
c = real.(b)
solve!(r, lu, c, transposeoptype)
c .= imag.(b)
solve!(i, lu, c, transposeoptype)
map!(complex, x, r, i)
end
function _AqldivB_kernel!(X::StridedMatrix{Tb}, lu::UmfpackLU{Float64},
B::StridedMatrix{Tb}, transposeoptype) where Tb<:Complex
r = similar(B, Float64, size(B, 1))
i = similar(B, Float64, size(B, 1))

c = similar(B, Float64, size(B, 1))
for j in 1:size(B, 2)
solve!(r, lu, Vector{Float64}(real(view(B, :, j))), transposeoptype)
solve!(i, lu, Vector{Float64}(imag(view(B, :, j))), transposeoptype)
c .= real.(view(B, :, j))
solve!(r, lu, c, transposeoptype)
c .= imag.(view(B, :, j))
solve!(i, lu, c, transposeoptype)
map!(complex, view(X, :, j), r, i)
end
end
Expand Down

0 comments on commit 7745517

Please sign in to comment.