### Hanging in ?HSEIN if NaN in H on input

Posted:

**Wed Oct 03, 2012 4:59 am**Hi,

?HSEIN functions could hang if there is a NaN on input in the matrix H and eigenvalues in W much larger than SMLNUM

The hanging happens in loop 70 and, since the NaN causes the value of HNORM to be also NaN, the value of EPS3 is set to SMLNUM at lines 402-405. If eigenvalues are large enough the operation at line 417 WK = WK + EPS3 doesn't alter the eigenvalue since WK .EQ. WK + EPS3 just because EPS3 is below significant digits for WK. And the loop infinitely iterates over the same value of WK.

As I see the fix is simple given we have the new norm function with NaN checkers from LAPACK 3.4.2. Just check the received HNORM value for NaN and report error for the input parameter H. It could be something like this:

Thanks,

Alexander

?HSEIN functions could hang if there is a NaN on input in the matrix H and eigenvalues in W much larger than SMLNUM

The hanging happens in loop 70 and, since the NaN causes the value of HNORM to be also NaN, the value of EPS3 is set to SMLNUM at lines 402-405. If eigenvalues are large enough the operation at line 417 WK = WK + EPS3 doesn't alter the eigenvalue since WK .EQ. WK + EPS3 just because EPS3 is below significant digits for WK. And the loop infinitely iterates over the same value of WK.

As I see the fix is simple given we have the new norm function with NaN checkers from LAPACK 3.4.2. Just check the received HNORM value for NaN and report error for the input parameter H. It could be something like this:

- Code: Select all
`- LOGICAL LSAME`

+ LOGICAL LSAME, SISNAN

REAL CLANHS, SLAMCH

- EXTERNAL LSAME, CLANHS, SLAMCH

+ EXTERNAL LSAME, CLANHS, SLAMCH, SISNAN

HNORM = CLANHS( 'I', KR-KL+1, H( KL, KL ), LDH, RWORK )

IF( HNORM.GT.RZERO ) THEN

EPS3 = HNORM*ULP

+ ELSE IF( SISNAN( HNORM ) ) THEN

+ INFO = -6

+ CALL XERBLA( 'CHSEIN', -INFO )

+ RETURN

ELSE

EPS3 = SMLNUM

END IF

Thanks,

Alexander