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