LAPACK 3.12.1
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches
zlantp.f
Go to the documentation of this file.
1*> \brief \b ZLANTP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm, or the element of largest absolute value of a triangular 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 ZLANTP + dependencies
9*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.tgz?format=tgz&filename=/lapack/lapack_routine/zlantp.f">
10*> [TGZ]</a>
11*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.zip?format=zip&filename=/lapack/lapack_routine/zlantp.f">
12*> [ZIP]</a>
13*> <a href="http://www.netlib.org/cgi-bin/netlibfiles.txt?format=txt&filename=/lapack/lapack_routine/zlantp.f">
14*> [TXT]</a>
15*
16* Definition:
17* ===========
18*
19* DOUBLE PRECISION FUNCTION ZLANTP( NORM, UPLO, DIAG, N, AP, WORK )
20*
21* .. Scalar Arguments ..
22* CHARACTER DIAG, 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*> ZLANTP 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*> triangular matrix A, supplied in packed form.
39*> \endverbatim
40*>
41*> \return ZLANTP
42*> \verbatim
43*>
44*> ZLANTP = ( 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 ZLANTP as described
65*> above.
66*> \endverbatim
67*>
68*> \param[in] UPLO
69*> \verbatim
70*> UPLO is CHARACTER*1
71*> Specifies whether the matrix A is upper or lower triangular.
72*> = 'U': Upper triangular
73*> = 'L': Lower triangular
74*> \endverbatim
75*>
76*> \param[in] DIAG
77*> \verbatim
78*> DIAG is CHARACTER*1
79*> Specifies whether or not the matrix A is unit triangular.
80*> = 'N': Non-unit triangular
81*> = 'U': Unit triangular
82*> \endverbatim
83*>
84*> \param[in] N
85*> \verbatim
86*> N is INTEGER
87*> The order of the matrix A. N >= 0. When N = 0, ZLANTP is
88*> set to zero.
89*> \endverbatim
90*>
91*> \param[in] AP
92*> \verbatim
93*> AP is COMPLEX*16 array, dimension (N*(N+1)/2)
94*> The upper or lower triangular matrix A, packed columnwise in
95*> a linear array. The j-th column of A is stored in the array
96*> AP as follows:
97*> if UPLO = 'U', AP(i + (j-1)*j/2) = A(i,j) for 1<=i<=j;
98*> if UPLO = 'L', AP(i + (j-1)*(2n-j)/2) = A(i,j) for j<=i<=n.
99*> Note that when DIAG = 'U', the elements of the array AP
100*> corresponding to the diagonal elements of the matrix A are
101*> not referenced, but are assumed to be one.
102*> \endverbatim
103*>
104*> \param[out] WORK
105*> \verbatim
106*> WORK is DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
107*> where LWORK >= N when NORM = 'I'; otherwise, WORK is not
108*> referenced.
109*> \endverbatim
110*
111* Authors:
112* ========
113*
114*> \author Univ. of Tennessee
115*> \author Univ. of California Berkeley
116*> \author Univ. of Colorado Denver
117*> \author NAG Ltd.
118*
119*> \ingroup lantp
120*
121* =====================================================================
122 DOUBLE PRECISION FUNCTION zlantp( NORM, UPLO, DIAG, N, AP,
123 $ WORK )
124*
125* -- LAPACK auxiliary routine --
126* -- LAPACK is a software package provided by Univ. of Tennessee, --
127* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
128*
129* .. Scalar Arguments ..
130 CHARACTER diag, norm, uplo
131 INTEGER n
132* ..
133* .. Array Arguments ..
134 DOUBLE PRECISION work( * )
135 COMPLEX*16 ap( * )
136* ..
137*
138* =====================================================================
139*
140* .. Parameters ..
141 DOUBLE PRECISION one, zero
142 parameter( one = 1.0d+0, zero = 0.0d+0 )
143* ..
144* .. Local Scalars ..
145 LOGICAL udiag
146 INTEGER i, j, k
147 DOUBLE PRECISION scale, sum, value
148* ..
149* .. External Functions ..
150 LOGICAL lsame, disnan
151 EXTERNAL lsame, disnan
152* ..
153* .. External Subroutines ..
154 EXTERNAL zlassq
155* ..
156* .. Intrinsic Functions ..
157 INTRINSIC abs, sqrt
158* ..
159* .. Executable Statements ..
160*
161 IF( n.EQ.0 ) THEN
162 VALUE = zero
163 ELSE IF( lsame( norm, 'M' ) ) THEN
164*
165* Find max(abs(A(i,j))).
166*
167 k = 1
168 IF( lsame( diag, 'U' ) ) THEN
169 VALUE = one
170 IF( lsame( uplo, 'U' ) ) THEN
171 DO 20 j = 1, n
172 DO 10 i = k, k + j - 2
173 sum = abs( ap( i ) )
174 IF( VALUE .LT. sum .OR.
175 $ disnan( sum ) ) VALUE = sum
176 10 CONTINUE
177 k = k + j
178 20 CONTINUE
179 ELSE
180 DO 40 j = 1, n
181 DO 30 i = k + 1, k + n - j
182 sum = abs( ap( i ) )
183 IF( VALUE .LT. sum .OR.
184 $ disnan( sum ) ) VALUE = sum
185 30 CONTINUE
186 k = k + n - j + 1
187 40 CONTINUE
188 END IF
189 ELSE
190 VALUE = zero
191 IF( lsame( uplo, 'U' ) ) THEN
192 DO 60 j = 1, n
193 DO 50 i = k, k + j - 1
194 sum = abs( ap( i ) )
195 IF( VALUE .LT. sum .OR.
196 $ disnan( sum ) ) VALUE = sum
197 50 CONTINUE
198 k = k + j
199 60 CONTINUE
200 ELSE
201 DO 80 j = 1, n
202 DO 70 i = k, k + n - j
203 sum = abs( ap( i ) )
204 IF( VALUE .LT. sum .OR.
205 $ disnan( sum ) ) VALUE = sum
206 70 CONTINUE
207 k = k + n - j + 1
208 80 CONTINUE
209 END IF
210 END IF
211 ELSE IF( ( lsame( norm, 'O' ) ) .OR. ( norm.EQ.'1' ) ) THEN
212*
213* Find norm1(A).
214*
215 VALUE = zero
216 k = 1
217 udiag = lsame( diag, 'U' )
218 IF( lsame( uplo, 'U' ) ) THEN
219 DO 110 j = 1, n
220 IF( udiag ) THEN
221 sum = one
222 DO 90 i = k, k + j - 2
223 sum = sum + abs( ap( i ) )
224 90 CONTINUE
225 ELSE
226 sum = zero
227 DO 100 i = k, k + j - 1
228 sum = sum + abs( ap( i ) )
229 100 CONTINUE
230 END IF
231 k = k + j
232 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
233 110 CONTINUE
234 ELSE
235 DO 140 j = 1, n
236 IF( udiag ) THEN
237 sum = one
238 DO 120 i = k + 1, k + n - j
239 sum = sum + abs( ap( i ) )
240 120 CONTINUE
241 ELSE
242 sum = zero
243 DO 130 i = k, k + n - j
244 sum = sum + abs( ap( i ) )
245 130 CONTINUE
246 END IF
247 k = k + n - j + 1
248 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
249 140 CONTINUE
250 END IF
251 ELSE IF( lsame( norm, 'I' ) ) THEN
252*
253* Find normI(A).
254*
255 k = 1
256 IF( lsame( uplo, 'U' ) ) THEN
257 IF( lsame( diag, 'U' ) ) THEN
258 DO 150 i = 1, n
259 work( i ) = one
260 150 CONTINUE
261 DO 170 j = 1, n
262 DO 160 i = 1, j - 1
263 work( i ) = work( i ) + abs( ap( k ) )
264 k = k + 1
265 160 CONTINUE
266 k = k + 1
267 170 CONTINUE
268 ELSE
269 DO 180 i = 1, n
270 work( i ) = zero
271 180 CONTINUE
272 DO 200 j = 1, n
273 DO 190 i = 1, j
274 work( i ) = work( i ) + abs( ap( k ) )
275 k = k + 1
276 190 CONTINUE
277 200 CONTINUE
278 END IF
279 ELSE
280 IF( lsame( diag, 'U' ) ) THEN
281 DO 210 i = 1, n
282 work( i ) = one
283 210 CONTINUE
284 DO 230 j = 1, n
285 k = k + 1
286 DO 220 i = j + 1, n
287 work( i ) = work( i ) + abs( ap( k ) )
288 k = k + 1
289 220 CONTINUE
290 230 CONTINUE
291 ELSE
292 DO 240 i = 1, n
293 work( i ) = zero
294 240 CONTINUE
295 DO 260 j = 1, n
296 DO 250 i = j, n
297 work( i ) = work( i ) + abs( ap( k ) )
298 k = k + 1
299 250 CONTINUE
300 260 CONTINUE
301 END IF
302 END IF
303 VALUE = zero
304 DO 270 i = 1, n
305 sum = work( i )
306 IF( VALUE .LT. sum .OR. disnan( sum ) ) VALUE = sum
307 270 CONTINUE
308 ELSE IF( ( lsame( norm, 'F' ) ) .OR.
309 $ ( lsame( norm, 'E' ) ) ) THEN
310*
311* Find normF(A).
312*
313 IF( lsame( uplo, 'U' ) ) THEN
314 IF( lsame( diag, 'U' ) ) THEN
315 scale = one
316 sum = n
317 k = 2
318 DO 280 j = 2, n
319 CALL zlassq( j-1, ap( k ), 1, scale, sum )
320 k = k + j
321 280 CONTINUE
322 ELSE
323 scale = zero
324 sum = one
325 k = 1
326 DO 290 j = 1, n
327 CALL zlassq( j, ap( k ), 1, scale, sum )
328 k = k + j
329 290 CONTINUE
330 END IF
331 ELSE
332 IF( lsame( diag, 'U' ) ) THEN
333 scale = one
334 sum = n
335 k = 2
336 DO 300 j = 1, n - 1
337 CALL zlassq( n-j, ap( k ), 1, scale, sum )
338 k = k + n - j + 1
339 300 CONTINUE
340 ELSE
341 scale = zero
342 sum = one
343 k = 1
344 DO 310 j = 1, n
345 CALL zlassq( n-j+1, ap( k ), 1, scale, sum )
346 k = k + n - j + 1
347 310 CONTINUE
348 END IF
349 END IF
350 VALUE = scale*sqrt( sum )
351 END IF
352*
353 zlantp = VALUE
354 RETURN
355*
356* End of ZLANTP
357*
358 END
logical function disnan(din)
DISNAN tests input for NaN.
Definition disnan.f:57
double precision function zlantp(norm, uplo, diag, n, ap, work)
ZLANTP returns the value of the 1-norm, or the Frobenius norm, or the infinity norm,...
Definition zlantp.f:124
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