Annotation of rpl/lapack/lapack/zlansy.f, revision 1.6
1.1 bertrand 1: DOUBLE PRECISION FUNCTION ZLANSY( NORM, UPLO, N, A, LDA, WORK )
2: *
3: * -- LAPACK auxiliary routine (version 3.2) --
4: * -- LAPACK is a software package provided by Univ. of Tennessee, --
5: * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
6: * November 2006
7: *
8: * .. Scalar Arguments ..
9: CHARACTER NORM, UPLO
10: INTEGER LDA, N
11: * ..
12: * .. Array Arguments ..
13: DOUBLE PRECISION WORK( * )
14: COMPLEX*16 A( LDA, * )
15: * ..
16: *
17: * Purpose
18: * =======
19: *
20: * ZLANSY returns the value of the one norm, or the Frobenius norm, or
21: * the infinity norm, or the element of largest absolute value of a
22: * complex symmetric matrix A.
23: *
24: * Description
25: * ===========
26: *
27: * ZLANSY returns the value
28: *
29: * ZLANSY = ( max(abs(A(i,j))), NORM = 'M' or 'm'
30: * (
31: * ( norm1(A), NORM = '1', 'O' or 'o'
32: * (
33: * ( normI(A), NORM = 'I' or 'i'
34: * (
35: * ( normF(A), NORM = 'F', 'f', 'E' or 'e'
36: *
37: * where norm1 denotes the one norm of a matrix (maximum column sum),
38: * normI denotes the infinity norm of a matrix (maximum row sum) and
39: * normF denotes the Frobenius norm of a matrix (square root of sum of
40: * squares). Note that max(abs(A(i,j))) is not a consistent matrix norm.
41: *
42: * Arguments
43: * =========
44: *
45: * NORM (input) CHARACTER*1
46: * Specifies the value to be returned in ZLANSY as described
47: * above.
48: *
49: * UPLO (input) CHARACTER*1
50: * Specifies whether the upper or lower triangular part of the
51: * symmetric matrix A is to be referenced.
52: * = 'U': Upper triangular part of A is referenced
53: * = 'L': Lower triangular part of A is referenced
54: *
55: * N (input) INTEGER
56: * The order of the matrix A. N >= 0. When N = 0, ZLANSY is
57: * set to zero.
58: *
59: * A (input) COMPLEX*16 array, dimension (LDA,N)
60: * The symmetric matrix A. If UPLO = 'U', the leading n by n
61: * upper triangular part of A contains the upper triangular part
62: * of the matrix A, and the strictly lower triangular part of A
63: * is not referenced. If UPLO = 'L', the leading n by n lower
64: * triangular part of A contains the lower triangular part of
65: * the matrix A, and the strictly upper triangular part of A is
66: * not referenced.
67: *
68: * LDA (input) INTEGER
69: * The leading dimension of the array A. LDA >= max(N,1).
70: *
71: * WORK (workspace) DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
72: * where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
73: * WORK is not referenced.
74: *
75: * =====================================================================
76: *
77: * .. Parameters ..
78: DOUBLE PRECISION ONE, ZERO
79: PARAMETER ( ONE = 1.0D+0, ZERO = 0.0D+0 )
80: * ..
81: * .. Local Scalars ..
82: INTEGER I, J
83: DOUBLE PRECISION ABSA, SCALE, SUM, VALUE
84: * ..
85: * .. External Functions ..
86: LOGICAL LSAME
87: EXTERNAL LSAME
88: * ..
89: * .. External Subroutines ..
90: EXTERNAL ZLASSQ
91: * ..
92: * .. Intrinsic Functions ..
93: INTRINSIC ABS, MAX, SQRT
94: * ..
95: * .. Executable Statements ..
96: *
97: IF( N.EQ.0 ) THEN
98: VALUE = ZERO
99: ELSE IF( LSAME( NORM, 'M' ) ) THEN
100: *
101: * Find max(abs(A(i,j))).
102: *
103: VALUE = ZERO
104: IF( LSAME( UPLO, 'U' ) ) THEN
105: DO 20 J = 1, N
106: DO 10 I = 1, J
107: VALUE = MAX( VALUE, ABS( A( I, J ) ) )
108: 10 CONTINUE
109: 20 CONTINUE
110: ELSE
111: DO 40 J = 1, N
112: DO 30 I = J, N
113: VALUE = MAX( VALUE, ABS( A( I, J ) ) )
114: 30 CONTINUE
115: 40 CONTINUE
116: END IF
117: ELSE IF( ( LSAME( NORM, 'I' ) ) .OR. ( LSAME( NORM, 'O' ) ) .OR.
118: $ ( NORM.EQ.'1' ) ) THEN
119: *
120: * Find normI(A) ( = norm1(A), since A is symmetric).
121: *
122: VALUE = ZERO
123: IF( LSAME( UPLO, 'U' ) ) THEN
124: DO 60 J = 1, N
125: SUM = ZERO
126: DO 50 I = 1, J - 1
127: ABSA = ABS( A( I, J ) )
128: SUM = SUM + ABSA
129: WORK( I ) = WORK( I ) + ABSA
130: 50 CONTINUE
131: WORK( J ) = SUM + ABS( A( J, J ) )
132: 60 CONTINUE
133: DO 70 I = 1, N
134: VALUE = MAX( VALUE, WORK( I ) )
135: 70 CONTINUE
136: ELSE
137: DO 80 I = 1, N
138: WORK( I ) = ZERO
139: 80 CONTINUE
140: DO 100 J = 1, N
141: SUM = WORK( J ) + ABS( A( J, J ) )
142: DO 90 I = J + 1, N
143: ABSA = ABS( A( I, J ) )
144: SUM = SUM + ABSA
145: WORK( I ) = WORK( I ) + ABSA
146: 90 CONTINUE
147: VALUE = MAX( VALUE, SUM )
148: 100 CONTINUE
149: END IF
150: ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
151: *
152: * Find normF(A).
153: *
154: SCALE = ZERO
155: SUM = ONE
156: IF( LSAME( UPLO, 'U' ) ) THEN
157: DO 110 J = 2, N
158: CALL ZLASSQ( J-1, A( 1, J ), 1, SCALE, SUM )
159: 110 CONTINUE
160: ELSE
161: DO 120 J = 1, N - 1
162: CALL ZLASSQ( N-J, A( J+1, J ), 1, SCALE, SUM )
163: 120 CONTINUE
164: END IF
165: SUM = 2*SUM
166: CALL ZLASSQ( N, A, LDA+1, SCALE, SUM )
167: VALUE = SCALE*SQRT( SUM )
168: END IF
169: *
170: ZLANSY = VALUE
171: RETURN
172: *
173: * End of ZLANSY
174: *
175: END
CVSweb interface <joel.bertrand@systella.fr>