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:     $\mathrm{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:     $\mathrm{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:     $\mathrm{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:     $\mathrm{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:     $\mathrm{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:     $\mathrm{ALPHA}$ – REAL (KIND=nag_wp)Input
On entry: the scalar $\alpha$.
7:     $\mathrm{A}\left({\mathbf{LDA}},*\right)$ – 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:     $\mathrm{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:     $\mathrm{B}\left({\mathbf{LDB}},*\right)$ – 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:   $\mathrm{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:   $\mathrm{BETA}$ – REAL (KIND=nag_wp)Input
On entry: the scalar $\beta$.
12:   $\mathrm{C}\left({\mathbf{LDC}},*\right)$ – 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:   $\mathrm{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.

Not applicable.