summaryrefslogtreecommitdiff
path: root/SRC/slange.f
diff options
context:
space:
mode:
authorjames <james@8a072113-8704-0410-8d35-dd094bca7971>2012-07-16 14:21:07 +0000
committerjames <james@8a072113-8704-0410-8d35-dd094bca7971>2012-07-16 14:21:07 +0000
commitb0ccd072d7381538a5947bc93908abeabaaf83d8 (patch)
treefc3e26f33d620d6968d56441ca92a256a071c3e6 /SRC/slange.f
parent8989738d77f02c7b50839e69ab8a2ed8aac75024 (diff)
downloadlapack-b0ccd072d7381538a5947bc93908abeabaaf83d8.tar.gz
lapack-b0ccd072d7381538a5947bc93908abeabaaf83d8.tar.bz2
lapack-b0ccd072d7381538a5947bc93908abeabaaf83d8.zip
matrix norms now consistently return nan when input matrix contains a nan;
previously, this was (usually) only the case for the 'F' norm
Diffstat (limited to 'SRC/slange.f')
-rw-r--r--SRC/slange.f16
1 files changed, 9 insertions, 7 deletions
diff --git a/SRC/slange.f b/SRC/slange.f
index c146f19b..9fb680b9 100644
--- a/SRC/slange.f
+++ b/SRC/slange.f
@@ -135,17 +135,17 @@
* ..
* .. Local Scalars ..
INTEGER I, J
- REAL SCALE, SUM, VALUE
+ REAL SCALE, SUM, VALUE, TEMP
* ..
* .. External Subroutines ..
EXTERNAL SLASSQ
* ..
* .. External Functions ..
- LOGICAL LSAME
- EXTERNAL LSAME
+ LOGICAL LSAME, SISNAN
+ EXTERNAL LSAME, SISNAN
* ..
* .. Intrinsic Functions ..
- INTRINSIC ABS, MAX, MIN, SQRT
+ INTRINSIC ABS, MIN, SQRT
* ..
* .. Executable Statements ..
*
@@ -158,7 +158,8 @@
VALUE = ZERO
DO 20 J = 1, N
DO 10 I = 1, M
- VALUE = MAX( VALUE, ABS( A( I, J ) ) )
+ TEMP = ABS( A( I, J ) )
+ IF( VALUE.LT.TEMP .OR. SISNAN( TEMP ) ) VALUE = TEMP
10 CONTINUE
20 CONTINUE
ELSE IF( ( LSAME( NORM, 'O' ) ) .OR. ( NORM.EQ.'1' ) ) THEN
@@ -171,7 +172,7 @@
DO 30 I = 1, M
SUM = SUM + ABS( A( I, J ) )
30 CONTINUE
- VALUE = MAX( VALUE, SUM )
+ IF( VALUE.LT.SUM .OR. SISNAN( SUM ) ) VALUE = SUM
40 CONTINUE
ELSE IF( LSAME( NORM, 'I' ) ) THEN
*
@@ -187,7 +188,8 @@
70 CONTINUE
VALUE = ZERO
DO 80 I = 1, M
- VALUE = MAX( VALUE, WORK( I ) )
+ TEMP = WORK( I )
+ IF( VALUE.LT.TEMP .OR. SISNAN( TEMP ) ) VALUE = TEMP
80 CONTINUE
ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
*