# NAG Library Routine Document

## 1Purpose

f06fcf multiplies a real vector by a real diagonal matrix.

## 2Specification

Fortran Interface
 Subroutine f06fcf ( n, d, incd, x, incx)
 Integer, Intent (In) :: n, incd, incx Real (Kind=nag_wp), Intent (In) :: d(*) Real (Kind=nag_wp), Intent (Inout) :: x(*)
#include nagmk26.h
 void f06fcf_ (const Integer *n, const double d[], const Integer *incd, double x[], const Integer *incx)

## 3Description

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.

## 5Arguments

1:     $\mathbf{n}$ – IntegerInput
On entry: $n$, the number of elements in $d$ and $x$.
2:     $\mathbf{d}\left(*\right)$ – 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(\left(\mathit{i}-1\right)×{\mathbf{incd}}+1\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:     $\mathbf{incd}$ – IntegerInput
On entry: the increment in the subscripts of d between successive elements of $d$.
4:     $\mathbf{x}\left(*\right)$ – 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:     $\mathbf{incx}$ – IntegerInput
On entry: the increment in the subscripts of x between successive elements of $x$.

None.

Not applicable.

## 8Parallelism and Performance

f06fcf makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.