1 *> \brief \b CLANHE returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a complex Hermitian matrix.
3 * =========== DOCUMENTATION ===========
5 * Online html documentation available at
6 * http://www.netlib.org/lapack/explore-html/
9 *> Download CLANHE + dependencies
10 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/clanhe.f">
12 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/clanhe.f">
14 *> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/clanhe.f">
21 * REAL FUNCTION CLANHE( NORM, UPLO, N, A, LDA, WORK )
23 * .. Scalar Arguments ..
24 * CHARACTER NORM, UPLO
27 * .. Array Arguments ..
38 *> CLANHE returns the value of the one norm, or the Frobenius norm, or
39 *> the infinity norm, or the element of largest absolute value of a
40 *> complex hermitian matrix A.
46 *> CLANHE = ( max(abs(A(i,j))), NORM = 'M' or 'm'
48 *> ( norm1(A), NORM = '1', 'O' or 'o'
50 *> ( normI(A), NORM = 'I' or 'i'
52 *> ( normF(A), NORM = 'F', 'f', 'E' or 'e'
54 *> where norm1 denotes the one norm of a matrix (maximum column sum),
55 *> normI denotes the infinity norm of a matrix (maximum row sum) and
56 *> normF denotes the Frobenius norm of a matrix (square root of sum of
57 *> squares). Note that max(abs(A(i,j))) is not a consistent matrix norm.
65 *> NORM is CHARACTER*1
66 *> Specifies the value to be returned in CLANHE as described
72 *> UPLO is CHARACTER*1
73 *> Specifies whether the upper or lower triangular part of the
74 *> hermitian matrix A is to be referenced.
75 *> = 'U': Upper triangular part of A is referenced
76 *> = 'L': Lower triangular part of A is referenced
82 *> The order of the matrix A. N >= 0. When N = 0, CLANHE is
88 *> A is COMPLEX array, dimension (LDA,N)
89 *> The hermitian matrix A. If UPLO = 'U', the leading n by n
90 *> upper triangular part of A contains the upper triangular part
91 *> of the matrix A, and the strictly lower triangular part of A
92 *> is not referenced. If UPLO = 'L', the leading n by n lower
93 *> triangular part of A contains the lower triangular part of
94 *> the matrix A, and the strictly upper triangular part of A is
95 *> not referenced. Note that the imaginary parts of the diagonal
96 *> elements need not be set and are assumed to be zero.
102 *> The leading dimension of the array A. LDA >= max(N,1).
107 *> WORK is REAL array, dimension (MAX(1,LWORK)),
108 *> where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
109 *> WORK is not referenced.
115 *> \author Univ. of Tennessee
116 *> \author Univ. of California Berkeley
117 *> \author Univ. of Colorado Denver
120 *> \date September 2012
122 *> \ingroup complexHEauxiliary
124 * =====================================================================
125 REAL FUNCTION CLANHE( NORM, UPLO, N, A, LDA, WORK )
127 * -- LAPACK auxiliary routine (version 3.4.2) --
128 * -- LAPACK is a software package provided by Univ. of Tennessee, --
129 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
132 * .. Scalar Arguments ..
136 * .. Array Arguments ..
141 * =====================================================================
145 PARAMETER ( ONE = 1.0E+0, ZERO = 0.0E+0 )
147 * .. Local Scalars ..
149 REAL ABSA, SCALE, SUM, VALUE
151 * .. External Functions ..
152 LOGICAL LSAME, SISNAN
153 EXTERNAL LSAME, SISNAN
155 * .. External Subroutines ..
158 * .. Intrinsic Functions ..
159 INTRINSIC ABS, REAL, SQRT
161 * .. Executable Statements ..
165 ELSE IF( LSAME( NORM, 'M' ) ) THEN
167 * Find max(abs(A(i,j))).
170 IF( LSAME( UPLO, 'U' ) ) THEN
173 SUM = ABS( A( I, J ) )
174 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
176 SUM = ABS( REAL( A( J, J ) ) )
177 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
181 SUM = ABS( REAL( A( J, J ) ) )
182 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
184 SUM = ABS( A( I, J ) )
185 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
189 ELSE IF( ( LSAME( NORM, 'I' ) ) .OR. ( LSAME( NORM, 'O' ) ) .OR.
190 $ ( NORM.EQ.'1' ) ) THEN
192 * Find normI(A) ( = norm1(A), since A is hermitian).
195 IF( LSAME( UPLO, 'U' ) ) THEN
199 ABSA = ABS( A( I, J ) )
201 WORK( I ) = WORK( I ) + ABSA
203 WORK( J ) = SUM + ABS( REAL( A( J, J ) ) )
207 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
214 SUM = WORK( J ) + ABS( REAL( A( J, J ) ) )
216 ABSA = ABS( A( I, J ) )
218 WORK( I ) = WORK( I ) + ABSA
220 IF( VALUE .LT. SUM .OR. SISNAN( SUM ) ) VALUE = SUM
223 ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
229 IF( LSAME( UPLO, 'U' ) ) THEN
231 CALL CLASSQ( J-1, A( 1, J ), 1, SCALE, SUM )
235 CALL CLASSQ( N-J, A( J+1, J ), 1, SCALE, SUM )
240 IF( REAL( A( I, I ) ).NE.ZERO ) THEN
241 ABSA = ABS( REAL( A( I, I ) ) )
242 IF( SCALE.LT.ABSA ) THEN
243 SUM = ONE + SUM*( SCALE / ABSA )**2
246 SUM = SUM + ( ABSA / SCALE )**2
250 VALUE = SCALE*SQRT( SUM )