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