[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Base Operating System and Extensions, Volume 2

SGEMM, DGEMM, CGEMM, or ZGEMM Subroutine

Purpose

Performs matrix-matrix operations on general matrices.

Library

BLAS Library (libblas.a)

FORTRAN Syntax


SUBROUTINE SGEMM(TRANSA, TRANSB, M, N, K,
ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CHARACTER*1 TRANSA, TRANSB
INTEGER M, N, K, LDA, LDB, LDC
REAL ALPHA, BETA
REAL A(LDA,*), B(LDB,*), C(LDC,*)

SUBROUTINE DGEMM(TRANSA, TRANSB, M, N, K,
ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CHARACTER*1 TRANSA,TRANSB
INTEGER M,N,K,LDA,LDB,LDC
DOUBLE PRECISION ALPHA,BETA
DOUBLE PRECISION A(LDA,*), B(LDB,*), C(LDC,*)

SUBROUTINE CGEMM(TRANSA, TRANSB, M, N, K,
ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CHARACTER*1 TRANSA,TRANSB
INTEGER M,N,K,LDA,LDB,LDC
COMPLEX ALPHA,BETA
COMPLEX A(LDA,*), B(LDB,*), C(LDC,*)

SUBROUTINE ZGEMM(TRANSA, TRANSB, M, N, K,
ALPHA, A, LDA, B, LDB, BETA, C, LDC)
CHARACTER*1 TRANSA,TRANSB
INTEGER M,N,K,LDA,LDB,LDC
COMPLEX*16 ALPHA,BETA
COMPLEX*16 A(LDA,*), B(LDB,*), C(LDC,*)

Description

The SGEMM, DGEMM, CGEMM, or ZGEMM subroutine 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',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

TRANSA 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'
TRANSA = 'C' or 'c'
op( A ) = A'

Unchanged on exit.

TRANSB 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'
TRANSB = 'C' or 'c'
op( B ) = B'

Unchanged on exit.

M On entry, M specifies the number of rows of the matrix op( A ) and of the matrix C; M must be at least 0; unchanged on exit.
N 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 0; unchanged on exit.
K 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 0; unchanged on exit.
ALPHA On entry, ALPHA specifies the scalar alpha; unchanged on exit.
A An array of dimension ( LDA, KA ), where KA is K when TRANSA = 'N' or 'n', and is M otherwise; on 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; unchanged on exit.
LDA 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 ); unchanged on exit.
B An array of dimension ( LDB, KB ) where KB is N when TRANSB = 'N' or 'n', and is K otherwise; on 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; unchanged on exit.
LDB 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 ); unchanged on exit.
BETA On entry, BETA specifies the scalar beta. When BETA is supplied as 0 then C need not be set on input; unchanged on exit.
C An array of dimension ( LDC, N ); on entry, the leading M by N part of the array C must contain the matrix C, except when beta is 0, 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 ).
LDC On entry, LDC specifies the first dimension of C as declared in the calling (sub) program; LDC must be at least max( 1, M ); unchanged on exit.

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]