LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine csyrk ( character  UPLO,
character  TRANS,
integer  N,
integer  K,
complex  ALPHA,
complex, dimension(lda,*)  A,
integer  LDA,
complex  BETA,
complex, dimension(ldc,*)  C,
integer  LDC 
)

CSYRK

Purpose:
 CSYRK  performs one of the symmetric rank k operations

    C := alpha*A*A**T + beta*C,

 or

    C := alpha*A**T*A + beta*C,

 where  alpha and beta  are scalars,  C is an  n by n symmetric matrix
 and  A  is an  n by k  matrix in the first case and a  k by n  matrix
 in the second case.
Parameters
[in]UPLO
          UPLO is CHARACTER*1
           On  entry,   UPLO  specifies  whether  the  upper  or  lower
           triangular  part  of the  array  C  is to be  referenced  as
           follows:

              UPLO = 'U' or 'u'   Only the  upper triangular part of  C
                                  is to be referenced.

              UPLO = 'L' or 'l'   Only the  lower triangular part of  C
                                  is to be referenced.
[in]TRANS
          TRANS is CHARACTER*1
           On entry,  TRANS  specifies the operation to be performed as
           follows:

              TRANS = 'N' or 'n'   C := alpha*A*A**T + beta*C.

              TRANS = 'T' or 't'   C := alpha*A**T*A + beta*C.
[in]N
          N is INTEGER
           On entry,  N specifies the order of the matrix C.  N must be
           at least zero.
[in]K
          K is INTEGER
           On entry with  TRANS = 'N' or 'n',  K  specifies  the number
           of  columns   of  the   matrix   A,   and  on   entry   with
           TRANS = 'T' or 't',  K  specifies  the number of rows of the
           matrix A.  K must be at least zero.
[in]ALPHA
          ALPHA is COMPLEX
           On entry, ALPHA specifies the scalar alpha.
[in]A
          A is COMPLEX array of DIMENSION ( LDA, ka ), where ka is
           k  when  TRANS = 'N' or 'n',  and is  n  otherwise.
           Before entry with  TRANS = 'N' or 'n',  the  leading  n by k
           part of the array  A  must contain the matrix  A,  otherwise
           the leading  k by n  part of the array  A  must contain  the
           matrix A.
[in]LDA
          LDA is INTEGER
           On entry, LDA specifies the first dimension of A as declared
           in  the  calling  (sub)  program.   When  TRANS = 'N' or 'n'
           then  LDA must be at least  max( 1, n ), otherwise  LDA must
           be at least  max( 1, k ).
[in]BETA
          BETA is COMPLEX
           On entry, BETA specifies the scalar beta.
[in,out]C
          C is COMPLEX array of DIMENSION ( LDC, n ).
           Before entry  with  UPLO = 'U' or 'u',  the leading  n by n
           upper triangular part of the array C must contain the upper
           triangular part  of the  symmetric matrix  and the strictly
           lower triangular part of C is not referenced.  On exit, the
           upper triangular part of the array  C is overwritten by the
           upper triangular part of the updated matrix.
           Before entry  with  UPLO = 'L' or 'l',  the leading  n by n
           lower triangular part of the array C must contain the lower
           triangular part  of the  symmetric matrix  and the strictly
           upper triangular part of C is not referenced.  On exit, the
           lower triangular part of the array  C is overwritten by the
           lower triangular part of the updated matrix.
[in]LDC
          LDC is INTEGER
           On entry, LDC specifies the first dimension of C as declared
           in  the  calling  (sub)  program.   LDC  must  be  at  least
           max( 1, n ).
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2011
Further Details:
  Level 3 Blas routine.

  -- Written on 8-February-1989.
     Jack Dongarra, Argonne National Laboratory.
     Iain Duff, AERE Harwell.
     Jeremy Du Croz, Numerical Algorithms Group Ltd.
     Sven Hammarling, Numerical Algorithms Group Ltd.

Definition at line 169 of file csyrk.f.

