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