Skip to content

Deflation breaks edge case #121

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
blegat opened this issue May 2, 2023 · 0 comments · Fixed by #122
Closed

Deflation breaks edge case #121

blegat opened this issue May 2, 2023 · 0 comments · Fixed by #122

Comments

@blegat
Copy link

blegat commented May 2, 2023

It seems #108 broke some edge cases.
Consider for instance:

julia> rank(BigFloat[0 0; 1 -1])
ERROR: MethodError: reducing over an empty collection is not allowed; consider supplying `init` to the reducer
Stacktrace:
  [1] mapreduce_empty(#unused#::typeof(identity), op::Function, T::Type)
    @ Base ./reduce.jl:367
  [2] reduce_empty(op::Base.MappingRF{typeof(identity), typeof(max)}, #unused#::Type{BigFloat})
    @ Base ./reduce.jl:356
  [3] reduce_empty_iter
    @ ./reduce.jl:379 [inlined]
  [4] mapreduce_empty_iter(f::Function, op::Function, itr::SubArray{BigFloat, 1, Vector{BigFloat}, Tuple{UnitRange{Int64}}, true}, ItrEltype::Base.HasEltype)
    @ Base ./reduce.jl:375
  [5] _mapreduce(f::typeof(identity), op::typeof(max), #unused#::IndexLinear, A::SubArray{BigFloat, 1, Vector{BigFloat}, Tuple{UnitRange{Int64}}, true})
    @ Base ./reduce.jl:427
  [6] _mapreduce_dim
    @ ./reducedim.jl:365 [inlined]
  [7] #mapreduce#765
    @ ./reducedim.jl:357 [inlined]
  [8] mapreduce
    @ ./reducedim.jl:357 [inlined]
  [9] #_maximum#783
    @ ./reducedim.jl:999 [inlined]
 [10] _maximum
    @ ./reducedim.jl:999 [inlined]
 [11] #_maximum#782
    @ ./reducedim.jl:998 [inlined]
 [12] _maximum
    @ ./reducedim.jl:998 [inlined]
 [13] #maximum#780
    @ ./reducedim.jl:994 [inlined]
 [14] maximum
    @ ./reducedim.jl:994 [inlined]
 [15] __svd!(B::Bidiagonal{BigFloat, Vector{BigFloat}}, U::Nothing, Vᴴ::Nothing; tol::BigFloat)
    @ GenericLinearAlgebra ~/.julia/dev/GenericLinearAlgebra/src/svd.jl:224
 [16] _svdvals!(B::Bidiagonal{BigFloat, Vector{BigFloat}}; tol::BigFloat)
    @ GenericLinearAlgebra ~/.julia/dev/GenericLinearAlgebra/src/svd.jl:252
 [17] #svdvals!#33
    @ ~/.julia/dev/GenericLinearAlgebra/src/svd.jl:539 [inlined]
 [18] svdvals!(A::Matrix{BigFloat}; tol::BigFloat)
    @ GenericLinearAlgebra ~/.julia/dev/GenericLinearAlgebra/src/svd.jl:567
 [19] svdvals!
    @ ~/.julia/dev/GenericLinearAlgebra/src/svd.jl:564 [inlined]
 [20] svdvals
    @ ~/.julia/juliaup/julia-1.8.5+0.x64.linux.gnu/share/julia/stdlib/v1.8/LinearAlgebra/src/svd.jl:243 [inlined]
 [21] rank(A::Matrix{BigFloat}; atol::Float64, rtol::BigFloat)
    @ LinearAlgebra ~/.julia/juliaup/julia-1.8.5+0.x64.linux.gnu/share/julia/stdlib/v1.8/LinearAlgebra/src/generic.jl:977
 [22] rank(A::Matrix{BigFloat})
    @ LinearAlgebra ~/.julia/juliaup/julia-1.8.5+0.x64.linux.gnu/share/julia/stdlib/v1.8/LinearAlgebra/src/generic.jl:975
 [23] top-level scope
    @ REPL[13]:1

In the code n1 = 1 and n2 = 2 then because d = [-1, 0], n2 is decreased to 1 by


After that
σ⁺ = max(maximum(view(d, n1:n2)), maximum(view(e, n1:(n2-1))))

fails because the interval n1:n2-1 is now empty and
shift = svdvals2x2(d[n2-1], d[n2], e[n2-1])[1]

fails because n2 - 1 is now 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant