F06 Chapter Contents
F06 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF06FKF

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

F06FKF computes the weighted Euclidean norm of a real vector.

## 2  Specification

 FUNCTION F06FKF ( N, W, INCW, X, INCX)
 REAL (KIND=nag_wp) F06FKF
 INTEGER N, INCW, INCX REAL (KIND=nag_wp) W(*), X(*)

## 3  Description

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.

## 5  Parameters

1:     N – INTEGERInput
On entry: $n$, the number of elements in $x$.
2:     W($*$) – 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:     INCW – INTEGERInput
On entry: the increment in the subscripts of W between successive elements of $w$.
4:     X($*$) – 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:     INCX – INTEGERInput
On entry: the increment in the subscripts of X between successive elements of $x$.

None.

Not applicable.