Skip to content

Commit

Permalink
Fix bug and add tests for Bidiagonal (JuliaLang#42354)
Browse files Browse the repository at this point in the history
  • Loading branch information
kshyatt authored and LilithHafner committed Feb 22, 2022
1 parent 1ab94c7 commit 4fefccf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stdlib/LinearAlgebra/src/bidiag.jl
Original file line number Diff line number Diff line change
Expand Up @@ -735,7 +735,7 @@ function ldiv!(A::Bidiagonal, b::AbstractVector)
end

if N == 0
return x
return b
end

@inbounds begin
Expand Down
13 changes: 13 additions & 0 deletions stdlib/LinearAlgebra/test/bidiag.jl
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,11 @@ Random.seed!(1)
end
end
end
zdv = Vector{elty}(undef, 0)
zev = Vector{elty}(undef, 0)
zA = Bidiagonal(zdv, zev, :U)
zb = Vector{elty}(undef, 0)
@test ldiv!(zA, zb) === zb
end

if elty <: BlasReal
Expand Down Expand Up @@ -549,6 +554,14 @@ end
B = Bidiagonal(dv, ev, uplo)
@test dot(x, B, y) dot(B'x, y) dot(x, Matrix(B), y)
end
dv = Vector{elty}(undef, 0)
ev = Vector{elty}(undef, 0)
x = Vector{elty}(undef, 0)
y = Vector{elty}(undef, 0)
for uplo in (:U, :L)
B = Bidiagonal(dv, ev, uplo)
@test dot(x, B, y) dot(zero(elty), zero(elty), zero(elty))
end
end
end

Expand Down

0 comments on commit 4fefccf

Please sign in to comment.