LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
zlanhp.f
Go to the documentation of this file.
1*> \brief \b ZLANHP 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 supplied in packed form.
2*
3* =========== DOCUMENTATION ===========
4*
5* Online html documentation available at
6* http://www.netlib.org/lapack/explore-html/
7*
8*> Download ZLANHP + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlanhp.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlanhp.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlanhp.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* DOUBLE PRECISION FUNCTION ZLANHP( NORM, UPLO, N, AP, WORK )
20*
21* .. Scalar Arguments ..
22* CHARACTER NORM, UPLO
23* INTEGER N
24* ..
25* .. Array Arguments ..
26* DOUBLE PRECISION WORK( * )
27* COMPLEX*16 AP( * )
28* ..
29*
30*
31*> \par Purpose:
32* =============
33*>
34*> \verbatim
35*>
36*> ZLANHP 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, supplied in packed form.
39*> \endverbatim
40*>
41*> \return ZLANHP
42*> \verbatim
43*>
44*> ZLANHP = ( 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 ZLANHP 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 supplied.
73*> = 'U': Upper triangular part of A is supplied
74*> = 'L': Lower triangular part of A is supplied
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, ZLANHP is
81*> set to zero.
82*> \endverbatim
83*>
84*> \param[in] AP
85*> \verbatim
86*> AP is COMPLEX*16 array, dimension (N*(N+1)/2)
87*> The upper or lower triangle of the hermitian matrix A, packed
88*> columnwise in a linear array. The j-th column of A is stored
89*> in the array AP as follows:
90*> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
91*> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
92*> Note that the imaginary parts of the diagonal elements need
93*> not be set and are assumed to be zero.
94*> \endverbatim
95*>
96*> \param[out] WORK
97*> \verbatim
98*> WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
99*> where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
100*> WORK is not referenced.
101*> \endverbatim
102*
103* Authors:
104* ========
105*
106*> \author Univ. of Tennessee
107*> \author Univ. of California Berkeley
108*> \author Univ. of Colorado Denver
109*> \author NAG Ltd.
110*
111*> \ingroup lanhp
112*
113* =====================================================================
114 DOUBLE PRECISION FUNCTION zlanhp( NORM, UPLO, N, AP, WORK )
115*
116* -- LAPACK auxiliary routine --
117* -- LAPACK is a software package provided by Univ. of Tennessee, --
118* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
119*
120* .. Scalar Arguments ..
121 CHARACTER norm, uplo
122 INTEGER n
123* ..
124* .. Array Arguments ..
125 DOUBLE PRECISION work( * )
126 COMPLEX*16 ap( * )
127* ..
128*
129* =====================================================================
130*
131* .. Parameters ..
132 DOUBLE PRECISION one, zero
133 parameter( one = 1.0d+0, zero = 0.0d+0 )
134* ..
135* .. Local Scalars ..
136 INTEGER i, j, k
137 DOUBLE PRECISION absa, scale, sum, value
138* ..
139* .. External Functions ..
140 LOGICAL lsame, disnan
141 EXTERNAL lsame, disnan
142* ..
143* .. External Subroutines ..
144 EXTERNAL zlassq
145* ..
146* .. Intrinsic Functions ..
147 INTRINSIC abs, dble, sqrt
148* ..
149* .. Executable Statements ..
150*
151 IF( n.EQ.0 ) THEN
152 VALUE = zero
153 ELSE IF( lsame( norm, 'M' ) ) THEN
154*
155* Find max(abs(A(i,j))).
156*
157 VALUE = zero
158 IF( lsame( uplo, 'U' ) ) THEN
159 k = 0
160 DO 20 j = 1, n
161 DO 10 i = k + 1, k + j - 1
162 sum = abs( ap( i ) )
163 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
164 10 CONTINUE
165 k = k + j
166 sum = abs( dble( ap( k ) ) )
167 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
168 20 CONTINUE
169 ELSE
170 k = 1
171 DO 40 j = 1, n
172 sum = abs( dble( ap( k ) ) )
173 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
174 DO 30 i = k + 1, k + n - j
175 sum = abs( ap( i ) )
176 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
177 30 CONTINUE
178 k = k + n - j + 1
179 40 CONTINUE
180 END IF
181 ELSE IF( ( lsame( norm, 'I' ) ) .OR.
182 $ ( lsame( norm, 'O' ) ) .OR.
183 $ ( norm.EQ.'1' ) ) THEN
184*
185* Find normI(A) ( = norm1(A), since A is hermitian).
186*
187 VALUE = zero
188 k = 1
189 IF( lsame( uplo, 'U' ) ) THEN
190 DO 60 j = 1, n
191 sum = zero
192 DO 50 i = 1, j - 1
193 absa = abs( ap( k ) )
194 sum = sum + absa
195 work( i ) = work( i ) + absa
196 k = k + 1
197 50 CONTINUE
198 work( j ) = sum + abs( dble( ap( k ) ) )
199 k = k + 1
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( ap( k ) ) )
211 k = k + 1
212 DO 90 i = j + 1, n
213 absa = abs( ap( k ) )
214 sum = sum + absa
215 work( i ) = work( i ) + absa
216 k = k + 1
217 90 CONTINUE
218 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
219 100 CONTINUE
220 END IF
221 ELSE IF( ( lsame( norm, 'F' ) ) .OR.
222 $ ( lsame( norm, 'E' ) ) ) THEN
223*
224* Find normF(A).
225*
226 scale = zero
227 sum = one
228 k = 2
229 IF( lsame( uplo, 'U' ) ) THEN
230 DO 110 j = 2, n
231 CALL zlassq( j-1, ap( k ), 1, scale, sum )
232 k = k + j
233 110 CONTINUE
234 ELSE
235 DO 120 j = 1, n - 1
236 CALL zlassq( n-j, ap( k ), 1, scale, sum )
237 k = k + n - j + 1
238 120 CONTINUE
239 END IF
240 sum = 2*sum
241 k = 1
242 DO 130 i = 1, n
243 IF( dble( ap( k ) ).NE.zero ) THEN
244 absa = abs( dble( ap( k ) ) )
245 IF( scale.LT.absa ) THEN
246 sum = one + sum*( scale / absa )**2
247 scale = absa
248 ELSE
249 sum = sum + ( absa / scale )**2
250 END IF
251 END IF
252 IF( lsame( uplo, 'U' ) ) THEN
253 k = k + i + 1
254 ELSE
255 k = k + n - i + 1
256 END IF
257 130 CONTINUE
258 VALUE = scale*sqrt( sum )
259 END IF
260*
261 zlanhp = VALUE
262 RETURN
263*
264* End of ZLANHP
265*
266 END
logical function disnan(din)
DISNAN tests input for NaN.
Definition disnan.f:57
double precision function zlanhp(norm, uplo, n, ap, work)
ZLANHP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition zlanhp.f:115
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