F06 Chapter Contents
F06 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF06YAF (DGEMM)

Note:  before using this routine, please read the Users' Note for your implementation to check the interpretation of bold italicised terms and other implementation-dependent details.

## 1  Purpose

F06YAF (DGEMM) performs one of the matrix-matrix operations
 $C←αAB+βC, C←αATB+βC, C←αABT+βC or C←αATBT+βC,$
where $A$, $B$ and $C$ are real matrices, and $\alpha$ and $\beta$ are real scalars; $C$ is always $m$ by $n$.

## 2  Specification

 SUBROUTINE F06YAF ( TRANSA, TRANSB, M, N, K, ALPHA, A, LDA, B, LDB, BETA, C, LDC)
 INTEGER M, N, K, LDA, LDB, LDC REAL (KIND=nag_wp) ALPHA, A(LDA,*), B(LDB,*), BETA, C(LDC,*) CHARACTER(1) TRANSA, TRANSB
The routine may be called by its BLAS name dgemm.

None.

None.

## 5  Parameters

1:     TRANSA – CHARACTER(1)Input
On entry: specifies whether the operation involves $A$ or ${A}^{\mathrm{T}}$.
${\mathbf{TRANSA}}=\text{'N'}$
The operation involves $A$.
${\mathbf{TRANSA}}=\text{'T'}$ or $\text{'C'}$
The operation involves ${A}^{\mathrm{T}}$.
Constraint: ${\mathbf{TRANSA}}=\text{'N'}$, $\text{'T'}$ or $\text{'C'}$.
2:     TRANSB – CHARACTER(1)Input
On entry: specifies whether the operation involves $B$ or ${B}^{\mathrm{T}}$.
${\mathbf{TRANSB}}=\text{'N'}$
The operation involves $B$.
${\mathbf{TRANSB}}=\text{'T'}$ or $\text{'C'}$
The operation involves ${B}^{\mathrm{T}}$.
Constraint: ${\mathbf{TRANSB}}=\text{'N'}$, $\text{'T'}$ or $\text{'C'}$.
3:     M – INTEGERInput
On entry: $m$, the number of rows of the matrix $C$; the number of rows of $A$ if ${\mathbf{TRANSA}}=\text{'N'}$, or the number of columns of $A$ if ${\mathbf{TRANSA}}=\text{'T'}$ or $\text{'C'}$.
Constraint: ${\mathbf{M}}\ge 0$.
4:     N – INTEGERInput
On entry: $n$, the number of columns of the matrix $C$; the number of columns of $B$ if ${\mathbf{TRANSB}}=\text{'N'}$, or the number of rows of $B$ if ${\mathbf{TRANSB}}=\text{'T'}$ or $\text{'C'}$.
Constraint: ${\mathbf{N}}\ge 0$.
5:     K – INTEGERInput
On entry: $k$, the number of columns of $A$ if ${\mathbf{TRANSA}}=\text{'N'}$, or the number of rows of $A$ if ${\mathbf{TRANSA}}=\text{'T'}$ or $\text{'C'}$; the number of rows of $B$ if ${\mathbf{TRANSB}}=\text{'N'}$, or the number of columns of $B$ if ${\mathbf{TRANSB}}=\text{'T'}$ or $\text{'C'}$.
Constraint: ${\mathbf{K}}\ge 0$.
6:     ALPHA – REAL (KIND=nag_wp)Input
On entry: the scalar $\alpha$.
7:     A(LDA,$*$) – REAL (KIND=nag_wp) arrayInput
Note: the second dimension of the array A must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{K}}\right)$ if ${\mathbf{TRANSA}}=\text{'N'}$ and at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{M}}\right)$ if ${\mathbf{TRANSA}}=\text{'T'}$ or $\text{'C'}$.
On entry: the matrix $A$; $A$ is $m$ by $k$ if ${\mathbf{TRANSA}}=\text{'N'}$, or $k$ by $m$ if ${\mathbf{TRANSA}}=\text{'T'}$ or $\text{'C'}$.
8:     LDA – INTEGERInput
On entry: the first dimension of the array A as declared in the (sub)program from which F06YAF (DGEMM) is called.
Constraints:
• if ${\mathbf{TRANSA}}=\text{'N'}$, ${\mathbf{LDA}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{M}}\right)$;
• if ${\mathbf{TRANSA}}=\text{'T'}$ or $\text{'C'}$, ${\mathbf{LDA}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{K}}\right)$.
9:     B(LDB,$*$) – REAL (KIND=nag_wp) arrayInput
Note: the second dimension of the array B must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$ if ${\mathbf{TRANSB}}=\text{'N'}$ and at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{K}}\right)$ if ${\mathbf{TRANSB}}=\text{'T'}$ or $\text{'C'}$.
On entry: the matrix $B$; $B$ is $k$ by $n$ if ${\mathbf{TRANSB}}=\text{'N'}$, or $n$ by $k$ if ${\mathbf{TRANSB}}=\text{'T'}$ or $\text{'C'}$.
10:   LDB – INTEGERInput
On entry: the first dimension of the array B as declared in the (sub)program from which F06YAF (DGEMM) is called.
Constraints:
• if ${\mathbf{TRANSB}}=\text{'N'}$, ${\mathbf{LDB}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{K}}\right)$;
• if ${\mathbf{TRANSB}}=\text{'T'}$ or $\text{'C'}$, ${\mathbf{LDB}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
11:   BETA – REAL (KIND=nag_wp)Input
On entry: the scalar $\beta$.
12:   C(LDC,$*$) – REAL (KIND=nag_wp) arrayInput/Output
Note: the second dimension of the array C must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{N}}\right)$.
On entry: the $m$ by $n$ matrix $C$.
If ${\mathbf{BETA}}=0$, C need not be set.
On exit: the updated matrix $C$.
13:   LDC – INTEGERInput
On entry: the first dimension of the array C as declared in the (sub)program from which F06YAF (DGEMM) is called.
Constraint: ${\mathbf{LDC}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{M}}\right)$.

None.

Not applicable.

None.

None.