F06 Chapter Contents
F06 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF06FCF

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

F06FCF multiplies a real vector by a real diagonal matrix.

## 2  Specification

 SUBROUTINE F06FCF ( N, D, INCD, X, INCX)
 INTEGER N, INCD, INCX REAL (KIND=nag_wp) D(*), X(*)

## 3  Description

F06FCF performs the operation
 $x←Dx$
where $x$ is an $n$-element real vector and $D=\mathrm{diag}\left(d\right)$ is a real diagonal matrix.
Equivalently, the routine performs the element-by-element product of the vectors $x$ and $d$
 $xi=dixi, i=1,2,…,n.$

None.

## 5  Parameters

1:     N – INTEGERInput
On entry: $n$, the number of elements in $d$ and $x$.
2:     D($*$) – REAL (KIND=nag_wp) arrayInput
Note: the dimension of the array D must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,1+\left({\mathbf{N}}-1\right)×\left|{\mathbf{INCD}}\right|\right)$.
On entry: the vector $d$.
If ${\mathbf{INCD}}>0$, ${d}_{\mathit{i}}$ must be stored in ${\mathbf{D}}\left(1+\left(\mathit{i}-1\right)×{\mathbf{INCD}}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{N}}$.
If ${\mathbf{INCD}}<0$, ${d}_{\mathit{i}}$ must be stored in ${\mathbf{D}}\left(1-\left({\mathbf{N}}-\mathit{i}\right)×{\mathbf{INCD}}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{N}}$.
3:     INCD – INTEGERInput
On entry: the increment in the subscripts of D between successive elements of $d$.
4:     X($*$) – REAL (KIND=nag_wp) arrayInput/Output
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)$.
On entry: the array X must contain the $n$-element vector $x$.
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}}$.
On exit: the updated vector $x$ stored in the array elements used to supply the original vector $x$.
Intermediate elements of X are unchanged.
5:     INCX – INTEGERInput
On entry: the increment in the subscripts of X between successive elements of $x$.

None.

Not applicable.