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