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