LAPACK 3.3.0
|
00001 DOUBLE PRECISION FUNCTION ZLANHS( NORM, N, A, LDA, WORK ) 00002 * 00003 * -- LAPACK auxiliary routine (version 3.2) -- 00004 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00005 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00006 * November 2006 00007 * 00008 * .. Scalar Arguments .. 00009 CHARACTER NORM 00010 INTEGER LDA, N 00011 * .. 00012 * .. Array Arguments .. 00013 DOUBLE PRECISION WORK( * ) 00014 COMPLEX*16 A( LDA, * ) 00015 * .. 00016 * 00017 * Purpose 00018 * ======= 00019 * 00020 * ZLANHS returns the value of the one norm, or the Frobenius norm, or 00021 * the infinity norm, or the element of largest absolute value of a 00022 * Hessenberg matrix A. 00023 * 00024 * Description 00025 * =========== 00026 * 00027 * ZLANHS returns the value 00028 * 00029 * ZLANHS = ( max(abs(A(i,j))), NORM = 'M' or 'm' 00030 * ( 00031 * ( norm1(A), NORM = '1', 'O' or 'o' 00032 * ( 00033 * ( normI(A), NORM = 'I' or 'i' 00034 * ( 00035 * ( normF(A), NORM = 'F', 'f', 'E' or 'e' 00036 * 00037 * where norm1 denotes the one norm of a matrix (maximum column sum), 00038 * normI denotes the infinity norm of a matrix (maximum row sum) and 00039 * normF denotes the Frobenius norm of a matrix (square root of sum of 00040 * squares). Note that max(abs(A(i,j))) is not a consistent matrix norm. 00041 * 00042 * Arguments 00043 * ========= 00044 * 00045 * NORM (input) CHARACTER*1 00046 * Specifies the value to be returned in ZLANHS as described 00047 * above. 00048 * 00049 * N (input) INTEGER 00050 * The order of the matrix A. N >= 0. When N = 0, ZLANHS is 00051 * set to zero. 00052 * 00053 * A (input) COMPLEX*16 array, dimension (LDA,N) 00054 * The n by n upper Hessenberg matrix A; the part of A below the 00055 * first sub-diagonal is not referenced. 00056 * 00057 * LDA (input) INTEGER 00058 * The leading dimension of the array A. LDA >= max(N,1). 00059 * 00060 * WORK (workspace) DOUBLE PRECISION array, dimension (MAX(1,LWORK)), 00061 * where LWORK >= N when NORM = 'I'; otherwise, WORK is not 00062 * referenced. 00063 * 00064 * ===================================================================== 00065 * 00066 * .. Parameters .. 00067 DOUBLE PRECISION ONE, ZERO 00068 PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 ) 00069 * .. 00070 * .. Local Scalars .. 00071 INTEGER I, J 00072 DOUBLE PRECISION SCALE, SUM, VALUE 00073 * .. 00074 * .. External Functions .. 00075 LOGICAL LSAME 00076 EXTERNAL LSAME 00077 * .. 00078 * .. External Subroutines .. 00079 EXTERNAL ZLASSQ 00080 * .. 00081 * .. Intrinsic Functions .. 00082 INTRINSIC ABS, MAX, MIN, SQRT 00083 * .. 00084 * .. Executable Statements .. 00085 * 00086 IF( N.EQ.0 ) THEN 00087 VALUE = ZERO 00088 ELSE IF( LSAME( NORM, 'M' ) ) THEN 00089 * 00090 * Find max(abs(A(i,j))). 00091 * 00092 VALUE = ZERO 00093 DO 20 J = 1, N 00094 DO 10 I = 1, MIN( N, J+1 ) 00095 VALUE = MAX( VALUE, ABS( A( I, J ) ) ) 00096 10 CONTINUE 00097 20 CONTINUE 00098 ELSE IF( ( LSAME( NORM, 'O' ) ) .OR. ( NORM.EQ.'1' ) ) THEN 00099 * 00100 * Find norm1(A). 00101 * 00102 VALUE = ZERO 00103 DO 40 J = 1, N 00104 SUM = ZERO 00105 DO 30 I = 1, MIN( N, J+1 ) 00106 SUM = SUM + ABS( A( I, J ) ) 00107 30 CONTINUE 00108 VALUE = MAX( VALUE, SUM ) 00109 40 CONTINUE 00110 ELSE IF( LSAME( NORM, 'I' ) ) THEN 00111 * 00112 * Find normI(A). 00113 * 00114 DO 50 I = 1, N 00115 WORK( I ) = ZERO 00116 50 CONTINUE 00117 DO 70 J = 1, N 00118 DO 60 I = 1, MIN( N, J+1 ) 00119 WORK( I ) = WORK( I ) + ABS( A( I, J ) ) 00120 60 CONTINUE 00121 70 CONTINUE 00122 VALUE = ZERO 00123 DO 80 I = 1, N 00124 VALUE = MAX( VALUE, WORK( I ) ) 00125 80 CONTINUE 00126 ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN 00127 * 00128 * Find normF(A). 00129 * 00130 SCALE = ZERO 00131 SUM = ONE 00132 DO 90 J = 1, N 00133 CALL ZLASSQ( MIN( N, J+1 ), A( 1, J ), 1, SCALE, SUM ) 00134 90 CONTINUE 00135 VALUE = SCALE*SQRT( SUM ) 00136 END IF 00137 * 00138 ZLANHS = VALUE 00139 RETURN 00140 * 00141 * End of ZLANHS 00142 * 00143 END