SGEMM/DGEMM/CGEMM/ZGEMM

Matrix-matrix multiply

Example 1 Form the REAL*4 matrix product C = AB, where A is a 9-by-6 real matrix

stored in an array A whose dimensions are 10 by 10, B is a 6-by-8 real matrix

stored in an array B of dimension 10 by 10, and C is a 9-by-8 real matrix stored

in an array C, also of dimension 10 by 10.

 

CHARACTER*1 TRANSA,TRANSB

 

 

INTEGER*4

M,N,K,LDA,LDB,LDC

 

 

REAL*4

ALPHA,BETA,A(10,10),B(10,10),C(10,10)

TRANSA = ’N’

 

 

 

TRANSB = ’N’

 

 

 

M = 9

 

 

 

N = 8

 

 

 

K = 6

 

 

 

ALPHA = 1.0

 

 

 

BETA = 0.0

 

 

 

LDA = 10

 

 

 

LDB = 10

 

 

 

LDC = 10

 

 

 

CALL SGEMM (TRANSA,TRANSB,M,N,K,ALPHA,A,LDA,B,LDB,BETA,C,LDC)

 

1

T

B , where ρ is a real scalar, A is a

Example 2 Form the REAL*8 matrix product C = --C+ ρ A

 

 

2

 

 

6-by-9 real matrix stored in an array A whose dimensions are 10 by 10, B is a

6-by-8 real matrix stored in an array B of dimension 10 by 10, and C is a 9-by-8 real matrix stored in an array C, also of dimension 10 by 10.

INTEGER*4

M,N,K,LDA,LDB,LDC

REAL*8

RHO,A(10,10),B(10,10),C(10,10)

M = 9

 

N = 8

 

K = 6

 

LDA = 10

 

LDB = 10

 

LDC = 10

 

CALL DGEMM (’TRAN’,’NONTRAN’,M,N,K,RHO,A,LDA,B,LDB,0.5D0,C,LDC)

226HP MLIB User’s Guide