File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -538,8 +538,9 @@ function lmul!(D::Diagonal, B::Bidiagonal)
538
538
matmul_size_check (size (D), size (B))
539
539
(; dv, ev) = B
540
540
isL = B. uplo == ' L'
541
- dv[1 ] = D. diag[1 ] * dv[1 ]
542
- for i in axes (ev,1 )
541
+ iszero (size (D,1 )) && return B
542
+ @inbounds dv[1 ] = D. diag[1 ] * dv[1 ]
543
+ @inbounds for i in axes (ev,1 )
543
544
ev[i] = D. diag[i + isL] * ev[i]
544
545
dv[i+ 1 ] = D. diag[i+ 1 ] * dv[i+ 1 ]
545
546
end
@@ -575,8 +576,9 @@ function rmul!(B::Bidiagonal, D::Diagonal)
575
576
matmul_size_check (size (B), size (D))
576
577
(; dv, ev) = B
577
578
isU = B. uplo == ' U'
578
- dv[1 ] *= D. diag[1 ]
579
- for i in axes (ev,1 )
579
+ iszero (size (D,1 )) && return B
580
+ @inbounds dv[1 ] *= D. diag[1 ]
581
+ @inbounds for i in axes (ev,1 )
580
582
ev[i] *= D. diag[i + isU]
581
583
dv[i+ 1 ] *= D. diag[i+ 1 ]
582
584
end
Original file line number Diff line number Diff line change @@ -1192,4 +1192,13 @@ end
1192
1192
@test_throws msg ldiv! (C, B, zeros (2 ,1 ))
1193
1193
end
1194
1194
1195
+ @testset " l/rmul with 0-sized matrices" begin
1196
+ n = 0
1197
+ B = Bidiagonal (ones (n), ones (max (n- 1 ,0 )), :U )
1198
+ B2 = copy (B)
1199
+ D = Diagonal (ones (n))
1200
+ @test lmul! (D, B) == B2
1201
+ @test rmul! (B, D) == B2
1202
+ end
1203
+
1195
1204
end # module TestBidiagonal
You can’t perform that action at this time.
0 commit comments