Skip to content

Commit 02c2ad6

Browse files
authored
Obviate future ambiguities in adjoint cholmod solves (#338)
1 parent f175161 commit 02c2ad6

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/solvers/cholmod.jl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1580,15 +1580,17 @@ end
15801580
\(adjL::AdjType{<:Any,<:Factor}, B::Sparse) = (L = adjL.parent; spsolve(CHOLMOD_A, L, B))
15811581
\(adjL::AdjType{<:Any,<:Factor}, B::SparseVecOrMat) = (L = adjL.parent; \(adjoint(L), Sparse(B)))
15821582

1583-
(\)(adjL::AdjType{Float64,Factor{Float64}}, B::Vector{Complex{Float64}}) = complex.(adjL\real(B), adjL\imag(B))
1584-
(\)(adjL::AdjType{Float64,Factor{Float64}}, B::Matrix{Complex{Float64}}) = complex.(adjL\real(B), adjL\imag(B))
1585-
(\)(adjL::AdjType{Float64,Factor{Float64}}, B::Adjoint{<:Any,Matrix{Complex{Float64}}}) = complex.(adjL\real(B), adjL\imag(B))
1586-
(\)(adjL::AdjType{Float64,Factor{Float64}}, B::Transpose{<:Any,Matrix{Complex{Float64}}}) = complex.(adjL\real(B), adjL\imag(B))
1587-
function \(adjL::AdjType{<:Any,<:Factor}, b::StridedVector)
1583+
# Explicit typevars are necessary to avoid ambiguities with defs in LinearAlgebra/factorizations.jl
1584+
# Likewise the two following explicit Vector and Matrix defs (rather than a single VecOrMat)
1585+
(\)(adjL::AdjType{T,<:Factor}, B::Vector{Complex{T}}) where {T<:Float64} = complex.(adjL\real(B), adjL\imag(B))
1586+
(\)(adjL::AdjType{T,<:Factor}, B::Matrix{Complex{T}}) where {T<:Float64} = complex.(adjL\real(B), adjL\imag(B))
1587+
(\)(adjL::AdjType{T,<:Factor}, B::Adjoint{<:Any,Matrix{Complex{T}}}) where {T<:Float64} = complex.(adjL\real(B), adjL\imag(B))
1588+
(\)(adjL::AdjType{T,<:Factor}, B::Transpose{<:Any,Matrix{Complex{T}}}) where {T<:Float64} = complex.(adjL\real(B), adjL\imag(B))
1589+
function \(adjL::AdjType{<:VTypes,<:Factor}, b::StridedVector)
15881590
L = adjL.parent
15891591
return Vector(solve(CHOLMOD_A, L, Dense(b)))
15901592
end
1591-
function \(adjL::AdjType{<:Any,<:Factor}, B::StridedMatrix)
1593+
function \(adjL::AdjType{<:VTypes,<:Factor}, B::StridedMatrix)
15921594
L = adjL.parent
15931595
return Matrix(solve(CHOLMOD_A, L, Dense(B)))
15941596
end

0 commit comments

Comments
 (0)