Skip to content

Commit ba99148

Browse files
committed
lmul!
1 parent f61c04c commit ba99148

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/diagonal.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ function _rmul!(A::UpperOrLowerTriangular, D::Diagonal)
388388
P[row, col] *= D.diag[col]
389389
end
390390
end
391-
isupper && _setdiag!(P, identity, D.diag)
391+
isunit && _setdiag!(P, identity, D.diag)
392392
TriWrapper = isupper ? UpperTriangular : LowerTriangular
393393
return TriWrapper(P)
394394
end
@@ -423,10 +423,10 @@ function _lmul!(D::Diagonal, A::UpperOrLowerTriangular)
423423
rowstart = isupper ? firstindex(A,1) : col+isunit
424424
rowstop = isupper ? col-isunit : lastindex(A,1)
425425
for row in rowstart:rowstop
426-
P[row, col] = D.diag[col] * P[row, col]
426+
P[row, col] = D.diag[row] * P[row, col]
427427
end
428428
end
429-
isupper && _setdiag!(P, identity, D.diag)
429+
isunit && _setdiag!(P, identity, D.diag)
430430
TriWrapper = isupper ? UpperTriangular : LowerTriangular
431431
return TriWrapper(P)
432432
end

test/diagonal.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,11 +1197,11 @@ end
11971197
outTri = similar(TriA)
11981198
out = similar(A)
11991199
# 2 args
1200-
for fun in (*, rmul!, rdiv!, /)
1200+
@testset for fun in (*, rmul!, rdiv!, /)
12011201
@test fun(copy(TriA), D)::Tri == fun(Matrix(TriA), D)
12021202
@test fun(copy(UTriA), D)::Tri == fun(Matrix(UTriA), D)
12031203
end
1204-
for fun in (*, lmul!, ldiv!, \)
1204+
@testset for fun in (*, lmul!, ldiv!, \)
12051205
@test fun(D, copy(TriA))::Tri == fun(D, Matrix(TriA))
12061206
@test fun(D, copy(UTriA))::Tri == fun(D, Matrix(UTriA))
12071207
end

0 commit comments

Comments
 (0)