Skip to content

Commit 4714a86

Browse files
authored
Add lmul!(::Diagonal, ::AbstractVector) (JuliaLang#36012)
1 parent 10fd991 commit 4714a86

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

stdlib/LinearAlgebra/src/diagonal.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ function rmul!(A::AbstractMatrix, D::Diagonal)
193193
return A
194194
end
195195

196-
function lmul!(D::Diagonal, B::AbstractMatrix)
196+
function lmul!(D::Diagonal, B::AbstractVecOrMat)
197197
require_one_based_indexing(B)
198198
B .= D.diag .* B
199199
return B

stdlib/LinearAlgebra/test/diagonal.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,11 @@ Random.seed!(1)
173173
@test Array(D*a) DM*a
174174
@test Array(D/a) DM/a
175175
if relty <: BlasFloat
176-
b = rand(elty,n,n)
177-
b = sparse(b)
178-
@test lmul!(copy(D), copy(b)) Array(D)*Array(b)
179-
@test lmul!(transpose(copy(D)), copy(b)) transpose(Array(D))*Array(b)
180-
@test lmul!(adjoint(copy(D)), copy(b)) Array(D)'*Array(b)
176+
for b in (rand(elty,n,n), sparse(rand(elty,n,n)), rand(elty,n), sparse(rand(elty,n)))
177+
@test lmul!(copy(D), copy(b)) Array(D)*Array(b)
178+
@test lmul!(transpose(copy(D)), copy(b)) transpose(Array(D))*Array(b)
179+
@test lmul!(adjoint(copy(D)), copy(b)) Array(D)'*Array(b)
180+
end
181181
end
182182
end
183183

0 commit comments

Comments
 (0)