Skip to content

Commit

Permalink
xgesdd: Handle norm nan value
Browse files Browse the repository at this point in the history
Closes #469
  • Loading branch information
jschueller committed Jan 8, 2021
1 parent adbc021 commit 22f2ee7
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
8 changes: 6 additions & 2 deletions SRC/cgesdd.f
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,9 @@ SUBROUTINE CGESDD( JOBZ, M, N, A, LDA, S, U, LDU, VT, LDVT,
$ CUNGQR, CUNMBR, SBDSDC, SLASCL, XERBLA
* ..
* .. External Functions ..
LOGICAL LSAME
LOGICAL LSAME, SISNAN
REAL SLAMCH, CLANGE
EXTERNAL LSAME, SLAMCH, CLANGE
EXTERNAL LSAME, SLAMCH, CLANGE, SISNAN
* ..
* .. Intrinsic Functions ..
INTRINSIC INT, MAX, MIN, SQRT
Expand Down Expand Up @@ -647,6 +647,10 @@ SUBROUTINE CGESDD( JOBZ, M, N, A, LDA, S, U, LDU, VT, LDVT,
* Scale A if max element outside range [SMLNUM,BIGNUM]
*
ANRM = CLANGE( 'M', M, N, A, LDA, DUM )
IF( SISNAN ( ANRM ) ) THEN
INFO = -4
RETURN
END IF
ISCL = 0
IF( ANRM.GT.ZERO .AND. ANRM.LT.SMLNUM ) THEN
ISCL = 1
Expand Down
8 changes: 6 additions & 2 deletions SRC/dgesdd.f
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,9 @@ SUBROUTINE DGESDD( JOBZ, M, N, A, LDA, S, U, LDU, VT, LDVT,
$ XERBLA
* ..
* .. External Functions ..
LOGICAL LSAME
LOGICAL LSAME, DISNAN
DOUBLE PRECISION DLAMCH, DLANGE
EXTERNAL DLAMCH, DLANGE, LSAME
EXTERNAL DLAMCH, DLANGE, LSAME, DISNAN
* ..
* .. Intrinsic Functions ..
INTRINSIC INT, MAX, MIN, SQRT
Expand Down Expand Up @@ -599,6 +599,10 @@ SUBROUTINE DGESDD( JOBZ, M, N, A, LDA, S, U, LDU, VT, LDVT,
* Scale A if max element outside range [SMLNUM,BIGNUM]
*
ANRM = DLANGE( 'M', M, N, A, LDA, DUM )
IF( DISNAN( ANRM ) ) THEN
INFO = -4
RETURN
END IF
ISCL = 0
IF( ANRM.GT.ZERO .AND. ANRM.LT.SMLNUM ) THEN
ISCL = 1
Expand Down
8 changes: 6 additions & 2 deletions SRC/sgesdd.f
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,9 @@ SUBROUTINE SGESDD( JOBZ, M, N, A, LDA, S, U, LDU, VT, LDVT,
$ XERBLA
* ..
* .. External Functions ..
LOGICAL LSAME
LOGICAL LSAME, SISNAN
REAL SLAMCH, SLANGE
EXTERNAL SLAMCH, SLANGE, LSAME
EXTERNAL SLAMCH, SLANGE, LSAME, SISNAN
* ..
* .. Intrinsic Functions ..
INTRINSIC INT, MAX, MIN, SQRT
Expand Down Expand Up @@ -599,6 +599,10 @@ SUBROUTINE SGESDD( JOBZ, M, N, A, LDA, S, U, LDU, VT, LDVT,
* Scale A if max element outside range [SMLNUM,BIGNUM]
*
ANRM = SLANGE( 'M', M, N, A, LDA, DUM )
IF( SISNAN( ANRM ) ) THEN
INFO = -4
RETURN
END IF
ISCL = 0
IF( ANRM.GT.ZERO .AND. ANRM.LT.SMLNUM ) THEN
ISCL = 1
Expand Down
8 changes: 6 additions & 2 deletions SRC/zgesdd.f
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,9 @@ SUBROUTINE ZGESDD( JOBZ, M, N, A, LDA, S, U, LDU, VT, LDVT,
$ ZLASET, ZUNGBR, ZUNGLQ, ZUNGQR, ZUNMBR
* ..
* .. External Functions ..
LOGICAL LSAME
LOGICAL LSAME, DISNAN
DOUBLE PRECISION DLAMCH, ZLANGE
EXTERNAL LSAME, DLAMCH, ZLANGE
EXTERNAL LSAME, DLAMCH, ZLANGE, DISNAN
* ..
* .. Intrinsic Functions ..
INTRINSIC INT, MAX, MIN, SQRT
Expand Down Expand Up @@ -647,6 +647,10 @@ SUBROUTINE ZGESDD( JOBZ, M, N, A, LDA, S, U, LDU, VT, LDVT,
* Scale A if max element outside range [SMLNUM,BIGNUM]
*
ANRM = ZLANGE( 'M', M, N, A, LDA, DUM )
IF( DISNAN( ANRM ) ) THEN
INFO = -4
RETURN
END IF
ISCL = 0
IF( ANRM.GT.ZERO .AND. ANRM.LT.SMLNUM ) THEN
ISCL = 1
Expand Down

0 comments on commit 22f2ee7

Please sign in to comment.