LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zlanhe.f
Go to the documentation of this file.
1*> \brief \b ZLANHE 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.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ZLANHE + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlanhe.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlanhe.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlanhe.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* DOUBLE PRECISION FUNCTION ZLANHE( NORM, UPLO, N, A, LDA, WORK )
20*
21* .. Scalar Arguments ..
22* CHARACTER NORM, UPLO
23* INTEGER LDA, N
24* ..
25* .. Array Arguments ..
26* DOUBLE PRECISION WORK( * )
27* COMPLEX*16 A( LDA, * )
28* ..
29*
30*
31*> \par Purpose:
32* =============
33*>
34*> \verbatim
35*>
36*> ZLANHE returns the value of the one norm, or the Frobenius norm, or
37*> the infinity norm, or the element of largest absolute value of a
38*> complex hermitian matrix A.
39*> \endverbatim
40*>
41*> \return ZLANHE
42*> \verbatim
43*>
44*> ZLANHE = ( max(abs(A(i,j))), NORM = 'M' or 'm'
45*> (
46*> ( norm1(A), NORM = '1', 'O' or 'o'
47*> (
48*> ( normI(A), NORM = 'I' or 'i'
49*> (
50*> ( normF(A), NORM = 'F', 'f', 'E' or 'e'
51*>
52*> where norm1 denotes the one norm of a matrix (maximum column sum),
53*> normI denotes the infinity norm of a matrix (maximum row sum) and
54*> normF denotes the Frobenius norm of a matrix (square root of sum of
55*> squares). Note that max(abs(A(i,j))) is not a consistent matrix norm.
56*> \endverbatim
57*
58* Arguments:
59* ==========
60*
61*> \param[in] NORM
62*> \verbatim
63*> NORM is CHARACTER*1
64*> Specifies the value to be returned in ZLANHE as described
65*> above.
66*> \endverbatim
67*>
68*> \param[in] UPLO
69*> \verbatim
70*> UPLO is CHARACTER*1
71*> Specifies whether the upper or lower triangular part of the
72*> hermitian matrix A is to be referenced.
73*> = 'U': Upper triangular part of A is referenced
74*> = 'L': Lower triangular part of A is referenced
75*> \endverbatim
76*>
77*> \param[in] N
78*> \verbatim
79*> N is INTEGER
80*> The order of the matrix A. N >= 0. When N = 0, ZLANHE is
81*> set to zero.
82*> \endverbatim
83*>
84*> \param[in] A
85*> \verbatim
86*> A is COMPLEX*16 array, dimension (LDA,N)
87*> The hermitian matrix A. If UPLO = 'U', the leading n by n
88*> upper triangular part of A contains the upper triangular part
89*> of the matrix A, and the strictly lower triangular part of A
90*> is not referenced. If UPLO = 'L', the leading n by n lower
91*> triangular part of A contains the lower triangular part of
92*> the matrix A, and the strictly upper triangular part of A is
93*> not referenced. Note that the imaginary parts of the diagonal
94*> elements need not be set and are assumed to be zero.
95*> \endverbatim
96*>
97*> \param[in] LDA
98*> \verbatim
99*> LDA is INTEGER
100*> The leading dimension of the array A. LDA >= max(N,1).
101*> \endverbatim
102*>
103*> \param[out] WORK
104*> \verbatim
105*> WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
106*> where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
107*> WORK is not referenced.
108*> \endverbatim
109*
110* Authors:
111* ========
112*
113*> \author Univ. of Tennessee
114*> \author Univ. of California Berkeley
115*> \author Univ. of Colorado Denver
116*> \author NAG Ltd.
117*
118*> \ingroup lanhe
119*
120* =====================================================================
121 DOUBLE PRECISION FUNCTION zlanhe( NORM, UPLO, N, A, LDA, WORK )
122*
123* -- LAPACK auxiliary routine --
124* -- LAPACK is a software package provided by Univ. of Tennessee, --
125* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
126*
127* .. Scalar Arguments ..
128 CHARACTER norm, uplo
129 INTEGER lda, n
130* ..
131* .. Array Arguments ..
132 DOUBLE PRECISION work( * )
133 COMPLEX*16 a( lda, * )
134* ..
135*
136* =====================================================================
137*
138* .. Parameters ..
139 DOUBLE PRECISION one, zero
140 parameter( one = 1.0d+0, zero = 0.0d+0 )
141* ..
142* .. Local Scalars ..
143 INTEGER i, j
144 DOUBLE PRECISION absa, scale, sum, value
145* ..
146* .. External Functions ..
147 LOGICAL lsame, disnan
148 EXTERNAL lsame, disnan
149* ..
150* .. External Subroutines ..
151 EXTERNAL zlassq
152* ..
153* .. Intrinsic Functions ..
154 INTRINSIC abs, dble, sqrt
155* ..
156* .. Executable Statements ..
157*
158 IF( n.EQ.0 ) THEN
159 VALUE = zero
160 ELSE IF( lsame( norm, 'M' ) ) THEN
161*
162* Find max(abs(A(i,j))).
163*
164 VALUE = zero
165 IF( lsame( uplo, 'U' ) ) THEN
166 DO 20 j = 1, n
167 DO 10 i = 1, j - 1
168 sum = abs( a( i, j ) )
169 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
170 10 CONTINUE
171 sum = abs( dble( a( j, j ) ) )
172 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
173 20 CONTINUE
174 ELSE
175 DO 40 j = 1, n
176 sum = abs( dble( a( j, j ) ) )
177 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
178 DO 30 i = j + 1, n
179 sum = abs( a( i, j ) )
180 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
181 30 CONTINUE
182 40 CONTINUE
183 END IF
184 ELSE IF( ( lsame( norm, 'I' ) ) .OR.
185 $ ( lsame( norm, 'O' ) ) .OR.
186 $ ( norm.EQ.'1' ) ) THEN
187*
188* Find normI(A) ( = norm1(A), since A is hermitian).
189*
190 VALUE = zero
191 IF( lsame( uplo, 'U' ) ) THEN
192 DO 60 j = 1, n
193 sum = zero
194 DO 50 i = 1, j - 1
195 absa = abs( a( i, j ) )
196 sum = sum + absa
197 work( i ) = work( i ) + absa
198 50 CONTINUE
199 work( j ) = sum + abs( dble( a( j, j ) ) )
200 60 CONTINUE
201 DO 70 i = 1, n
202 sum = work( i )
203 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
204 70 CONTINUE
205 ELSE
206 DO 80 i = 1, n
207 work( i ) = zero
208 80 CONTINUE
209 DO 100 j = 1, n
210 sum = work( j ) + abs( dble( a( j, j ) ) )
211 DO 90 i = j + 1, n
212 absa = abs( a( i, j ) )
213 sum = sum + absa
214 work( i ) = work( i ) + absa
215 90 CONTINUE
216 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
217 100 CONTINUE
218 END IF
219 ELSE IF( ( lsame( norm, 'F' ) ) .OR.
220 $ ( lsame( norm, 'E' ) ) ) THEN
221*
222* Find normF(A).
223*
224 scale = zero
225 sum = one
226 IF( lsame( uplo, 'U' ) ) THEN
227 DO 110 j = 2, n
228 CALL zlassq( j-1, a( 1, j ), 1, scale, sum )
229 110 CONTINUE
230 ELSE
231 DO 120 j = 1, n - 1
232 CALL zlassq( n-j, a( j+1, j ), 1, scale, sum )
233 120 CONTINUE
234 END IF
235 sum = 2*sum
236 DO 130 i = 1, n
237 IF( dble( a( i, i ) ).NE.zero ) THEN
238 absa = abs( dble( a( i, i ) ) )
239 IF( scale.LT.absa ) THEN
240 sum = one + sum*( scale / absa )**2
241 scale = absa
242 ELSE
243 sum = sum + ( absa / scale )**2
244 END IF
245 END IF
246 130 CONTINUE
247 VALUE = scale*sqrt( sum )
248 END IF
249*
250 zlanhe = VALUE
251 RETURN
252*
253* End of ZLANHE
254*
255 END
logical function disnan(din)
DISNAN tests input for NaN.
Definition disnan.f:57
double precision function zlanhe(norm, uplo, n, a, lda, work)
ZLANHE returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition zlanhe.f:122
subroutine zlassq(n, x, incx, scale, sumsq)
ZLASSQ updates a sum of squares represented in scaled form.
Definition zlassq.f90:122
logical function lsame(ca, cb)
LSAME
Definition lsame.f:48