```001:       DOUBLE PRECISION FUNCTION ZLANSY( NORM, UPLO, N, A, LDA, WORK )
002: *
003: *  -- LAPACK auxiliary routine (version 3.2) --
004: *     Univ. of Tennessee, Univ. of California Berkeley and NAG Ltd..
005: *     November 2006
006: *
007: *     .. Scalar Arguments ..
008:       CHARACTER          NORM, UPLO
009:       INTEGER            LDA, N
010: *     ..
011: *     .. Array Arguments ..
012:       DOUBLE PRECISION   WORK( * )
013:       COMPLEX*16         A( LDA, * )
014: *     ..
015: *
016: *  Purpose
017: *  =======
018: *
019: *  ZLANSY  returns the value of the one norm,  or the Frobenius norm, or
020: *  the  infinity norm,  or the  element of  largest absolute value  of a
021: *  complex symmetric matrix A.
022: *
023: *  Description
024: *  ===========
025: *
026: *  ZLANSY returns the value
027: *
028: *     ZLANSY = ( max(abs(A(i,j))), NORM = 'M' or 'm'
029: *              (
030: *              ( norm1(A),         NORM = '1', 'O' or 'o'
031: *              (
032: *              ( normI(A),         NORM = 'I' or 'i'
033: *              (
034: *              ( normF(A),         NORM = 'F', 'f', 'E' or 'e'
035: *
036: *  where  norm1  denotes the  one norm of a matrix (maximum column sum),
037: *  normI  denotes the  infinity norm  of a matrix  (maximum row sum) and
038: *  normF  denotes the  Frobenius norm of a matrix (square root of sum of
039: *  squares).  Note that  max(abs(A(i,j)))  is not a consistent matrix norm.
040: *
041: *  Arguments
042: *  =========
043: *
044: *  NORM    (input) CHARACTER*1
045: *          Specifies the value to be returned in ZLANSY as described
046: *          above.
047: *
048: *  UPLO    (input) CHARACTER*1
049: *          Specifies whether the upper or lower triangular part of the
050: *          symmetric matrix A is to be referenced.
051: *          = 'U':  Upper triangular part of A is referenced
052: *          = 'L':  Lower triangular part of A is referenced
053: *
054: *  N       (input) INTEGER
055: *          The order of the matrix A.  N >= 0.  When N = 0, ZLANSY is
056: *          set to zero.
057: *
058: *  A       (input) COMPLEX*16 array, dimension (LDA,N)
059: *          The symmetric matrix A.  If UPLO = 'U', the leading n by n
060: *          upper triangular part of A contains the upper triangular part
061: *          of the matrix A, and the strictly lower triangular part of A
062: *          is not referenced.  If UPLO = 'L', the leading n by n lower
063: *          triangular part of A contains the lower triangular part of
064: *          the matrix A, and the strictly upper triangular part of A is
065: *          not referenced.
066: *
067: *  LDA     (input) INTEGER
068: *          The leading dimension of the array A.  LDA >= max(N,1).
069: *
070: *  WORK    (workspace) DOUBLE PRECISION array, dimension (MAX(1,LWORK)),
071: *          where LWORK >= N when NORM = 'I' or '1' or 'O'; otherwise,
072: *          WORK is not referenced.
073: *
074: * =====================================================================
075: *
076: *     .. Parameters ..
077:       DOUBLE PRECISION   ONE, ZERO
078:       PARAMETER          ( ONE = 1.0D+0, ZERO = 0.0D+0 )
079: *     ..
080: *     .. Local Scalars ..
081:       INTEGER            I, J
082:       DOUBLE PRECISION   ABSA, SCALE, SUM, VALUE
083: *     ..
084: *     .. External Functions ..
085:       LOGICAL            LSAME
086:       EXTERNAL           LSAME
087: *     ..
088: *     .. External Subroutines ..
089:       EXTERNAL           ZLASSQ
090: *     ..
091: *     .. Intrinsic Functions ..
092:       INTRINSIC          ABS, MAX, SQRT
093: *     ..
094: *     .. Executable Statements ..
095: *
096:       IF( N.EQ.0 ) THEN
097:          VALUE = ZERO
098:       ELSE IF( LSAME( NORM, 'M' ) ) THEN
099: *
100: *        Find max(abs(A(i,j))).
101: *
102:          VALUE = ZERO
103:          IF( LSAME( UPLO, 'U' ) ) THEN
104:             DO 20 J = 1, N
105:                DO 10 I = 1, J
106:                   VALUE = MAX( VALUE, ABS( A( I, J ) ) )
107:    10          CONTINUE
108:    20       CONTINUE
109:          ELSE
110:             DO 40 J = 1, N
111:                DO 30 I = J, N
112:                   VALUE = MAX( VALUE, ABS( A( I, J ) ) )
113:    30          CONTINUE
114:    40       CONTINUE
115:          END IF
116:       ELSE IF( ( LSAME( NORM, 'I' ) ) .OR. ( LSAME( NORM, 'O' ) ) .OR.
117:      \$         ( NORM.EQ.'1' ) ) THEN
118: *
119: *        Find normI(A) ( = norm1(A), since A is symmetric).
120: *
121:          VALUE = ZERO
122:          IF( LSAME( UPLO, 'U' ) ) THEN
123:             DO 60 J = 1, N
124:                SUM = ZERO
125:                DO 50 I = 1, J - 1
126:                   ABSA = ABS( A( I, J ) )
127:                   SUM = SUM + ABSA
128:                   WORK( I ) = WORK( I ) + ABSA
129:    50          CONTINUE
130:                WORK( J ) = SUM + ABS( A( J, J ) )
131:    60       CONTINUE
132:             DO 70 I = 1, N
133:                VALUE = MAX( VALUE, WORK( I ) )
134:    70       CONTINUE
135:          ELSE
136:             DO 80 I = 1, N
137:                WORK( I ) = ZERO
138:    80       CONTINUE
139:             DO 100 J = 1, N
140:                SUM = WORK( J ) + ABS( A( J, J ) )
141:                DO 90 I = J + 1, N
142:                   ABSA = ABS( A( I, J ) )
143:                   SUM = SUM + ABSA
144:                   WORK( I ) = WORK( I ) + ABSA
145:    90          CONTINUE
146:                VALUE = MAX( VALUE, SUM )
147:   100       CONTINUE
148:          END IF
149:       ELSE IF( ( LSAME( NORM, 'F' ) ) .OR. ( LSAME( NORM, 'E' ) ) ) THEN
150: *
151: *        Find normF(A).
152: *
153:          SCALE = ZERO
154:          SUM = ONE
155:          IF( LSAME( UPLO, 'U' ) ) THEN
156:             DO 110 J = 2, N
157:                CALL ZLASSQ( J-1, A( 1, J ), 1, SCALE, SUM )
158:   110       CONTINUE
159:          ELSE
160:             DO 120 J = 1, N - 1
161:                CALL ZLASSQ( N-J, A( J+1, J ), 1, SCALE, SUM )
162:   120       CONTINUE
163:          END IF
164:          SUM = 2*SUM
165:          CALL ZLASSQ( N, A, LDA+1, SCALE, SUM )
166:          VALUE = SCALE*SQRT( SUM )
167:       END IF
168: *
169:       ZLANSY = VALUE
170:       RETURN
171: *
172: *     End of ZLANSY
173: *
174:       END
175: ```