# NAG Library Routine Document

## 1Purpose

f06fkf computes the weighted Euclidean norm of a real vector.

## 2Specification

Fortran Interface
 Function f06fkf ( n, w, incw, x, incx)
 Real (Kind=nag_wp) :: f06fkf Integer, Intent (In) :: n, incw, incx Real (Kind=nag_wp), Intent (In) :: w(*), x(*)
#include nagmk26.h
 double f06fkf_ (const Integer *n, const double w[], const Integer *incw, const double x[], const Integer *incx)

## 3Description

f06fkf returns, via the function name, the weighted Euclidean norm
 $xTWx$
of the $n$-element real vector $x$ scattered with stride incw and incx respectively, where $W=\mathrm{diag}\left(w\right)$ and $w$ is a vector of weights scattered with stride incw.

None.

## 5Arguments

1:     $\mathbf{n}$ – IntegerInput
On entry: $n$, the number of elements in $x$.
2:     $\mathbf{w}\left(*\right)$ – Real (Kind=nag_wp) arrayInput
Note: the dimension of the array w must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,1+\left({\mathbf{n}}-1\right)×\left|{\mathbf{incw}}\right|\right)$.
On entry: $w$, the vector of weights.
If ${\mathbf{incw}}>0$, ${w}_{\mathit{i}}$ must be stored in ${\mathbf{w}}\left(1+\left(\mathit{i}-1\right)×{\mathbf{incx}}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$.
If ${\mathbf{incw}}<0$, ${w}_{\mathit{i}}$ must be stored in ${\mathbf{w}}\left(1-\left({\mathbf{n}}-\mathit{i}\right)×{\mathbf{incw}}\right)$, for $\mathit{i}=1,2,\dots ,{\mathbf{n}}$.
Constraint: All weights must be non-negative.
3:     $\mathbf{incw}$ – IntegerInput
On entry: the increment in the subscripts of w between successive elements of $w$.
4:     $\mathbf{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)$.
On entry: 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}}$.
Intermediate elements of x are not referenced.
5:     $\mathbf{incx}$ – IntegerInput
On entry: the increment in the subscripts of x between successive elements of $x$.

None.

Not applicable.

## 8Parallelism and Performance

f06fkf is not threaded in any implementation.