F06 Chapter Contents
F06 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF06PAF (DGEMV)

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

F06PAF (DGEMV) computes the matrix-vector product for a real general matrix or its transpose.

## 2  Specification

 SUBROUTINE F06PAF ( TRANS, M, N, ALPHA, A, LDA, X, INCX, BETA, Y, INCY)
 INTEGER M, N, LDA, INCX, INCY REAL (KIND=nag_wp) ALPHA, A(LDA,*), X(*), BETA, Y(*) CHARACTER(1) TRANS
The routine may be called by its BLAS name dgemv.

## 3  Description

F06PAF (DGEMV) performs one of the matrix-vector operations
 $y←αAx + βy , or y←αATx + βy ,$
where $A$ is an $m$ by $n$ real matrix, $x$ and $y$ are real vectors, and $\alpha$ and $\beta$ are real scalars.
If $m=0$ or $n=0$, no operation is performed.

None.

## 5  Arguments

1:     $\mathrm{TRANS}$ – CHARACTER(1)Input
On entry: specifies the operation to be performed.
${\mathbf{TRANS}}=\text{'N'}$
$y←\alpha Ax+\beta y$.
${\mathbf{TRANS}}=\text{'T'}$ or $\text{'C'}$
$y←\alpha {A}^{\mathrm{T}}x+\beta y$.
Constraint: ${\mathbf{TRANS}}=\text{'N'}$, $\text{'T'}$ or $\text{'C'}$.
2:     $\mathrm{M}$ – INTEGERInput
On entry: $m$, the number of rows of the matrix $A$.
Constraint: ${\mathbf{M}}\ge 0$.
3:     $\mathrm{N}$ – INTEGERInput
On entry: $n$, the number of columns of the matrix $A$.
Constraint: ${\mathbf{N}}\ge 0$.
4:     $\mathrm{ALPHA}$ – REAL (KIND=nag_wp)Input
On entry: the scalar $\alpha$.
5:     $\mathrm{A}\left({\mathbf{LDA}},*\right)$ – REAL (KIND=nag_wp) arrayInput
Note: the second dimension of the array A must be at least ${\mathbf{N}}$.
On entry: the $m$ by $n$ matrix $A$.
6:     $\mathrm{LDA}$ – INTEGERInput
On entry: the first dimension of the array A as declared in the (sub)program from which F06PAF (DGEMV) is called.
Constraint: ${\mathbf{LDA}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{M}}\right)$.
7:     $\mathrm{X}\left(*\right)$ – REAL (KIND=nag_wp) arrayInput
Note: the dimension of the array X must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,1+\left({\mathbf{N}}-1\right)×\left|{\mathbf{INCX}}\right|\right)$ if ${\mathbf{TRANS}}=\text{'N'}$ and at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,1+\left({\mathbf{M}}-1\right)×\left|{\mathbf{INCX}}\right|\right)$ if ${\mathbf{TRANS}}=\text{'T'}$ or $\text{'C'}$.
On entry: the vector $x$.
If ${\mathbf{TRANS}}=\text{'N'}$,
• if ${\mathbf{INCX}}>0$, ${x}_{\mathit{i}}$ must be stored in ${\mathbf{X}}\left(1+\left(\mathit{i}-1\right)×{\mathbf{INCX}}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{N}}$;
• if ${\mathbf{INCX}}<0$, ${x}_{\mathit{i}}$ must be stored in ${\mathbf{X}}\left(1-\left({\mathbf{N}}-\mathit{i}\right)×{\mathbf{INCX}}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{N}}$.
If ${\mathbf{TRANS}}=\text{'T'}$ or $\text{'C'}$,
• if ${\mathbf{INCX}}>0$, ${x}_{\mathit{i}}$ must be stored in ${\mathbf{X}}\left(1+\left(\mathit{i}-1\right)×{\mathbf{INCX}}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{M}}$;
• if ${\mathbf{INCX}}<0$, ${x}_{\mathit{i}}$ must be stored in ${\mathbf{X}}\left(1-\left({\mathbf{M}}-\mathit{i}\right)×{\mathbf{INCX}}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{M}}$.
8:     $\mathrm{INCX}$ – INTEGERInput
On entry: the increment in the subscripts of X between successive elements of $x$.
Constraint: ${\mathbf{INCX}}\ne 0$.
9:     $\mathrm{BETA}$ – REAL (KIND=nag_wp)Input
On entry: the scalar $\beta$.
10:   $\mathrm{Y}\left(*\right)$ – REAL (KIND=nag_wp) arrayInput/Output
Note: the dimension of the array Y must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,1+\left({\mathbf{M}}-1\right)×\left|{\mathbf{INCY}}\right|\right)$ if ${\mathbf{TRANS}}=\text{'N'}$ and at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,1+\left({\mathbf{N}}-1\right)×\left|{\mathbf{INCY}}\right|\right)$ if ${\mathbf{TRANS}}=\text{'T'}$ or $\text{'C'}$.
On entry: the vector $y$, if ${\mathbf{BETA}}=0.0$, Y need not be set.
If ${\mathbf{TRANS}}=\text{'N'}$,
• if ${\mathbf{INCY}}>0$, ${y}_{\mathit{i}}$ must be stored in ${\mathbf{Y}}\left(1+\left(\mathit{i}-1\right)×{\mathbf{INCY}}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{M}}$;
• if ${\mathbf{INCY}}<0$, ${y}_{\mathit{i}}$ must be stored in ${\mathbf{Y}}\left(1-\left({\mathbf{M}}-\mathit{i}\right)×{\mathbf{INCY}}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{M}}$.
If ${\mathbf{TRANS}}=\text{'T'}$ or $\text{'C'}$,
• if ${\mathbf{INCY}}>0$, ${y}_{\mathit{i}}$ must be stored in ${\mathbf{Y}}\left(1+\left(\mathit{i}-1\right)×{\mathbf{INCY}}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{N}}$;
• if ${\mathbf{INCY}}<0$, ${y}_{\mathit{i}}$ must be stored in ${\mathbf{Y}}\left(1-\left({\mathbf{N}}-\mathit{i}\right)×{\mathbf{INCY}}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{N}}$.
On exit: the updated vector $y$ stored in the array elements used to supply the original vector $y$.
11:   $\mathrm{INCY}$ – INTEGERInput
On entry: the increment in the subscripts of Y between successive elements of $y$.
Constraint: ${\mathbf{INCY}}\ne 0$.

None.

Not applicable.

## 8  Parallelism and Performance

F06PAF (DGEMV) is not threaded in any implementation.