cblas_?gemm3m
cblas_?gemm3m
Computes a scalar-matrix-matrix product using matrix multiplications and adds the result to a scalar-matrix product.
Syntax
void
cblas_cgemm3m
(
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_zgemm3m
(
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
?gemm3m
routines perform a matrix-matrix operation with general complex matrices. These routines are similar to the ?gemm
routines, but they use fewer matrix multiplication operations (see
.Application Notes
below)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
'op(
,x
) = conjg(x
')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.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)if, thentransa=CblasNoTransop(;A) =Aif, thentransa=CblasTransop(;A) =A'if, thentransa=CblasConjTransop(.A) = conjg(A')
- transb
- Specifies the form ofop(used in the matrix multiplication:B)if, thentransb=CblasNoTransop(;B) =Bif, thentransb=CblasTransop(;B) =B'if, thentransb=CblasConjTransop(.B) = conjg(B')
- 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(.B)The value ofkmust 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.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)
Application Notes
These routines perform a complex matrix multiplication by forming the real and imaginary parts of the input matrices. This uses three real matrix multiplications and five real matrix additions instead of the conventional four real matrix multiplications and two real matrix additions. The use of three real matrix multiplications reduces the time spent in matrix operations by 25%, resulting in significant savings in compute time for large matrices.
If the errors in the floating point calculations satisfy the following conditions:
fl
(x
op y
)=(x
op y
)(1+δ),|δ|≤u
, op=×,/, fl
(x
±y
)=x
(1+α)±y
(1+β), |α|,|β|≤u
then for an , the following bounds are satisfied:
n
-by-n
matrix Ĉ
=fl
(C
1
+i
C
2
)= fl
((A
1
+i
A
2
)(B
1
+i
B
2
))=Ĉ
1
+i
Ĉ
2
║
,Ĉ
1
-C
1
║≤
2(n
+1)u
║A
║∞
║B
║∞
+O
(u
2
)║
,Ĉ
2
-C
2
║≤
4(n
+4)u
║A
║∞
║B
║∞
+O
(u
2
)where
║
, and A
║∞
=max(║A
1
║∞
,║A
2
║∞
)║
.B
║∞
=max(║B
1
║∞
,║B
2
║∞
)Thus the corresponding matrix multiplications are stable.