Skip to content

Commit d050b1b

Browse files
authored
Relax eltype in Diagonal ldiv!/rdiv! (#616)
These methods do not require the `eltype`s to match exactly, and should work as long as the values may be stored in the destination.
1 parent 4968cff commit d050b1b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/linalg.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,7 @@ end
12941294

12951295
\(A::Transpose{<:Complex,<:Hermitian{<:Complex,<:AbstractSparseMatrixCSC}}, B::Vector) = copy(A) \ B
12961296

1297-
function rdiv!(A::AbstractSparseMatrixCSC{T}, D::Diagonal{T}) where T
1297+
function rdiv!(A::AbstractSparseMatrixCSC, D::Diagonal)
12981298
dd = D.diag
12991299
if (k = length(dd)) size(A, 2)
13001300
throw(DimensionMismatch("size(A, 2)=$(size(A, 2)) should be size(D, 1)=$k"))
@@ -1312,7 +1312,7 @@ function rdiv!(A::AbstractSparseMatrixCSC{T}, D::Diagonal{T}) where T
13121312
A
13131313
end
13141314

1315-
function ldiv!(D::Diagonal{T}, A::Union{AbstractSparseMatrixCSC{T}, AbstractSparseVector{T}}) where {T}
1315+
function ldiv!(D::Diagonal, A::Union{AbstractSparseMatrixCSC, AbstractSparseVector})
13161316
# require_one_based_indexing(A)
13171317
if size(A, 1) != length(D.diag)
13181318
throw(DimensionMismatch("diagonal matrix is $(length(D.diag)) by $(length(D.diag)) but right hand side has $(size(A, 1)) rows"))

0 commit comments

Comments
 (0)