From bec6120330075f51a22c42631e5a42811cc4da97 Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Thu, 8 May 2025 22:46:36 +0530 Subject: [PATCH 1/2] `Char` uplo in `Bidiagonal` constructor --- src/bidiag.jl | 7 ++----- test/bidiag.jl | 4 ++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/bidiag.jl b/src/bidiag.jl index 2e323f6f..2c0714e7 100644 --- a/src/bidiag.jl +++ b/src/bidiag.jl @@ -65,16 +65,13 @@ julia> Bl = Bidiagonal(dv, ev, :L) # ev is on the first subdiagonal ⋅ ⋅ 9 4 ``` """ -function Bidiagonal(dv::V, ev::V, uplo::Symbol) where {T,V<:AbstractVector{T}} - Bidiagonal{T,V}(dv, ev, uplo) -end -function Bidiagonal(dv::V, ev::V, uplo::AbstractChar) where {T,V<:AbstractVector{T}} +function Bidiagonal(dv::V, ev::V, uplo::Union{Symbol, AbstractChar}) where {T,V<:AbstractVector{T}} Bidiagonal{T,V}(dv, ev, uplo) end #To allow Bidiagonal's where the "dv" is Vector{T} and "ev" Vector{S}, #where T and S can be promoted -function Bidiagonal(dv::Vector{T}, ev::Vector{S}, uplo::Symbol) where {T,S} +function Bidiagonal(dv::Vector{T}, ev::Vector{S}, uplo::Union{Symbol, AbstractChar}) where {T,S} TS = promote_type(T,S) return Bidiagonal{TS,Vector{TS}}(dv, ev, uplo) end diff --git a/test/bidiag.jl b/test/bidiag.jl index 3abf2cb5..811390ec 100644 --- a/test/bidiag.jl +++ b/test/bidiag.jl @@ -512,6 +512,10 @@ Random.seed!(1) @test Matrix{ComplexF64}(BD) == BD end +@testset "Constructors with Char uplo" + @test Bidiagonal(Int8[1,2], [1], 'U') == Bidiagonal(Int8[1,2], [1], :U) +end + # Issue 10742 and similar let A = Bidiagonal([1,2,3], [0,0], :U) @test istril(A) From ed1b085d34abf47b48f176fc7fa344696bcf2c6b Mon Sep 17 00:00:00 2001 From: Jishnu Bhattacharya Date: Thu, 8 May 2025 23:14:46 +0530 Subject: [PATCH 2/2] fix testset --- test/bidiag.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/bidiag.jl b/test/bidiag.jl index 811390ec..c5ed26e1 100644 --- a/test/bidiag.jl +++ b/test/bidiag.jl @@ -512,7 +512,7 @@ Random.seed!(1) @test Matrix{ComplexF64}(BD) == BD end -@testset "Constructors with Char uplo" +@testset "Constructors with Char uplo" begin @test Bidiagonal(Int8[1,2], [1], 'U') == Bidiagonal(Int8[1,2], [1], :U) end