cblas_?gemm
cblas_?gemm
Computes a matrix-matrix product with general matrices.
Syntax
void
cblas_sgemm
(
const
CBLAS_LAYOUT
Layout
,
const
CBLAS_TRANSPOSE
transa
,
const
CBLAS_TRANSPOSE
transb
,
const
MKL_INT
m
,
const
MKL_INT
n
,
const
MKL_INT
k
,
const
float
alpha
,
const
float
*a
,
const
MKL_INT
lda
,
const
float
*b
,
const
MKL_INT
ldb
,
const
float
beta
,
float
*c
,
const
MKL_INT
ldc
);
void
cblas_dgemm
(
const
CBLAS_LAYOUT
Layout
,
const
CBLAS_TRANSPOSE
transa
,
const
CBLAS_TRANSPOSE
transb
,
const
MKL_INT
m
,
const
MKL_INT
n
,
const
MKL_INT
k
,
const
double
alpha
,
const
double
*a
,
const
MKL_INT
lda
,
const
double
*b
,
const
MKL_INT
ldb
,
const
double
beta
,
double
*c
,
const
MKL_INT
ldc
);
void
cblas_cgemm
(
const
CBLAS_LAYOUT
Layout
,
const
CBLAS_TRANSPOSE
transa
,
const
CBLAS_TRANSPOSE
transb
,
const
MKL_INT
m
,
const
MKL_INT
n
,
const
MKL_INT
k
,
const
void
*alpha
,
const
void
*a
,
const
MKL_INT
lda
,
const
void
*b
,
const
MKL_INT
ldb
,
const
void
*beta
,
void
*c
,
const
MKL_INT
ldc
);
void
cblas_zgemm
(
const
CBLAS_LAYOUT
Layout
,
const
CBLAS_TRANSPOSE
transa
,
const
CBLAS_TRANSPOSE
transb
,
const
MKL_INT
m
,
const
MKL_INT
n
,
const
MKL_INT
k
,
const
void
*alpha
,
const
void
*a
,
const
MKL_INT
lda
,
const
void
*b
,
const
MKL_INT
ldb
,
const
void
*beta
,
void
*c
,
const
MKL_INT
ldc
);
Include Files
- mkl.h
Description
The
?gemm
routines compute a scalar-matrix-matrix product and add the result to a scalar-matrix product, with general matrices. The operation is defined as C := alpha*op(A)*op(B) + beta*C
where:
op(
is one of X
)op(
, or X
) = X
op(
, or X
) = X
T
op(
,X
) = X
H
alpha
and beta
are scalars,A
, B
and C
are matrices:op(
is an A
)m
-by-k
matrix,op(
is a B
)k
-by-n
matrix,C
is an m
-by-n
matrix.See also:
Input Parameters
- Layout
- Specifies whether two-dimensional array storage is row-major (CblasRowMajor) or column-major (CblasColMajor).
- transa
- Specifies the form ofop(used in the matrix multiplication:A)
- iftransa=CblasNoTrans, thenop(;A) =A
- iftransa=CblasTrans, thenop(;A) =AT
- iftransa=CblasConjTrans, thenop(.A) =AH
- transb
- Specifies the form ofop(used in the matrix multiplication:B)
- iftransb=CblasNoTrans, thenop(;B) =B
- iftransb=CblasTrans, thenop(;B) =BT
- iftransb=CblasConjTrans, thenop(.B) =BH
- m
- Specifies the number of rows of the matrixop(and of the matrixA)C. The value ofmmust be at least zero.
- n
- Specifies the number of columns of the matrixop(and the number of columns of the matrixB)C. The value ofnmust be at least zero.
- k
- Specifies the number of columns of the matrixop(and the number of rows of the matrixA)op(. The value ofB)kmust be at least zero.
- alpha
- Specifies the scalaralpha.
- a
- transa=CblasNoTranstransa=CblasTransortransa=CblasConjTransLayout=CblasColMajorArray, sizelda*k.Before entry, the leadingm-by-kpart of the arrayamust contain the matrixA.Array, sizelda*m.Before entry, the leadingk-by-mpart of the arrayamust contain the matrixA.Layout=CblasRowMajorArray, sizelda*m.Before entry, the leadingk-by-mpart of the arrayamust contain the matrixA.Array, sizelda*k.Before entry, the leadingm-by-kpart of the arrayamust contain the matrixA.
- lda
- Specifies the leading dimension ofaas declared in the calling (sub)program.transa=CblasNoTranstransa=CblasTransortransa=CblasConjTransLayout=CblasColMajorldamust be at leastmax(1,.m)ldamust be at leastmax(1,k)Layout=CblasRowMajorldamust be at leastmax(1,k)ldamust be at leastmax(1,.m)
- b
- transb=CblasNoTranstransb=CblasTransortransb=CblasConjTransLayout=CblasColMajorArray, sizeldbbyn. Before entry, the leadingk-by-npart of the arraybmust contain the matrixB.Array, sizeldbbyk. Before entry the leadingn-by-kpart of the arraybmust contain the matrixB.Layout=CblasRowMajorArray, sizeldbbyk. Before entry the leadingn-by-kpart of the arraybmust contain the matrixB.Array, sizeldbbyn. Before entry, the leadingk-by-npart of the arraybmust contain the matrixB.
- ldb
- Specifies the leading dimension ofbas declared in the calling (sub)program.Whentransb=CblasNoTrans, thenldbmust be at leastmax(1,, otherwisek)ldbmust be at leastmax(1,.n)transb=CblasNoTranstransb=CblasTransortransb=CblasConjTransLayout=CblasColMajorldbmust be at leastmax(1,.k)ldbmust be at leastmax(1,.n)Layout=CblasRowMajorldbmust be at leastmax(1,.n)ldbmust be at leastmax(1,.k)
- beta
- Specifies the scalarbeta. Whenbetais equal to zero, thencneed not be set on input.
- c
- Layout=CblasColMajorArray, sizeldcbyn. Before entry, the leadingm-by-npart of the arraycmust contain the matrixC, except whenbetais equal to zero, in which casecneed not be set on entry.Layout=CblasRowMajorArray, sizeldcbym. Before entry, the leadingn-by-mpart of the arraycmust contain the matrixC, except whenbetais equal to zero, in which casecneed not be set on entry.
- ldc
- Specifies the leading dimension ofcas declared in the calling (sub)program.Layout=CblasColMajorldcmust be at leastmax(1,.m)Layout=CblasRowMajorldcmust be at leastmax(1,.n)
Output Parameters
- c
- Overwritten by them-by-nmatrix(.alpha*op(A)*op(B) +beta*C)
Example
For examples of installation directory:
routine
usage, see these code examples in the Intel® oneAPI Math Kernel Library
- cblas_sgemm:examples\cblas\source\cblas_sgemmx.c
- cblas_dgemm:examples\cblas\source\cblas_dgemmx.c
- cblas_cgemm:examples\cblas\source\cblas_cgemmx.c
- cblas_zgemm:examples\cblas\source\cblas_zgemmx.c