169 *
170 * -- Reference BLAS level3 routine (version 3.4.0) --
171 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
172 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
173 * November 2011
174 *
175 * .. Scalar Arguments ..
176  COMPLEX alpha,beta
177  INTEGER k,lda,ldc,n
178  CHARACTER trans,uplo
179 * ..
180 * .. Array Arguments ..
181  COMPLEX a(lda,*),c(ldc,*)
182 * ..
183 *
184 * =====================================================================
185 *
186 * .. External Functions ..
187  LOGICAL lsame
188  EXTERNAL lsame
189 * ..
190 * .. External Subroutines ..
191  EXTERNAL xerbla
192 * ..
193 * .. Intrinsic Functions ..
194  INTRINSIC max
195 * ..
196 * .. Local Scalars ..
197  COMPLEX temp
198  INTEGER i,info,j,l,nrowa
199  LOGICAL upper
200 * ..
201 * .. Parameters ..
202  COMPLEX one
203  parameter(one= (1.0e+0,0.0e+0))
204  COMPLEX zero
205  parameter(zero= (0.0e+0,0.0e+0))
206 * ..
207 *
208 * Test the input parameters.
209 *
210  IF (lsame(trans,'N')) THEN
211  nrowa = n
212  ELSE
213  nrowa = k
214  END IF
215  upper = lsame(uplo,'U')
216 *
217  info = 0
218  IF ((.NOT.upper) .AND. (.NOT.lsame(uplo,'L'))) THEN
219  info = 1
220  ELSE IF ((.NOT.lsame(trans,'N')) .AND.
221  + (.NOT.lsame(trans,'T'))) THEN
222  info = 2
223  ELSE IF (n.LT.0) THEN
224  info = 3
225  ELSE IF (k.LT.0) THEN
226  info = 4
227  ELSE IF (lda.LT.max(1,nrowa)) THEN
228  info = 7
229  ELSE IF (ldc.LT.max(1,n)) THEN
230  info = 10
231  END IF
232  IF (info.NE.0) THEN
233  CALL xerbla('CSYRK ',info)
234  RETURN
235  END IF
236 *
237 * Quick return if possible.
238 *
239  IF ((n.EQ.0) .OR. (((alpha.EQ.zero).OR.
240  + (k.EQ.0)).AND. (beta.EQ.one))) RETURN
241 *
242 * And when alpha.eq.zero.
243 *
244  IF (alpha.EQ.zero) THEN
245  IF (upper) THEN
246  IF (beta.EQ.zero) THEN
247  DO 20 j = 1,n
248  DO 10 i = 1,j
249  c(i,j) = zero
250  10 CONTINUE
251  20 CONTINUE
252  ELSE
253  DO 40 j = 1,n
254  DO 30 i = 1,j
255  c(i,j) = beta*c(i,j)
256  30 CONTINUE
257  40 CONTINUE
258  END IF
259  ELSE
260  IF (beta.EQ.zero) THEN
261  DO 60 j = 1,n
262  DO 50 i = j,n
263  c(i,j) = zero
264  50 CONTINUE
265  60 CONTINUE
266  ELSE
267  DO 80 j = 1,n
268  DO 70 i = j,n
269  c(i,j) = beta*c(i,j)
270  70 CONTINUE
271  80 CONTINUE
272  END IF
273  END IF
274  RETURN
275  END IF
276 *
277 * Start the operations.
278 *
279  IF (lsame(trans,'N')) THEN
280 *
281 * Form C := alpha*A*A**T + beta*C.
282 *
283  IF (upper) THEN
284  DO 130 j = 1,n
285  IF (beta.EQ.zero) THEN
286  DO 90 i = 1,j
287  c(i,j) = zero
288  90 CONTINUE
289  ELSE IF (beta.NE.one) THEN
290  DO 100 i = 1,j
291  c(i,j) = beta*c(i,j)
292  100 CONTINUE
293  END IF
294  DO 120 l = 1,k
295  IF (a(j,l).NE.zero) THEN
296  temp = alpha*a(j,l)
297  DO 110 i = 1,j
298  c(i,j) = c(i,j) + temp*a(i,l)
299  110 CONTINUE
300  END IF
301  120 CONTINUE
302  130 CONTINUE
303  ELSE
304  DO 180 j = 1,n
305  IF (beta.EQ.zero) THEN
306  DO 140 i = j,n
307  c(i,j) = zero
308  140 CONTINUE
309  ELSE IF (beta.NE.one) THEN
310  DO 150 i = j,n
311  c(i,j) = beta*c(i,j)
312  150 CONTINUE
313  END IF
314  DO 170 l = 1,k
315  IF (a(j,l).NE.zero) THEN
316  temp = alpha*a(j,l)
317  DO 160 i = j,n
318  c(i,j) = c(i,j) + temp*a(i,l)
319  160 CONTINUE
320  END IF
321  170 CONTINUE
322  180 CONTINUE
323  END IF
324  ELSE
325 *
326 * Form C := alpha*A**T*A + beta*C.
327 *
328  IF (upper) THEN
329  DO 210 j = 1,n
330  DO 200 i = 1,j
331  temp = zero
332  DO 190 l = 1,k
333  temp = temp + a(l,i)*a(l,j)
334  190 CONTINUE
335  IF (beta.EQ.zero) THEN
336  c(i,j) = alpha*temp
337  ELSE
338  c(i,j) = alpha*temp + beta*c(i,j)
339  END IF
340  200 CONTINUE
341  210 CONTINUE
342  ELSE
343  DO 240 j = 1,n
344  DO 230 i = j,n
345  temp = zero
346  DO 220 l = 1,k
347  temp = temp + a(l,i)*a(l,j)
348  220 CONTINUE
349  IF (beta.EQ.zero) THEN
350  c(i,j) = alpha*temp
351  ELSE
352  c(i,j) = alpha*temp + beta*c(i,j)
353  END IF
354  230 CONTINUE
355  240 CONTINUE
356  END IF
357  END IF
358 *
359  RETURN
360 *
361 * End of CSYRK .
362 *
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:62
logical function lsame(CA, CB)
LSAME
Definition: lsame.f:55

Here is the call graph for this function:

Here is the caller graph for this function: