Skip to content

Commit deb96ab

Browse files
kshyattKristofferC
authored andcommitted
Fix bug and add tests for Bidiagonal (#42354)
1 parent 5bb8181 commit deb96ab

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

stdlib/LinearAlgebra/src/bidiag.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ function ldiv!(A::Bidiagonal, b::AbstractVector)
735735
end
736736

737737
if N == 0
738-
return x
738+
return b
739739
end
740740

741741
@inbounds begin

stdlib/LinearAlgebra/test/bidiag.jl

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,11 @@ Random.seed!(1)
269269
end
270270
end
271271
end
272+
zdv = Vector{elty}(undef, 0)
273+
zev = Vector{elty}(undef, 0)
274+
zA = Bidiagonal(zdv, zev, :U)
275+
zb = Vector{elty}(undef, 0)
276+
@test ldiv!(zA, zb) === zb
272277
end
273278

274279
if elty <: BlasReal
@@ -549,6 +554,14 @@ end
549554
B = Bidiagonal(dv, ev, uplo)
550555
@test dot(x, B, y) dot(B'x, y) dot(x, Matrix(B), y)
551556
end
557+
dv = Vector{elty}(undef, 0)
558+
ev = Vector{elty}(undef, 0)
559+
x = Vector{elty}(undef, 0)
560+
y = Vector{elty}(undef, 0)
561+
for uplo in (:U, :L)
562+
B = Bidiagonal(dv, ev, uplo)
563+
@test dot(x, B, y) dot(zero(elty), zero(elty), zero(elty))
564+
end
552565
end
553566
end
554567

0 commit comments

Comments
 (0)