Developer Reference for Intel® oneAPI Math Kernel Library for C
?gemmtr
Computes a matrix-matrix product with general matrices but updates only the upper or lower triangular part of the result matrix.
Syntax
void cblas_sgemmtr(const CBLAS_LAYOUT Layout, const CBLAS_UPLO uplo,
const CBLAS_TRANSPOSE transa, const CBLAS_TRANSPOSE transb, 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_dgemmtr(const CBLAS_LAYOUT Layout, const CBLAS_UPLO uplo,
const CBLAS_TRANSPOSE transa, const CBLAS_TRANSPOSE transb, 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_cgemmtr(const CBLAS_LAYOUT Layout, const CBLAS_UPLO uplo,
const CBLAS_TRANSPOSE transa, const CBLAS_TRANSPOSE transb, 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_zgemmtr(const CBLAS_LAYOUT Layout, const CBLAS_UPLO uplo,
const CBLAS_TRANSPOSE transa, const CBLAS_TRANSPOSE transb, 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 cblas_?gemmtr routines compute a scalar-matrix-matrix product with general matrices and add the result to the upper or lower part of a scalar-matrix product. These routines are similar to the cblas_?gemm routines, which compute a matrix-matrix product with general matrices, but the cblas_?gemmtr routines only access and update a triangular part of the square result matrix (see Application Notes below).
The operation is defined as
\[C \leftarrow \alpha \, \mathrm{op}(A) \, \mathrm{op}(B) + \beta \, C \,,\]
where
\(\alpha\) and \(\beta\) are scalars;
\(A\), \(B\), and \(C\) are matrices;
\(\mathrm{op}(X)\) is one of \(X\), \(X^T\), or \(X^H\);
\(\mathrm{op}(A)\) is n-by-k, \(\mathrm{op}(B)\) is k-by-n, and \(C\) is n-by-n.
Input Parameters
- Layout
-
Specifies whether two-dimensional array storage is row-major (CblasRowMajor) or column-major (CblasColMajor).
- uplo
-
Specifies whether the upper or lower triangular part of the array c is used. If uplo = CblasUpper, then the upper triangular part of the array c is used. If uplo = CblasLower, then the lower triangular part of the array c is used.
- transa
-
Specifies the form of \(\mathrm{op}(A)\) used in the matrix multiplication:
If transa = CblasNoTrans, then \(\mathrm{op}(A) = A\).
If transa = CblasTrans, then \(\mathrm{op}(A) = A^T\).
If transa = CblasConjTrans, then \(\mathrm{op}(A) = A^H\).
- transb
-
Specifies the form of \(\mathrm{op}(B)\) used in the matrix multiplication:
If transb = CblasNoTrans, then \(\mathrm{op}(B) = B\).
If transb = CblasTrans, then \(\mathrm{op}(B) = B^T\).
If transb = CblasConjTrans, then \(\mathrm{op}(B) = B^H\).
- n
-
Specifies the number of rows of the matrix \(\mathrm{op}(A)\) and the number of columns of the matrix \(\mathrm{op}(B)\). The value of n must be at least zero.
- k
-
Specifies the number of columns of the matrix \(\mathrm{op}(A)\) and the number of rows of the matrix \(\mathrm{op}(B)\). The value of k must be at least zero.
- alpha
-
Specifies the scalar \(\alpha\).
- a
-
transa = CblasNoTrans
transa = CblasTrans or CblasConjTrans
Layout = CblasColMajor
Array, size lda * k. The leading n-by-k part of the array a must contain the matrix \(A\).
Array, size lda * n. The leading k-by-n part of the array a must contain the matrix \(A\).
Layout = CblasRowMajor
Array, size lda * n. The leading k-by-n part of the array a must contain the matrix \(A\).
Array, size lda * k. The leading n-by-k part of the array a must contain the matrix \(A\).
- lda
-
Specifies the leading dimension of a.
transa = CblasNoTrans
transa = CblasTrans or CblasConjTrans
Layout = CblasColMajor
Must be at least max(1, n).
Must be at least max(1, k).
Layout = CblasRowMajor
Must be at least max(1, k).
Must be at least max(1, n).
- b
-
transb = CblasNoTrans
transb = CblasTrans or CblasConjTrans
Layout = CblasColMajor
Array, size ldb * n. The leading k-by-n part of the array b must contain the matrix \(B\).
Array, size ldb * k. The leading n-by-k part of the array b must contain the matrix \(B\).
Layout = CblasRowMajor
Array, size ldb * k. The leading n-by-k part of the array b must contain the matrix \(B\).
Array, size ldb * n. The leading k-by-n part of the array b must contain the matrix \(B\).
- ldb
-
Specifies the leading dimension of b.
transb = CblasNoTrans
transb = CblasTrans or CblasConjTrans
Layout = CblasColMajor
Must be at least max(1, k).
Must be at least max(1, n).
Layout = CblasRowMajor
Must be at least max(1, n).
Must be at least max(1, k).
- beta
-
Specifies the scalar \(\beta\). When beta = 0, c does not need to be initialized before calling cblas_?gemmtr.
- c
-
Array, size ldc * n.
When uplo = CblasUpper, the leading n-by-n upper triangular part of the array c must contain the upper triangular part of the matrix \(C\) if beta ≠ 0. The strictly lower triangular part of c is not referenced.
When uplo = CblasLower, the leading n-by-n lower triangular part of the array c must contain the lower triangular part of the matrix \(C\) if beta ≠ 0. The strictly upper triangular part of c is not referenced.
When beta = 0, c does not need to be initialized before calling cblas_?gemmtr.
- ldc
-
Specifies the leading dimension of c. The value of ldc must be at least max(1, n).
Output Parameters
- c
-
When uplo = CblasUpper, the upper triangular part of the array c is overwritten by the upper triangular part of the updated matrix.
When uplo = CblasLower, the lower triangular part of the array c is overwritten by the lower triangular part of the updated matrix.
Fortran 95 Interface Notes
There exist FORTRAN 77 and FORTRAN 95 interfaces for this routine. See the Intel® oneMKL Fortran Developer Reference for details.
Application Notes
These routines only access and update the upper or lower triangular part of the result matrix. This can be useful when the result is known to be symmetric; for example, when computing a product of the form \(\alpha \, B \, S \, B^{T} + \beta \, C\), where \(S\) and \(C\) are symmetric matrices and \(B\) is a general matrix. In this case, we can first compute \(A \leftarrow B \, S\) (which can be done using the corresponding cblas_?symm routine) then compute \(\alpha \, A \, B^{T} + \beta \, C\) using the cblas_?gemmtr routine.