LaEigSolve hangs when matrix contains NaN; LaLUInverseIP
Status: Beta
Brought to you by:
cstim
Using Lapack++ 1.5.1
Affects: LaEigSolve, LaLUInverseIP, others?
Attempting to call LaEigSolve on a LaGenMatComplex which contains a NaN causes Lapack++ to hang if the NaN is not in the (1,1) position, or to throw an exception if NaN is in (1,1). It would make sense to me to throw an exception if there is a NaN anywhere in the matrix.
Using LUFactorizeIP and LaLUInverseIP to find the inverse of the same matrix returns an inverse of all NaN; I would expect that this should also throw an exception?
It's easiest just to demonstrate. bug.cpp and bug2.cpp show the two behaviors.
Anonymous
Demonstration code
Logged In: YES
user_id=1579622
Originator: YES
My apologies, I meant to say that I'm using Lapack++ 2.5.1
Logged In: YES
user_id=531034
Originator: NO
I'm afraid I also don't know any short term solution to this problem. As lapack++ is merely a wrapper to lapack, if lapack itself hangs, lapack++ can't do anything anymore.
Logged In: NO
I am not familiar with the underlying code, but would it be feasible to simply scan the matrix for NaN in the lapack++ portion of the code, and throw the exception if one or more are present instead of calling the lapack function immediately?
Possibly add a FLAG to opt-in/out of that check?
Logged In: YES
user_id=531034
Originator: NO
In principle a hand-written loop over the full matrix content would work, but OTOH it would incur a massive performance overhead, especially because the matrix size can be enormous. I would only add such a check if there is a LAPACK function for this - otherwise a hand-written loop will be much too inefficient.