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