Skip to content
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

rdiv!(B, F::UpperHessenberg; shift::Number) does not return if shift=Inf #34145

Open
olof3 opened this issue Dec 19, 2019 · 1 comment
Open
Labels
bug Indicates an unexpected problem or unintended behavior linear algebra Linear algebra

Comments

@olof3
Copy link
Contributor

olof3 commented Dec 19, 2019

This issue was mentioned in #31738.

The problem seems to be that LinearAlgebra.givensAlgorithm gets stuck in an infinite loop if one of its input arguments is Inf.
Actually dlartg upon which that function is based does the same

T = Float64
ccall((:dlartg_64_, LinearAlgebra.LAPACK.liblapack), Cvoid,
       (Ref{T}, Ref{T}, Ref{T}, Ref{T}, Ref{T}),
      Ref{T}(1.0), Ref{T}(Inf), Ref{T}(), Ref{T}(), Ref{T}())

Even though the paper upon which the algorithms is based, On Computing Givens Rotations Reliably and Efficiently, states that "On a machine with correct IEEE floating point semantics with NaNs and +-inf, we insist that any standard conforming implementation must terminate and return some output values in all cases as described below.". More details are given in the section Exceptional Cases.

Not sure what the best approach to fix this is.

Should givensAlgorithm be modified?
(Also, the name is a bit confusing, perhaps it should be called something like_givens_rotation?)

Or should the the relevant !rdivand !ldiv be modified by adding something like the following in the beginning of the methods?

    if isinf(shift)
        if all(isfinite, F.data) && all(isfinite, B)
            return fill!(B, zero(eltype(B)))
        else
            return fill!(B, eltype(B)(NaN))
        end
    end
@olof3 olof3 changed the title rdiv!(B, F::UpperHessenberg; shift::Number) does not return if shift=Inf. rdiv!(B, F::UpperHessenberg; shift::Number) does not return if shift=Inf Dec 19, 2019
@dkarrasch dkarrasch added the linear algebra Linear algebra label Dec 19, 2019
@stevengj
Copy link
Member

stevengj commented Jun 7, 2020

Should givensAlgorithm be modified?

Probably.

@stevengj stevengj added the bug Indicates an unexpected problem or unintended behavior label Jun 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior linear algebra Linear algebra
Projects
None yet
Development

No branches or pull requests

3 participants