1: *> \brief \b ZSYRK
2: *
3: * =========== DOCUMENTATION ===========
4: *
5: * Online html documentation available at
6: * http://www.netlib.org/lapack/explore-html/
7: *
8: * Definition:
9: * ===========
10: *
11: * SUBROUTINE ZSYRK(UPLO,TRANS,N,K,ALPHA,A,LDA,BETA,C,LDC)
12: *
13: * .. Scalar Arguments ..
14: * COMPLEX*16 ALPHA,BETA
15: * INTEGER K,LDA,LDC,N
16: * CHARACTER TRANS,UPLO
17: * ..
18: * .. Array Arguments ..
19: * COMPLEX*16 A(LDA,*),C(LDC,*)
20: * ..
21: *
22: *
23: *> \par Purpose:
24: * =============
25: *>
26: *> \verbatim
27: *>
28: *> ZSYRK performs one of the symmetric rank k operations
29: *>
30: *> C := alpha*A*A**T + beta*C,
31: *>
32: *> or
33: *>
34: *> C := alpha*A**T*A + beta*C,
35: *>
36: *> where alpha and beta are scalars, C is an n by n symmetric matrix
37: *> and A is an n by k matrix in the first case and a k by n matrix
38: *> in the second case.
39: *> \endverbatim
40: *
41: * Arguments:
42: * ==========
43: *
44: *> \param[in] UPLO
45: *> \verbatim
46: *> UPLO is CHARACTER*1
47: *> On entry, UPLO specifies whether the upper or lower
48: *> triangular part of the array C is to be referenced as
49: *> follows:
50: *>
51: *> UPLO = 'U' or 'u' Only the upper triangular part of C
52: *> is to be referenced.
53: *>
54: *> UPLO = 'L' or 'l' Only the lower triangular part of C
55: *> is to be referenced.
56: *> \endverbatim
57: *>
58: *> \param[in] TRANS
59: *> \verbatim
60: *> TRANS is CHARACTER*1
61: *> On entry, TRANS specifies the operation to be performed as
62: *> follows:
63: *>
64: *> TRANS = 'N' or 'n' C := alpha*A*A**T + beta*C.
65: *>
66: *> TRANS = 'T' or 't' C := alpha*A**T*A + beta*C.
67: *> \endverbatim
68: *>
69: *> \param[in] N
70: *> \verbatim
71: *> N is INTEGER
72: *> On entry, N specifies the order of the matrix C. N must be
73: *> at least zero.
74: *> \endverbatim
75: *>
76: *> \param[in] K
77: *> \verbatim
78: *> K is INTEGER
79: *> On entry with TRANS = 'N' or 'n', K specifies the number
80: *> of columns of the matrix A, and on entry with
81: *> TRANS = 'T' or 't', K specifies the number of rows of the
82: *> matrix A. K must be at least zero.
83: *> \endverbatim
84: *>
85: *> \param[in] ALPHA
86: *> \verbatim
87: *> ALPHA is COMPLEX*16
88: *> On entry, ALPHA specifies the scalar alpha.
89: *> \endverbatim
90: *>
91: *> \param[in] A
92: *> \verbatim
93: *> A is COMPLEX*16 array, dimension ( LDA, ka ), where ka is
94: *> k when TRANS = 'N' or 'n', and is n otherwise.
95: *> Before entry with TRANS = 'N' or 'n', the leading n by k
96: *> part of the array A must contain the matrix A, otherwise
97: *> the leading k by n part of the array A must contain the
98: *> matrix A.
99: *> \endverbatim
100: *>
101: *> \param[in] LDA
102: *> \verbatim
103: *> LDA is INTEGER
104: *> On entry, LDA specifies the first dimension of A as declared
105: *> in the calling (sub) program. When TRANS = 'N' or 'n'
106: *> then LDA must be at least max( 1, n ), otherwise LDA must
107: *> be at least max( 1, k ).
108: *> \endverbatim
109: *>
110: *> \param[in] BETA
111: *> \verbatim
112: *> BETA is COMPLEX*16
113: *> On entry, BETA specifies the scalar beta.
114: *> \endverbatim
115: *>
116: *> \param[in,out] C
117: *> \verbatim
118: *> C is COMPLEX*16 array, dimension ( LDC, N )
119: *> Before entry with UPLO = 'U' or 'u', the leading n by n
120: *> upper triangular part of the array C must contain the upper
121: *> triangular part of the symmetric matrix and the strictly
122: *> lower triangular part of C is not referenced. On exit, the
123: *> upper triangular part of the array C is overwritten by the
124: *> upper triangular part of the updated matrix.
125: *> Before entry with UPLO = 'L' or 'l', the leading n by n
126: *> lower triangular part of the array C must contain the lower
127: *> triangular part of the symmetric matrix and the strictly
128: *> upper triangular part of C is not referenced. On exit, the
129: *> lower triangular part of the array C is overwritten by the
130: *> lower triangular part of the updated matrix.
131: *> \endverbatim
132: *>
133: *> \param[in] LDC
134: *> \verbatim
135: *> LDC is INTEGER
136: *> On entry, LDC specifies the first dimension of C as declared
137: *> in the calling (sub) program. LDC must be at least
138: *> max( 1, n ).
139: *> \endverbatim
140: *
141: * Authors:
142: * ========
143: *
144: *> \author Univ. of Tennessee
145: *> \author Univ. of California Berkeley
146: *> \author Univ. of Colorado Denver
147: *> \author NAG Ltd.
148: *
149: *> \ingroup complex16_blas_level3
150: *
151: *> \par Further Details:
152: * =====================
153: *>
154: *> \verbatim
155: *>
156: *> Level 3 Blas routine.
157: *>
158: *> -- Written on 8-February-1989.
159: *> Jack Dongarra, Argonne National Laboratory.
160: *> Iain Duff, AERE Harwell.
161: *> Jeremy Du Croz, Numerical Algorithms Group Ltd.
162: *> Sven Hammarling, Numerical Algorithms Group Ltd.
163: *> \endverbatim
164: *>
165: * =====================================================================
166: SUBROUTINE ZSYRK(UPLO,TRANS,N,K,ALPHA,A,LDA,BETA,C,LDC)
167: *
168: * -- Reference BLAS level3 routine --
169: * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
170: * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
171: *
172: * .. Scalar Arguments ..
173: COMPLEX*16 ALPHA,BETA
174: INTEGER K,LDA,LDC,N
175: CHARACTER TRANS,UPLO
176: * ..
177: * .. Array Arguments ..
178: COMPLEX*16 A(LDA,*),C(LDC,*)
179: * ..
180: *
181: * =====================================================================
182: *
183: * .. External Functions ..
184: LOGICAL LSAME
185: EXTERNAL LSAME
186: * ..
187: * .. External Subroutines ..
188: EXTERNAL XERBLA
189: * ..
190: * .. Intrinsic Functions ..
191: INTRINSIC MAX
192: * ..
193: * .. Local Scalars ..
194: COMPLEX*16 TEMP
195: INTEGER I,INFO,J,L,NROWA
196: LOGICAL UPPER
197: * ..
198: * .. Parameters ..
199: COMPLEX*16 ONE
200: PARAMETER (ONE= (1.0D+0,0.0D+0))
201: COMPLEX*16 ZERO
202: PARAMETER (ZERO= (0.0D+0,0.0D+0))
203: * ..
204: *
205: * Test the input parameters.
206: *
207: IF (LSAME(TRANS,'N')) THEN
208: NROWA = N
209: ELSE
210: NROWA = K
211: END IF
212: UPPER = LSAME(UPLO,'U')
213: *
214: INFO = 0
215: IF ((.NOT.UPPER) .AND. (.NOT.LSAME(UPLO,'L'))) THEN
216: INFO = 1
217: ELSE IF ((.NOT.LSAME(TRANS,'N')) .AND.
218: + (.NOT.LSAME(TRANS,'T'))) THEN
219: INFO = 2
220: ELSE IF (N.LT.0) THEN
221: INFO = 3
222: ELSE IF (K.LT.0) THEN
223: INFO = 4
224: ELSE IF (LDA.LT.MAX(1,NROWA)) THEN
225: INFO = 7
226: ELSE IF (LDC.LT.MAX(1,N)) THEN
227: INFO = 10
228: END IF
229: IF (INFO.NE.0) THEN
230: CALL XERBLA('ZSYRK ',INFO)
231: RETURN
232: END IF
233: *
234: * Quick return if possible.
235: *
236: IF ((N.EQ.0) .OR. (((ALPHA.EQ.ZERO).OR.
237: + (K.EQ.0)).AND. (BETA.EQ.ONE))) RETURN
238: *
239: * And when alpha.eq.zero.
240: *
241: IF (ALPHA.EQ.ZERO) THEN
242: IF (UPPER) THEN
243: IF (BETA.EQ.ZERO) THEN
244: DO 20 J = 1,N
245: DO 10 I = 1,J
246: C(I,J) = ZERO
247: 10 CONTINUE
248: 20 CONTINUE
249: ELSE
250: DO 40 J = 1,N
251: DO 30 I = 1,J
252: C(I,J) = BETA*C(I,J)
253: 30 CONTINUE
254: 40 CONTINUE
255: END IF
256: ELSE
257: IF (BETA.EQ.ZERO) THEN
258: DO 60 J = 1,N
259: DO 50 I = J,N
260: C(I,J) = ZERO
261: 50 CONTINUE
262: 60 CONTINUE
263: ELSE
264: DO 80 J = 1,N
265: DO 70 I = J,N
266: C(I,J) = BETA*C(I,J)
267: 70 CONTINUE
268: 80 CONTINUE
269: END IF
270: END IF
271: RETURN
272: END IF
273: *
274: * Start the operations.
275: *
276: IF (LSAME(TRANS,'N')) THEN
277: *
278: * Form C := alpha*A*A**T + beta*C.
279: *
280: IF (UPPER) THEN
281: DO 130 J = 1,N
282: IF (BETA.EQ.ZERO) THEN
283: DO 90 I = 1,J
284: C(I,J) = ZERO
285: 90 CONTINUE
286: ELSE IF (BETA.NE.ONE) THEN
287: DO 100 I = 1,J
288: C(I,J) = BETA*C(I,J)
289: 100 CONTINUE
290: END IF
291: DO 120 L = 1,K
292: IF (A(J,L).NE.ZERO) THEN
293: TEMP = ALPHA*A(J,L)
294: DO 110 I = 1,J
295: C(I,J) = C(I,J) + TEMP*A(I,L)
296: 110 CONTINUE
297: END IF
298: 120 CONTINUE
299: 130 CONTINUE
300: ELSE
301: DO 180 J = 1,N
302: IF (BETA.EQ.ZERO) THEN
303: DO 140 I = J,N
304: C(I,J) = ZERO
305: 140 CONTINUE
306: ELSE IF (BETA.NE.ONE) THEN
307: DO 150 I = J,N
308: C(I,J) = BETA*C(I,J)
309: 150 CONTINUE
310: END IF
311: DO 170 L = 1,K
312: IF (A(J,L).NE.ZERO) THEN
313: TEMP = ALPHA*A(J,L)
314: DO 160 I = J,N
315: C(I,J) = C(I,J) + TEMP*A(I,L)
316: 160 CONTINUE
317: END IF
318: 170 CONTINUE
319: 180 CONTINUE
320: END IF
321: ELSE
322: *
323: * Form C := alpha*A**T*A + beta*C.
324: *
325: IF (UPPER) THEN
326: DO 210 J = 1,N
327: DO 200 I = 1,J
328: TEMP = ZERO
329: DO 190 L = 1,K
330: TEMP = TEMP + A(L,I)*A(L,J)
331: 190 CONTINUE
332: IF (BETA.EQ.ZERO) THEN
333: C(I,J) = ALPHA*TEMP
334: ELSE
335: C(I,J) = ALPHA*TEMP + BETA*C(I,J)
336: END IF
337: 200 CONTINUE
338: 210 CONTINUE
339: ELSE
340: DO 240 J = 1,N
341: DO 230 I = J,N
342: TEMP = ZERO
343: DO 220 L = 1,K
344: TEMP = TEMP + A(L,I)*A(L,J)
345: 220 CONTINUE
346: IF (BETA.EQ.ZERO) THEN
347: C(I,J) = ALPHA*TEMP
348: ELSE
349: C(I,J) = ALPHA*TEMP + BETA*C(I,J)
350: END IF
351: 230 CONTINUE
352: 240 CONTINUE
353: END IF
354: END IF
355: *
356: RETURN
357: *
358: * End of ZSYRK
359: *
360: END
CVSweb interface <joel.bertrand@systella.fr>