Developer Reference for Intel® oneAPI Math Kernel Library for Fortran
?gemmtr
Computes a matrix-matrix product with general matrices but updates only the upper or lower triangular part of the result matrix.
Syntax
call sgemmtr(uplo, transa, transb, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
call dgemmtr(uplo, transa, transb, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
call cgemmtr(uplo, transa, transb, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
call zgemmtr(uplo, transa, transb, n, k, alpha, a, lda, b, ldb, beta, c, ldc)
call gemmtr(a, b, c [, uplo] [, transa] [, transb] [, alpha] [, beta])
Include Files
mkl.fi, mkl_blas.f90
Description
The ?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 ?gemm routines, which compute a matrix-matrix product with general matrices, but the ?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
- uplo
-
CHARACTER*1. Specifies whether the upper or lower triangular part of the array c is used. If uplo = 'U' or 'u', then the upper triangular part of the array c is used. If uplo = 'L' or 'l', then the lower triangular part of the array c is used.
- transa
-
CHARACTER*1. Specifies the form of \(\mathrm{op}(A)\) used in the matrix multiplication:
If transa = 'N' or 'n', then \(\mathrm{op}(A) = A\).
If transa = 'T' or 't', then \(\mathrm{op}(A) = A^T\).
If transa = 'C' or 'c', then \(\mathrm{op}(A) = A^H\).
- transb
-
CHARACTER*1. Specifies the form of \(\mathrm{op}(B)\) used in the matrix multiplication:
If transb = 'N' or 'n', then \(\mathrm{op}(B) = B\).
If transb = 'T' or 't', then \(\mathrm{op}(B) = B^T\).
If transb = 'C' or 'c', then \(\mathrm{op}(B) = B^H\).
- n
-
INTEGER. 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
-
INTEGER. 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
-
REAL for sgemmtr
DOUBLE PRECISION for dgemmtr
COMPLEX for cgemmtr
DOUBLE COMPLEX for zgemmtr
Specifies the scalar \(\alpha\).
- a
-
REAL two-dimensional array for sgemmtr
DOUBLE PRECISION two-dimensional array for dgemmtr
COMPLEX two-dimensional array for cgemmtr
DOUBLE COMPLEX two-dimensional array for zgemmtr
When transa = 'N' or 'n', the size is (lda, k), and the leading n-by-k part of the array a must contain the matrix \(A\).
When transa = 'T', 't', 'C', or 'c', the size is (lda, n), and the leading k-by-n part of the array a must contain the matrix \(A\).
- lda
-
INTEGER. Specifies the leading dimension of a. When transa = 'N' or 'n', lda must be at least max(1, n). Otherwise, lda must be at least max(1, k).
- b
-
REAL two-dimensional array for sgemmtr
DOUBLE PRECISION two-dimensional array for dgemmtr
COMPLEX two-dimensional array for cgemmtr
DOUBLE COMPLEX two-dimensional array for zgemmtr
When transa = 'N' or 'n', the size is (ldb, n), and the leading k-by-n part of the array b must contain the matrix \(B\).
When transa = 'T', 't', 'C', or 'c', the size is (ldb, k), and the leading n-by-k part of the array b must contain the matrix \(B\).
- ldb
-
INTEGER. Specifies the leading dimension of b. When transa = 'N' or 'n', ldb must be at least max(1, k). Otherwise, ldb must be at least max(1, n).
- beta
-
REAL for sgemmtr
DOUBLE PRECISION for dgemmtr
COMPLEX for cgemmtr
DOUBLE COMPLEX for zgemmtr
Specifies the scalar \(\beta\). When beta = 0, c does not need to be initialized before calling ?gemmtr.
- c
-
REAL two-dimensional for sgemmtr
DOUBLE PRECISION two-dimensional for dgemmtr
COMPLEX two-dimensional for cgemmtr
DOUBLE COMPLEX two-dimensional for zgemmtr
The size is (ldc, n).
When uplo = 'U' or 'u', 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 = 'L' or 'l', 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 ?gemmtr.
- ldc
-
INTEGER. Specifies the leading dimension of c. The value of ldc must be at least max(1, n).
Output Parameters
- c
-
When uplo = 'U' or 'u', the upper triangular part of the array c is overwritten by the upper triangular part of the updated matrix.
When uplo = 'L' or 'l', the lower triangular part of the array c is overwritten by the lower triangular part of the updated matrix.
Fortran 95 Interface Notes
Routines in Fortran 95 interface have fewer arguments in the calling sequence than their FORTRAN 77 counterparts. For general conventions applied to skip redundant or reconstructible arguments, see Fortran 95 Interface Conventions.
Specific details for the routine gemmtr interface are the following:
- a
-
Holds the matrix \(A\) of size (n, k) if transa = 'N' and of size (k, n) otherwise.
- b
-
Holds the matrix \(B\) of size (k, n) if transb = 'N' and of size (n, k) otherwise.
- c
-
Holds the matrix \(C\) of size (n, n).
- uplo
-
Must be 'U' or 'L'. The default value is 'U'.
- transa
-
Must be 'N', 'T', or 'C'. The default value is 'N'.
- transb
-
Must be 'N', 'T', or 'C'. The default value is 'N'.
- alpha
-
The default value is 1.
- beta
-
The default value is 0.
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 ?symm routine) then compute \(\alpha \, A \, B^{T} + \beta \, C\) using the ?gemmtr routine.