julia> B = BandedMatrix(1=> 1:3,0=>zeros(4))
4×4 BandedMatrix{Float64} with bandwidths (0, 1):
0.0 1.0 ⋅ ⋅
⋅ 0.0 2.0 ⋅
⋅ ⋅ 0.0 3.0
⋅ ⋅ ⋅ 0.0
julia> B1 = BandedMatrix(1=> 1.:3.)
4×4 BandedMatrix{Float64} with bandwidths (-1, 1):
⋅ 1.0 ⋅ ⋅
⋅ ⋅ 2.0 ⋅
⋅ ⋅ ⋅ 3.0
⋅ ⋅ ⋅ ⋅
julia> B == B1
true
julia> svdvals(B)
4-element Vector{Float64}:
3.0
2.0
1.0
0.0
julia> svdvals(B1)
** On entry to DGBBRD parameter number 5 had an illegal value
ERROR: ArgumentError: invalid argument #5 to LAPACK call
Stacktrace:
[1] chklapackerror
@ C:\Users\Andreas\.julia\juliaup\julia-1.11.4+0.x64.w64.mingw32\share\julia\stdlib\v1.11\LinearAlgebra\src\lapack.jl:38 [inlined]
[2] gbbrd!(vect::Char, m::Int64, n::Int64, ncc::Int64, kl::Int64, ku::Int64, ab::Matrix{Float64}, d::Vector{Float64}, e::Vector{Float64}, Q::Matrix{Float64}, Pt::Matrix{Float64}, C::Matrix{Float64}, work::Vector{Float64})
@ BandedMatrices C:\Users\Andreas\.julia\packages\BandedMatrices\KJZ2p\src\lapack.jl:187
[3] _bidiagonalize!(A::BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}}, M::BandedMatrices.BandedColumns{ArrayLayouts.DenseColumnMajor})
@ BandedMatrices C:\Users\Andreas\.julia\packages\BandedMatrices\KJZ2p\src\banded\BandedMatrix.jl:828
[4] bidiagonalize!
@ C:\Users\Andreas\.julia\packages\BandedMatrices\KJZ2p\src\banded\BandedMatrix.jl:846 [inlined]
[5] svdvals!
@ C:\Users\Andreas\.julia\packages\BandedMatrices\KJZ2p\src\banded\BandedMatrix.jl:849 [inlined]
[6] svdvals(A::BandedMatrix{Float64, Matrix{Float64}, Base.OneTo{Int64}})
@ BandedMatrices C:\Users\Andreas\.julia\packages\BandedMatrices\KJZ2p\src\banded\BandedMatrix.jl:850
[7] top-level scope
@ REPL[72]:1
Although the matrix
B1below is generated in my opinion with the wrong bandwiths, the equality withBis still satisfied. However, the functionsvdvalsfails onB1, with an obviously wrong error message.Moreover, for both cases the implementation of
svdvalsshould recognize that the matrix is already bidiagonal, which obviously doesn't happen.