![]() |
LAPACK
3.4.1
LAPACK: Linear Algebra PACKage
|
00001 *> \brief \b SLANGB 00002 * 00003 * =========== DOCUMENTATION =========== 00004 * 00005 * Online html documentation available at 00006 * http://www.netlib.org/lapack/explore-html/ 00007 * 00008 *> \htmlonly 00009 *> Download SLANGB + dependencies 00010 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/slangb.f"> 00011 *> [TGZ]</a> 00012 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/slangb.f"> 00013 *> [ZIP]</a> 00014 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/slangb.f"> 00015 *> [TXT]</a> 00016 *> \endhtmlonly 00017 * 00018 * Definition: 00019 * =========== 00020 * 00021 * REAL FUNCTION SLANGB( NORM, N, KL, KU, AB, LDAB, 00022 * WORK ) 00023 * 00024 * .. Scalar Arguments .. 00025 * CHARACTER NORM 00026 * INTEGER KL, KU, LDAB, N 00027 * .. 00028 * .. Array Arguments .. 00029 * REAL AB( LDAB, * ), WORK( * ) 00030 * .. 00031 * 00032 * 00033 *> \par Purpose: 00034 * ============= 00035 *> 00036 *> \verbatim 00037 *> 00038 *> SLANGB returns the value of the one norm, or the Frobenius norm, or 00039 *> the infinity norm, or the element of largest absolute value of an 00040 *> n by n band matrix A, with kl sub-diagonals and ku super-diagonals. 00041 *> \endverbatim 00042 *> 00043 *> \return SLANGB 00044 *> \verbatim 00045 *> 00046 *> SLANGB = ( max(abs(A(i,j))), NORM = 'M' or 'm' 00047 *> ( 00048 *> ( norm1(A), NORM = '1', 'O' or 'o' 00049 *> ( 00050 *> ( normI(A), NORM = 'I' or 'i' 00051 *> ( 00052 *> ( normF(A), NORM = 'F', 'f', 'E' or 'e' 00053 *> 00054 *> where norm1 denotes the one norm of a matrix (maximum column sum), 00055 *> normI denotes the infinity norm of a matrix (maximum row sum) and 00056 *> normF denotes the Frobenius norm of a matrix (square root of sum of 00057 *> squares). Note that max(abs(A(i,j))) is not a consistent matrix norm. 00058 *> \endverbatim 00059 * 00060 * Arguments: 00061 * ========== 00062 * 00063 *> \param[in] NORM 00064 *> \verbatim 00065 *> NORM is CHARACTER*1 00066 *> Specifies the value to be returned in SLANGB as described 00067 *> above. 00068 *> \endverbatim 00069 *> 00070 *> \param[in] N 00071 *> \verbatim 00072 *> N is INTEGER 00073 *> The order of the matrix A. N >= 0. When N = 0, SLANGB is 00074 *> set to zero. 00075 *> \endverbatim 00076 *> 00077 *> \param[in] KL 00078 *> \verbatim 00079 *> KL is INTEGER 00080 *> The number of sub-diagonals of the matrix A. KL >= 0. 00081 *> \endverbatim 00082 *> 00083 *> \param[in] KU 00084 *> \verbatim 00085 *> KU is INTEGER 00086 *> The number of super-diagonals of the matrix A. KU >= 0. 00087 *> \endverbatim 00088 *> 00089 *> \param[in] AB 00090 *> \verbatim 00091 *> AB is REAL array, dimension (LDAB,N) 00092 *> The band matrix A, stored in rows 1 to KL+KU+1. The j-th 00093 *> column of A is stored in the j-th column of the array AB as 00094 *> follows: 00095 *> AB(ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(n,j+kl). 00096 *> \endverbatim 00097 *> 00098 *> \param[in] LDAB 00099 *> \verbatim 00100 *> LDAB is INTEGER 00101 *> The leading dimension of the array AB. LDAB >= KL+KU+1. 00102 *> \endverbatim 00103 *> 00104 *> \param[out] WORK 00105 *> \verbatim 00106 *> WORK is REAL array, dimension (MAX(1,LWORK)), 00107 *> where LWORK >= N when NORM = 'I'; otherwise, WORK is not 00108 *> referenced. 00109 *> \endverbatim 00110 * 00111 * Authors: 00112 * ======== 00113 * 00114 *> \author Univ. of Tennessee 00115 *> \author Univ. of California Berkeley 00116 *> \author Univ. of Colorado Denver 00117 *> \author NAG Ltd. 00118 * 00119 *> \date November 2011 00120 * 00121 *> \ingroup realGBauxiliary 00122 * 00123 * ===================================================================== 00124 REAL FUNCTION SLANGB( NORM, N, KL, KU, AB, LDAB, 00125 $ WORK ) 00126 * 00127 * -- LAPACK auxiliary routine (version 3.4.0) -- 00128 * -- LAPACK is a software package provided by Univ. of Tennessee, -- 00129 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..-- 00130 * November 2011 00131 * 00132 * .. Scalar Arguments .. 00133 CHARACTER NORM 00134 INTEGER KL, KU, LDAB, N 00135 * .. 00136 * .. Array Arguments .. 00137 REAL AB( LDAB, * ), WORK( * ) 00138 * .. 00139 * 00140 * ===================================================================== 00141 * 00142 * 00143 * .. Parameters .. 00144 REAL ONE, ZERO 00145 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 ) 00146 * .. 00147 * .. Local Scalars .. 00148 INTEGER I, J, K, L 00149 REAL SCALE, SUM, VALUE 00150 * .. 00151 * .. External Subroutines .. 00152 EXTERNAL SLASSQ 00153 * .. 00154 * .. External Functions .. 00155 LOGICAL LSAME 00156 EXTERNAL LSAME 00157 * .. 00158 * .. Intrinsic Functions .. 00159 INTRINSIC ABS, MAX, MIN, SQRT 00160 * .. 00161 * .. Executable Statements .. 00162 * 00163 IF( N.EQ.0 ) THEN 00164 VALUE = ZERO 00165 ELSE IF( LSAME( NORM, 'M' ) ) THEN 00166 * 00167 * Find max(abs(A(i,j))). 00168 * 00169 VALUE = ZERO 00170 DO 20 J = 1, N 00171 DO 10 I = MAX( KU+2-J, 1 ), MIN( N+KU+1-J, KL+KU+1 ) 00172 VALUE = MAX( VALUE, ABS( AB( I, J ) ) ) 00173 10 CONTINUE 00174 20 CONTINUE 00175 ELSE IF( ( LSAME( NORM, 'O' ) ) .OR. ( NORM.EQ.'1' ) ) THEN 00176 * 00177 * Find norm1(A). 00178 * 00179 VALUE = ZERO 00180 DO 40 J = 1, N 00181 SUM = ZERO 00182 DO 30 I = MAX( KU+2-J, 1 ), MIN( N+KU+1-J, KL+KU+1 ) 00183 SUM = SUM + ABS( AB( I, J ) ) 00184 30 CONTINUE 00185 VALUE = MAX( VALUE, SUM ) 00186 40 CONTINUE 00187 ELSE IF( LSAME( NORM, 'I' ) ) THEN 00188 * 00189 * Find normI(A). 00190 * 00191 DO 50 I = 1, N 00192 WORK( I ) = ZERO 00193 50 CONTINUE 00194 DO 70 J = 1, N 00195 K = KU + 1 - J 00196 DO 60 I = MAX( 1, J-KU ), MIN( N, J+KL ) 00197 WORK( I ) = WORK( I ) + ABS( AB( K+I, J ) ) 00198 60 CONTINUE 00199 70 CONTINUE 00200 VALUE = ZERO 00201 DO 80 I = 1, N 00202 VALUE = MAX( VALUE, WORK( I ) ) 00203 80 CONTINUE 00204 ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN 00205 * 00206 * Find normF(A). 00207 * 00208 SCALE = ZERO 00209 SUM = ONE 00210 DO 90 J = 1, N 00211 L = MAX( 1, J-KU ) 00212 K = KU + 1 - J + L 00213 CALL SLASSQ( MIN( N, J+KL )-L+1, AB( K, J ), 1, SCALE, SUM ) 00214 90 CONTINUE 00215 VALUE = SCALE*SQRT( SUM ) 00216 END IF 00217 * 00218 SLANGB = VALUE 00219 RETURN 00220 * 00221 * End of SLANGB 00222 * 00223 END