LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine cgemm ( character  TRANSA,
character  TRANSB,
integer  M,
integer  N,
integer  K,
complex  ALPHA,
complex, dimension(lda,*)  A,
integer  LDA,
complex, dimension(ldb,*)  B,
integer  LDB,
complex  BETA,
complex, dimension(ldc,*)  C,
integer  LDC 
)

CGEMM

Purpose:
 CGEMM  performs one of the matrix-matrix operations

    C := alpha*op( A )*op( B ) + beta*C,

 where  op( X ) is one of

    op( X ) = X   or   op( X ) = X**T   or   op( X ) = X**H,

 alpha and beta are scalars, and A, B and C are matrices, with op( A )
 an m by k matrix,  op( B )  a  k by n matrix and  C an m by n matrix.
Parameters
[in]TRANSA
          TRANSA is CHARACTER*1
           On entry, TRANSA specifies the form of op( A ) to be used in
           the matrix multiplication as follows:

              TRANSA = 'N' or 'n',  op( A ) = A.

              TRANSA = 'T' or 't',  op( A ) = A**T.

              TRANSA = 'C' or 'c',  op( A ) = A**H.
[in]TRANSB
          TRANSB is CHARACTER*1
           On entry, TRANSB specifies the form of op( B ) to be used in
           the matrix multiplication as follows:

              TRANSB = 'N' or 'n',  op( B ) = B.

              TRANSB = 'T' or 't',  op( B ) = B**T.

              TRANSB = 'C' or 'c',  op( B ) = B**H.
[in]M
          M is INTEGER
           On entry,  M  specifies  the number  of rows  of the  matrix
           op( A )  and of the  matrix  C.  M  must  be at least  zero.
[in]N
          N is INTEGER
           On entry,  N  specifies the number  of columns of the matrix
           op( B ) and the number of columns of the matrix C. N must be
           at least zero.
[in]K
          K is INTEGER
           On entry,  K  specifies  the number of columns of the matrix
           op( A ) and the number of rows of the matrix op( B ). 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  TRANSA = 'N' or 'n',  and is  m  otherwise.
           Before entry with  TRANSA = 'N' or 'n',  the leading  m by k
           part of the array  A  must contain the matrix  A,  otherwise
           the leading  k by m  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  TRANSA = 'N' or 'n' then
           LDA must be at least  max( 1, m ), otherwise  LDA must be at
           least  max( 1, k ).
[in]B
          B is COMPLEX array of DIMENSION ( LDB, kb ), where kb is
           n  when  TRANSB = 'N' or 'n',  and is  k  otherwise.
           Before entry with  TRANSB = 'N' or 'n',  the leading  k by n
           part of the array  B  must contain the matrix  B,  otherwise
           the leading  n by k  part of the array  B  must contain  the
           matrix B.
[in]LDB
          LDB is INTEGER
           On entry, LDB specifies the first dimension of B as declared
           in the calling (sub) program. When  TRANSB = 'N' or 'n' then
           LDB must be at least  max( 1, k ), otherwise  LDB must be at
           least  max( 1, n ).
[in]BETA
          BETA is COMPLEX
           On entry,  BETA  specifies the scalar  beta.  When  BETA  is
           supplied as zero then C need not be set on input.
[in,out]C
          C is COMPLEX array of DIMENSION ( LDC, n ).
           Before entry, the leading  m by n  part of the array  C must
           contain the matrix  C,  except when  beta  is zero, in which
           case C need not be set on entry.
           On exit, the array  C  is overwritten by the  m by n  matrix
           ( alpha*op( A )*op( B ) + beta*C ).
[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, m ).
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2015
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 189 of file cgemm.f.

