1 SUBROUTINE ZSYMM
( SIDE
, UPLO
, M
, N
, ALPHA
, A
, LDA
, B
, LDB
,
3 * .. Scalar Arguments
..
5 INTEGER M
, N
, LDA
, LDB
, LDC
7 * .. Array Arguments
..
8 COMPLEX*16 A
( LDA
, * ), B
( LDB
, * ), C
( LDC
, * )
14 * ZSYMM performs one of the matrix
-matrix operations
16 * C
:= alpha*A*B
+ beta*C
,
20 * C
:= alpha*B*A
+ beta*C
,
22 * where alpha and beta are scalars
, A is a symmetric matrix and B and
23 * C are m by n matrices
.
29 * On entry
, SIDE specifies whether the symmetric matrix A
30 * appears on the left or right in the operation as follows
:
32 * SIDE
= 'L' or
'l' C
:= alpha*A*B
+ beta*C
,
34 * SIDE
= 'R' or
'r' C
:= alpha*B*A
+ beta*C
,
39 * On entry
, UPLO specifies whether the upper or lower
40 * triangular part of the symmetric matrix A is
to be
41 * referenced as follows
:
43 * UPLO
= 'U' or
'u' Only the upper triangular part of the
44 * symmetric matrix is
to be referenced
.
46 * UPLO
= 'L' or
'l' Only the lower triangular part of the
47 * symmetric matrix is
to be referenced
.
52 * On entry
, M specifies the number of rows of the matrix C
.
53 * M must be at least zero
.
57 * On entry
, N specifies the number of columns of the matrix C
.
58 * N must be at least zero
.
61 * ALPHA
- COMPLEX*16
.
62 * On entry
, ALPHA specifies the scalar alpha
.
65 * A
- COMPLEX*16 array of
DIMENSION ( LDA
, ka
), where ka is
66 * m when SIDE
= 'L' or
'l' and is n otherwise
.
67 * Before entry with SIDE
= 'L' or
'l', the m by m part of
68 * the array A must contain the symmetric matrix
, such that
69 * when UPLO
= 'U' or
'u', the leading m by m upper triangular
70 * part of the array A must contain the upper triangular part
71 * of the symmetric matrix and the strictly lower triangular
72 * part of A is not referenced
, and when UPLO
= 'L' or
'l',
73 * the leading m by m lower triangular part of the array A
74 * must contain the lower triangular part of the symmetric
75 * matrix and the strictly upper triangular part of A is not
77 * Before entry with SIDE
= 'R' or
'r', the n by n part of
78 * the array A must contain the symmetric matrix
, such that
79 * when UPLO
= 'U' or
'u', the leading n by n upper triangular
80 * part of the array A must contain the upper triangular part
81 * of the symmetric matrix and the strictly lower triangular
82 * part of A is not referenced
, and when UPLO
= 'L' or
'l',
83 * the leading n by n lower triangular part of the array A
84 * must contain the lower triangular part of the symmetric
85 * matrix and the strictly upper triangular part of A is not
90 * On entry
, LDA specifies the first
dimension of A as declared
91 * in the calling
(sub
) program. When SIDE
= 'L' or
'l' then
92 * LDA must be at least max
( 1, m
), otherwise LDA must be at
96 * B
- COMPLEX*16 array of
DIMENSION ( LDB
, n
).
97 * Before entry
, the leading m by n part of the array B must
98 * contain the matrix B
.
102 * On entry
, LDB specifies the first
dimension of B as declared
103 * in the calling
(sub
) program. LDB must be at least
107 * BETA
- COMPLEX*16
.
108 * On entry
, BETA specifies the scalar beta
. When BETA is
109 * supplied as zero
then C need not be set on input
.
112 * C
- COMPLEX*16 array of
DIMENSION ( LDC
, n
).
113 * Before entry
, the leading m by n part of the array C must
114 * contain the matrix C
, except when beta is zero
, in which
115 * case C need not be set on entry
.
116 * On exit
, the array C is overwritten by the m by n updated
120 * On entry
, LDC specifies the first
dimension of C as declared
121 * in the calling
(sub
) program. LDC must be at least
126 * Level
3 Blas routine
.
128 * -- Written on
8-February
-1989.
129 * Jack Dongarra
, Argonne National Laboratory
.
130 * Iain Duff
, AERE Harwell
.
131 * Jeremy Du Croz
, Numerical Algorithms Group Ltd
.
132 * Sven Hammarling
, Numerical Algorithms Group Ltd
.
135 * .. External Functions
..
138 * .. External Subroutines
..
140 * .. Intrinsic Functions
..
142 * .. Local Scalars
..
144 INTEGER I
, INFO
, J
, K
, NROWA
145 COMPLEX*16 TEMP1
, TEMP2
148 PARAMETER ( ONE
= ( 1.0D
+0, 0.0D
+0 ) )
150 PARAMETER ( ZERO
= ( 0.0D
+0, 0.0D
+0 ) )
152 * .. Executable Statements
..
154 * Set NROWA as the number of rows of A
.
156 IF( LSAME
( SIDE
, 'L' ) )THEN
161 UPPER
= LSAME
( UPLO
, 'U' )
163 * Test the input parameters
.
166 IF( ( .NOT
.LSAME
( SIDE
, 'L' ) ).AND
.
167 $
( .NOT
.LSAME
( SIDE
, 'R' ) ) )THEN
169 ELSE IF( ( .NOT
.UPPER
).AND
.
170 $
( .NOT
.LSAME
( UPLO
, 'L' ) ) )THEN
172 ELSE IF( M
.LT
.0 )THEN
174 ELSE IF( N
.LT
.0 )THEN
176 ELSE IF( LDA
.LT
.MAX
( 1, NROWA
) )THEN
178 ELSE IF( LDB
.LT
.MAX
( 1, M
) )THEN
180 ELSE IF( LDC
.LT
.MAX
( 1, M
) )THEN
184 CALL XERBLA
( 'ZSYMM ', INFO
)
188 * Quick
return if possible
.
190 IF( ( M
.EQ
.0 ).OR
.( N
.EQ
.0 ).OR
.
191 $
( ( ALPHA
.EQ
.ZERO
).AND
.( BETA
.EQ
.ONE
) ) )
194 * And when alpha
.eq
.zero
.
196 IF( ALPHA
.EQ
.ZERO
)THEN
197 IF( BETA
.EQ
.ZERO
)THEN
206 C
( I
, J
) = BETA*C
( I
, J
)
213 * Start the operations
.
215 IF( LSAME
( SIDE
, 'L' ) )THEN
217 * Form C
:= alpha*A*B
+ beta*C
.
222 TEMP1
= ALPHA*B
( I
, J
)
225 C
( K
, J
) = C
( K
, J
) + TEMP1
*A
( K
, I
)
226 TEMP2
= TEMP2
+ B
( K
, J
)*A
( K
, I
)
228 IF( BETA
.EQ
.ZERO
)THEN
229 C
( I
, J
) = TEMP1*A
( I
, I
) + ALPHA*TEMP2
231 C
( I
, J
) = BETA
*C
( I
, J
) +
232 $ TEMP1*A
( I
, I
) + ALPHA*TEMP2
239 TEMP1
= ALPHA*B
( I
, J
)
242 C
( K
, J
) = C
( K
, J
) + TEMP1
*A
( K
, I
)
243 TEMP2
= TEMP2
+ B
( K
, J
)*A
( K
, I
)
245 IF( BETA
.EQ
.ZERO
)THEN
246 C
( I
, J
) = TEMP1*A
( I
, I
) + ALPHA*TEMP2
248 C
( I
, J
) = BETA
*C
( I
, J
) +
249 $ TEMP1*A
( I
, I
) + ALPHA*TEMP2
256 * Form C
:= alpha*B*A
+ beta*C
.
259 TEMP1
= ALPHA*A
( J
, J
)
260 IF( BETA
.EQ
.ZERO
)THEN
262 C
( I
, J
) = TEMP1*B
( I
, J
)
266 C
( I
, J
) = BETA*C
( I
, J
) + TEMP1*B
( I
, J
)
271 TEMP1
= ALPHA*A
( K
, J
)
273 TEMP1
= ALPHA*A
( J
, K
)
276 C
( I
, J
) = C
( I
, J
) + TEMP1*B
( I
, K
)
281 TEMP1
= ALPHA*A
( J
, K
)
283 TEMP1
= ALPHA*A
( K
, J
)
286 C
( I
, J
) = C
( I
, J
) + TEMP1*B
( I
, K
)