Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions base/sparse/umfpack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,9 @@ for (f!, umfpack) in ((:A_ldiv_B!, :UMFPACK_A),
end
return x
end
$f!{T<:UMFVTypes}(lu::UmfpackLU{T}, b::StridedVector{T}) = $f!(b, lu, copy(b))
$f!{T<:UMFVTypes}(lu::UmfpackLU{T}, b::StridedMatrix{T}) = $f!(b, lu, copy(b))
$f!{T<:UMFVTypes}(lu::UmfpackLU{T}, b::StridedVecOrMat{T}) = $f!(b, lu, copy(b))

function $f!{Tb<:Complex}(x::StridedVector{Tb}, lu::UmfpackLU{Float64}, b::StridedVector{Tb})
function $f!{Tb<:Complex}(x::StridedVecOrMat{Tb}, lu::UmfpackLU{Float64}, b::StridedVecOrMat{Tb})
m, n = size(x, 1), size(x, 2)
if n != size(b, 2)
throw(DimensionMismatch("in and output arrays must have the same number of columns"))
Expand All @@ -416,7 +415,7 @@ for (f!, umfpack) in ((:A_ldiv_B!, :UMFPACK_A),
end
return x
end
$f!{Tb<:Complex}(lu::UmfpackLU{Float64}, b::StridedVector{Tb}) = $f!(b, lu, copy(b))
$f!{Tb<:Complex}(lu::UmfpackLU{Float64}, b::StridedVecOrMat{Tb}) = $f!(b, lu, copy(b))
end
end

Expand Down
12 changes: 12 additions & 0 deletions test/sparse/umfpack.jl
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,15 @@ let
F = lufact(A)
@test F[:p] == [3 ; 4 ; 2 ; 1]
end

# Test that A[c|t]_ldiv_B!{T<:Complex}(X::StridedMatrix{T}, lu::UmfpackLU{Float64},
# B::StridedMatrix{T}) works as expected.
let N = 10, p = 0.5
A = N*speye(N) + sprand(N, N, p)
X = zeros(Complex{Float64}, N, N)
B = complex.(rand(N, N), rand(N, N))
luA, lufA = lufact(A), lufact(Array(A))
@test A_ldiv_B!(copy(X), luA, B) ≈ A_ldiv_B!(copy(X), lufA, B)
@test At_ldiv_B!(copy(X), luA, B) ≈ At_ldiv_B!(copy(X), lufA, B)
@test Ac_ldiv_B!(copy(X), luA, B) ≈ Ac_ldiv_B!(copy(X), lufA, B)
end