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

Error on tsvd(::Matrix{Double64})

Open SamuelBadr opened this issue 2 years ago • 0 comments

Hey there,

would it be possible to support arbitrary types? As it stands this doesn't work:

julia> using TSVD

julia> using DoubleFloats

julia> a = rand(Double64, 4, 5)
4×5 Matrix{Double64}:
 0.04919379096293597  0.029652786425431454  0.027081051380154375  0.6350861122377742   0.5510473418841347
 0.733735967612336    0.6415795260533754    0.6656527330112074    0.6647302426142875   0.9267886977489933
 0.5170738341399638   0.9441092849553093    0.1405723138676932    0.41097554085638344  0.14776900362205803
 0.4750330510671744   0.8592283380698013    0.5907097170564828    0.12745449930369002  0.42578025724057467

julia> tsvd(a)
ERROR: SVD for lower triangular bidiagonal matrices isn't implemented yet.
Stacktrace:
  [1] error(s::String)
    @ Base ./error.jl:33
  [2] __svd!(B::LinearAlgebra.Bidiagonal{BigFloat, Vector{BigFloat}}, U::Matrix{BigFloat}, Vᴴ::Matrix{BigFloat}; tol::BigFloat, debug::Bool)
    @ GenericLinearAlgebra ~/.julia/packages/GenericLinearAlgebra/Bd8s0/src/svd.jl:196
  [3] _svd!(B::LinearAlgebra.Bidiagonal{BigFloat, Vector{BigFloat}}; tol::BigFloat, debug::Bool)
    @ GenericLinearAlgebra ~/.julia/packages/GenericLinearAlgebra/Bd8s0/src/svd.jl:232
  [4] #svd!#38
    @ ~/.julia/packages/GenericLinearAlgebra/Bd8s0/src/svd.jl:499 [inlined]
  [5] svd!
    @ ~/.julia/packages/GenericLinearAlgebra/Bd8s0/src/svd.jl:499 [inlined]
  [6] #svd#191
    @ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/LinearAlgebra/src/bidiag.jl:214 [inlined]
  [7] svd
    @ /Applications/Julia-1.7.app/Contents/Resources/julia/share/julia/stdlib/v1.7/LinearAlgebra/src/bidiag.jl:214 [inlined]
  [8] biLanczos(A::Matrix{BigFloat}, nvals::Int64; maxiter::Int64, initvec::Vector{BigFloat}, tolconv::BigFloat, tolreorth::BigFloat, stepsize::Int64, debug::Bool)
    @ TSVD ~/.julia/packages/TSVD/q42gG/src/svd.jl:175
  [9] _tsvd(A::Matrix{BigFloat}, nvals::Int64; maxiter::Int64, initvec::Vector{BigFloat}, tolconv::BigFloat, tolreorth::BigFloat, stepsize::Int64, debug::Bool)
    @ TSVD ~/.julia/packages/TSVD/q42gG/src/svd.jl:236
 [10] #tsvd#7
    @ ~/.julia/packages/TSVD/q42gG/src/svd.jl:345 [inlined]
 [11] tsvd(A::Matrix{BigFloat}, nvals::Int64) (repeats 2 times)
    @ TSVD ~/.julia/packages/TSVD/q42gG/src/svd.jl:345
 [12] top-level scope
    @ REPL[6]:1

(The same thing happens with BigFloat, I just chose Double64 as an example because that's what I'd like to use.)

The error originates from GenericLinearAlgebra.jl because it expects an upper bidiagonal matrix and gets a lower one from TSVD.jl AFAICT. I'm not sure whether posting this issue in GenericLinearAlgebra.jl's repo would have been more appropriate.

Thanks in advance for any pointers!

SamuelBadr avatar May 04 '22 06:05 SamuelBadr