F06 Chapter Contents
F06 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF06ZAF (ZGEMM)

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

F06ZAF (ZGEMM) performs one of the matrix-matrix operations
 $C←αAB+βC, C←αATB+βC, C←αAHB+βC, C←αABT+βC, C←αATBT+βC, C←αAHBT+βC, C←αABH+βC, C←αATBH+βC or C←αAHBH+βC,$
where $A$, $B$ and $C$ are complex matrices, and $\alpha$ and $\beta$ are complex scalars; $C$ is always $m$ by $n$.

## 2  Specification

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

None.
None.

## 5  Parameters

1:     TRANSA – CHARACTER(1)Input
On entry: specifies whether the operation involves $A$, ${A}^{\mathrm{T}}$ or ${A}^{\mathrm{H}}$.
${\mathbf{TRANSA}}=\text{'N'}$
The operation involves $A$.
${\mathbf{TRANSA}}=\text{'T'}$
The operation involves ${A}^{\mathrm{T}}$.
${\mathbf{TRANSA}}=\text{'C'}$
The operation involves ${A}^{\mathrm{H}}$.
Constraint: ${\mathbf{TRANSA}}=\text{'N'}$, $\text{'T'}$ or $\text{'C'}$.
2:     TRANSB – CHARACTER(1)Input
On entry: specifies whether the operation involves $B$, ${B}^{\mathrm{T}}$ or ${B}^{\mathrm{H}}$.
${\mathbf{TRANSB}}=\text{'N'}$
The operation involves $B$.
${\mathbf{TRANSB}}=\text{'T'}$
The operation involves ${B}^{\mathrm{T}}$.
${\mathbf{TRANSB}}=\text{'C'}$
The operation involves ${B}^{\mathrm{H}}$.
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 – COMPLEX (KIND=nag_wp)Input
On entry: the scalar $\alpha$.
7:     A(LDA,$*$) – COMPLEX (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 F06ZAF (ZGEMM) 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,$*$) – COMPLEX (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 F06ZAF (ZGEMM) 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 – COMPLEX (KIND=nag_wp)Input
On entry: the scalar $\beta$.
12:   C(LDC,$*$) – COMPLEX (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 F06ZAF (ZGEMM) is called.
Constraint: ${\mathbf{LDC}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{M}}\right)$.

None.

Not applicable.