189 *
190 * -- Reference BLAS level3 routine (version 3.6.0) --
191 * -- Reference BLAS is a software package provided by Univ. of Tennessee, --
192 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
193 * November 2015
194 *
195 * .. Scalar Arguments ..
196  COMPLEX alpha,beta
197  INTEGER k,lda,ldb,ldc,m,n
198  CHARACTER transa,transb
199 * ..
200 * .. Array Arguments ..
201  COMPLEX a(lda,*),b(ldb,*),c(ldc,*)
202 * ..
203 *
204 * =====================================================================
205 *
206 * .. External Functions ..
207  LOGICAL lsame
208  EXTERNAL lsame
209 * ..
210 * .. External Subroutines ..
211  EXTERNAL xerbla
212 * ..
213 * .. Intrinsic Functions ..
214  INTRINSIC conjg,max
215 * ..
216 * .. Local Scalars ..
217  COMPLEX temp
218  INTEGER i,info,j,l,ncola,nrowa,nrowb
219  LOGICAL conja,conjb,nota,notb
220 * ..
221 * .. Parameters ..
222  COMPLEX one
223  parameter(one= (1.0e+0,0.0e+0))
224  COMPLEX zero
225  parameter(zero= (0.0e+0,0.0e+0))
226 * ..
227 *
228 * Set NOTA and NOTB as true if A and B respectively are not
229 * conjugated or transposed, set CONJA and CONJB as true if A and
230 * B respectively are to be transposed but not conjugated and set
231 * NROWA, NCOLA and NROWB as the number of rows and columns of A
232 * and the number of rows of B respectively.
233 *
234  nota = lsame(transa,'N')
235  notb = lsame(transb,'N')
236  conja = lsame(transa,'C')
237  conjb = lsame(transb,'C')
238  IF (nota) THEN
239  nrowa = m
240  ncola = k
241  ELSE
242  nrowa = k
243  ncola = m
244  END IF
245  IF (notb) THEN
246  nrowb = k
247  ELSE
248  nrowb = n
249  END IF
250 *
251 * Test the input parameters.
252 *
253  info = 0
254  IF ((.NOT.nota) .AND. (.NOT.conja) .AND.
255  + (.NOT.lsame(transa,'T'))) THEN
256  info = 1
257  ELSE IF ((.NOT.notb) .AND. (.NOT.conjb) .AND.
258  + (.NOT.lsame(transb,'T'))) THEN
259  info = 2
260  ELSE IF (m.LT.0) THEN
261  info = 3
262  ELSE IF (n.LT.0) THEN
263  info = 4
264  ELSE IF (k.LT.0) THEN
265  info = 5
266  ELSE IF (lda.LT.max(1,nrowa)) THEN
267  info = 8
268  ELSE IF (ldb.LT.max(1,nrowb)) THEN
269  info = 10
270  ELSE IF (ldc.LT.max(1,m)) THEN
271  info = 13
272  END IF
273  IF (info.NE.0) THEN
274  CALL xerbla('CGEMM ',info)
275  RETURN
276  END IF
277 *
278 * Quick return if possible.
279 *
280  IF ((m.EQ.0) .OR. (n.EQ.0) .OR.
281  + (((alpha.EQ.zero).OR. (k.EQ.0)).AND. (beta.EQ.one))) RETURN
282 *
283 * And when alpha.eq.zero.
284 *
285  IF (alpha.EQ.zero) THEN
286  IF (beta.EQ.zero) THEN
287  DO 20 j = 1,n
288  DO 10 i = 1,m
289  c(i,j) = zero
290  10 CONTINUE
291  20 CONTINUE
292  ELSE
293  DO 40 j = 1,n
294  DO 30 i = 1,m
295  c(i,j) = beta*c(i,j)
296  30 CONTINUE
297  40 CONTINUE
298  END IF
299  RETURN
300  END IF
301 *
302 * Start the operations.
303 *
304  IF (notb) THEN
305  IF (nota) THEN
306 *
307 * Form C := alpha*A*B + beta*C.
308 *
309  DO 90 j = 1,n
310  IF (beta.EQ.zero) THEN
311  DO 50 i = 1,m
312  c(i,j) = zero
313  50 CONTINUE
314  ELSE IF (beta.NE.one) THEN
315  DO 60 i = 1,m
316  c(i,j) = beta*c(i,j)
317  60 CONTINUE
318  END IF
319  DO 80 l = 1,k
320  temp = alpha*b(l,j)
321  DO 70 i = 1,m
322  c(i,j) = c(i,j) + temp*a(i,l)
323  70 CONTINUE
324  80 CONTINUE
325  90 CONTINUE
326  ELSE IF (conja) THEN
327 *
328 * Form C := alpha*A**H*B + beta*C.
329 *
330  DO 120 j = 1,n
331  DO 110 i = 1,m
332  temp = zero
333  DO 100 l = 1,k
334  temp = temp + conjg(a(l,i))*b(l,j)
335  100 CONTINUE
336  IF (beta.EQ.zero) THEN
337  c(i,j) = alpha*temp
338  ELSE
339  c(i,j) = alpha*temp + beta*c(i,j)
340  END IF
341  110 CONTINUE
342  120 CONTINUE
343  ELSE
344 *
345 * Form C := alpha*A**T*B + beta*C
346 *
347  DO 150 j = 1,n
348  DO 140 i = 1,m
349  temp = zero
350  DO 130 l = 1,k
351  temp = temp + a(l,i)*b(l,j)
352  130 CONTINUE
353  IF (beta.EQ.zero) THEN
354  c(i,j) = alpha*temp
355  ELSE
356  c(i,j) = alpha*temp + beta*c(i,j)
357  END IF
358  140 CONTINUE
359  150 CONTINUE
360  END IF
361  ELSE IF (nota) THEN
362  IF (conjb) THEN
363 *
364 * Form C := alpha*A*B**H + beta*C.
365 *
366  DO 200 j = 1,n
367  IF (beta.EQ.zero) THEN
368  DO 160 i = 1,m
369  c(i,j) = zero
370  160 CONTINUE
371  ELSE IF (beta.NE.one) THEN
372  DO 170 i = 1,m
373  c(i,j) = beta*c(i,j)
374  170 CONTINUE
375  END IF
376  DO 190 l = 1,k
377  temp = alpha*conjg(b(j,l))
378  DO 180 i = 1,m
379  c(i,j) = c(i,j) + temp*a(i,l)
380  180 CONTINUE
381  190 CONTINUE
382  200 CONTINUE
383  ELSE
384 *
385 * Form C := alpha*A*B**T + beta*C
386 *
387  DO 250 j = 1,n
388  IF (beta.EQ.zero) THEN
389  DO 210 i = 1,m
390  c(i,j) = zero
391  210 CONTINUE
392  ELSE IF (beta.NE.one) THEN
393  DO 220 i = 1,m
394  c(i,j) = beta*c(i,j)
395  220 CONTINUE
396  END IF
397  DO 240 l = 1,k
398  temp = alpha*b(j,l)
399  DO 230 i = 1,m
400  c(i,j) = c(i,j) + temp*a(i,l)
401  230 CONTINUE
402  240 CONTINUE
403  250 CONTINUE
404  END IF
405  ELSE IF (conja) THEN
406  IF (conjb) THEN
407 *
408 * Form C := alpha*A**H*B**H + beta*C.
409 *
410  DO 280 j = 1,n
411  DO 270 i = 1,m
412  temp = zero
413  DO 260 l = 1,k
414  temp = temp + conjg(a(l,i))*conjg(b(j,l))
415  260 CONTINUE
416  IF (beta.EQ.zero) THEN
417  c(i,j) = alpha*temp
418  ELSE
419  c(i,j) = alpha*temp + beta*c(i,j)
420  END IF
421  270 CONTINUE
422  280 CONTINUE
423  ELSE
424 *
425 * Form C := alpha*A**H*B**T + beta*C
426 *
427  DO 310 j = 1,n
428  DO 300 i = 1,m
429  temp = zero
430  DO 290 l = 1,k
431  temp = temp + conjg(a(l,i))*b(j,l)
432  290 CONTINUE
433  IF (beta.EQ.zero) THEN
434  c(i,j) = alpha*temp
435  ELSE
436  c(i,j) = alpha*temp + beta*c(i,j)
437  END IF
438  300 CONTINUE
439  310 CONTINUE
440  END IF
441  ELSE
442  IF (conjb) THEN
443 *
444 * Form C := alpha*A**T*B**H + beta*C
445 *
446  DO 340 j = 1,n
447  DO 330 i = 1,m
448  temp = zero
449  DO 320 l = 1,k
450  temp = temp + a(l,i)*conjg(b(j,l))
451  320 CONTINUE
452  IF (beta.EQ.zero) THEN
453  c(i,j) = alpha*temp
454  ELSE
455  c(i,j) = alpha*temp + beta*c(i,j)
456  END IF
457  330 CONTINUE
458  340 CONTINUE
459  ELSE
460 *
461 * Form C := alpha*A**T*B**T + beta*C
462 *
463  DO 370 j = 1,n
464  DO 360 i = 1,m
465  temp = zero
466  DO 350 l = 1,k
467  temp = temp + a(l,i)*b(j,l)
468  350 CONTINUE
469  IF (beta.EQ.zero) THEN
470  c(i,j) = alpha*temp
471  ELSE
472  c(i,j) = alpha*temp + beta*c(i,j)
473  END IF
474  360 CONTINUE
475  370 CONTINUE
476  END IF
477  END IF
478 *
479  RETURN
480 *
481 * End of CGEMM .
482 *
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: