TSVD.jl icon indicating copy to clipboard operation
TSVD.jl copied to clipboard

Issue with TSVD.jl in the Singular Case Compared to PROPACK.jl

Open MohamedLaghdafHABIBOULLAH opened this issue 1 month ago • 0 comments

In the singular case, TSVD.jl appears to produce an error, while PROPACK.jl provides the expected results. I’m wondering if this issue is something that could be easily addressed.


julia> using TSVD, PROPACK

julia> Bk = [202.0 0.0; 0.0 0.0]
2×2 Matrix{Float64}:
 202.0  0.0
   0.0  0.0

julia> PROPACK.tsvd(Bk;k=1)[2]
1-element Vector{Float64}:
 202.0

julia> TSVD.tsvd(Bk,1)[2]
ERROR: LinearAlgebra.LAPACKException(2)
Stacktrace:
  [1] chklapackerror
    @ ~/.julia/juliaup/julia-1.10.4+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/LinearAlgebra/src/lapack.jl:40 [inlined]
  [2] bdsdc!(uplo::Char, compq::Char, d::Vector{Float64}, e_::Vector{Float64})
    @ LinearAlgebra.LAPACK ~/.julia/juliaup/julia-1.10.4+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/LinearAlgebra/src/lapack.jl:5738
  [3] #svd!#206
    @ ~/.julia/juliaup/julia-1.10.4+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/LinearAlgebra/src/bidiag.jl:241 [inlined]
  [4] svd!
    @ ~/.julia/juliaup/julia-1.10.4+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/LinearAlgebra/src/bidiag.jl:240 [inlined]
  [5] svd(M::LinearAlgebra.Bidiagonal{Float64, Vector{Float64}}; kw::@Kwargs{})
    @ LinearAlgebra ~/.julia/juliaup/julia-1.10.4+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/LinearAlgebra/src/bidiag.jl:245
  [6] svd
    @ ~/.julia/juliaup/julia-1.10.4+0.aarch64.apple.darwin14/share/julia/stdlib/v1.10/LinearAlgebra/src/bidiag.jl:244 [inlined]
  [7] biLanczos(A::Matrix{…}, nvals::Int64; maxiter::Int64, initvec::Vector{…}, tolconv::Float64, tolreorth::Float64, stepsize::Int64, debug::Bool)
    @ TSVD ~/.julia/packages/TSVD/JLekd/src/svd.jl:175
  [8] biLanczos
    @ ~/.julia/packages/TSVD/JLekd/src/svd.jl:108 [inlined]
  [9] _tsvd(A::Matrix{…}, nvals::Int64; maxiter::Int64, initvec::Vector{…}, tolconv::Float64, tolreorth::Float64, stepsize::Int64, debug::Bool)
    @ TSVD ~/.julia/packages/TSVD/JLekd/src/svd.jl:236
 [10] _tsvd
    @ ~/.julia/packages/TSVD/JLekd/src/svd.jl:222 [inlined]
 [11] #tsvd#7
    @ ~/.julia/packages/TSVD/JLekd/src/svd.jl:345 [inlined]
 [12] tsvd(A::Matrix{Float64}, nvals::Int64)
    @ TSVD ~/.julia/packages/TSVD/JLekd/src/svd.jl:335
 [13] top-level scope
    @ REPL[25]:1
Some type information was truncated. Use `show(err)` to see complete types.