Skip to content

Commit 4c9e125

Browse files
authored
Call lmul!/rmul! recursively in scalings (#1236)
1 parent 8cc4216 commit 4c9e125

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

src/bidiag.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,8 @@ function rmul!(B::Bidiagonal, x::Number)
454454
iszero(y) || throw(ArgumentError(LazyString(lazy"cannot set index ($row, $col) off ",
455455
lazy"the tridiagonal band to a nonzero value ($y)")))
456456
end
457-
@. B.dv *= x
458-
@. B.ev *= x
457+
rmul!(B.dv, x)
458+
rmul!(B.ev, x)
459459
return B
460460
end
461461
function lmul!(x::Number, B::Bidiagonal)
@@ -467,8 +467,8 @@ function lmul!(x::Number, B::Bidiagonal)
467467
iszero(y) || throw(ArgumentError(LazyString(lazy"cannot set index ($row, $col) off ",
468468
lazy"the tridiagonal band to a nonzero value ($y)")))
469469
end
470-
@. B.dv = x * B.dv
471-
@. B.ev = x * B.ev
470+
lmul!(x, B.dv)
471+
lmul!(x, B.ev)
472472
return B
473473
end
474474
/(A::Bidiagonal, B::Number) = Bidiagonal(A.dv/B, A.ev/B, A.uplo)

src/diagonal.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ function lmul!(x::Number, D::Diagonal)
298298
iszero(y) || throw(ArgumentError(LazyString("cannot set index (2, 1) off ",
299299
lazy"the tridiagonal band to a nonzero value ($y)")))
300300
end
301-
@. D.diag = x * D.diag
301+
lmul!(x, D.diag)
302302
return D
303303
end
304304
function rmul!(D::Diagonal, x::Number)
@@ -308,7 +308,7 @@ function rmul!(D::Diagonal, x::Number)
308308
iszero(y) || throw(ArgumentError(LazyString("cannot set index (2, 1) off ",
309309
lazy"the tridiagonal band to a nonzero value ($y)")))
310310
end
311-
@. D.diag *= x
311+
rmul!(D.diag, x)
312312
return D
313313
end
314314
(/)(D::Diagonal, x::Number) = Diagonal(D.diag / x)

src/tridiag.jl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,8 @@ function rmul!(A::SymTridiagonal, x::Number)
227227
iszero(y) || throw(ArgumentError(LazyString("cannot set index (3, 1) off ",
228228
lazy"the tridiagonal band to a nonzero value ($y)")))
229229
end
230-
A.dv .*= x
231-
_evview(A) .*= x
230+
rmul!(A.dv, x)
231+
rmul!(_evview(A), x)
232232
return A
233233
end
234234
function lmul!(x::Number, B::SymTridiagonal)
@@ -238,9 +238,8 @@ function lmul!(x::Number, B::SymTridiagonal)
238238
iszero(y) || throw(ArgumentError(LazyString("cannot set index (3, 1) off ",
239239
lazy"the tridiagonal band to a nonzero value ($y)")))
240240
end
241-
@. B.dv = x * B.dv
242-
ev = _evview(B)
243-
@. ev = x * ev
241+
lmul!(x, B.dv)
242+
lmul!(x, _evview(B))
244243
return B
245244
end
246245
/(A::SymTridiagonal, B::Number) = SymTridiagonal(A.dv/B, A.ev/B)

0 commit comments

Comments
 (0)