F06 Chapter Contents
F06 Chapter Introduction
NAG Library Manual

# NAG Library Routine DocumentF06KJF

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

F06KJF updates the Euclidean norm of complex vector in scaled form.

## 2  Specification

 SUBROUTINE F06KJF ( N, X, INCX, SCAL, SUMSQ)
 INTEGER N, INCX REAL (KIND=nag_wp) SCAL, SUMSQ COMPLEX (KIND=nag_wp) X(*)

## 3  Description

Given an $n$-element complex vector $x$, and real scalars $\alpha$ and $\xi$, F06KJF returns updated values $\stackrel{~}{\alpha }$ and $\stackrel{~}{\xi }$ such that
 $α~2ξ~=x12+x22+⋯+xn2+α2ξ.$
F06KJF is designed for use in the safe computation of the Euclidean norm of a complex vector, without unnecessary overflow or destructive underflow. An initial call to F06KJF (with $\xi =1$ and $\alpha =0$) may be followed by further calls to F06KJF and finally a call to F06BMF to complete the computation. Multiple calls of F06KJF may be needed if the elements of the vector cannot all be accessed in a single array X.
None.

## 5  Parameters

1:     N – INTEGERInput
On entry: $n$, the number of elements in $x$.
2:     X($*$) – COMPLEX (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)×{\mathbf{INCX}}\right)$.
On entry: the $n$-element vector $x$. ${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}}$.
Intermediate elements of X are not referenced.
3:     INCX – INTEGERInput
On entry: the increment in the subscripts of X between successive elements of $x$.
Constraint: ${\mathbf{INCX}}>0$.
4:     SCAL – REAL (KIND=nag_wp)Input/Output
On entry: the scaling factor $\alpha$. On the first call to F06KJF ${\mathbf{SCAL}}=0.0$.
Constraint: ${\mathbf{SCAL}}\ge 0$.
On exit: the updated scaling factor $\stackrel{~}{\alpha }=\underset{i}{\mathrm{max}}\phantom{\rule{0.25em}{0ex}}\left(\alpha ,\left|\mathrm{Re}\left({x}_{i}\right)\right|,\left|\mathrm{Im}\left({x}_{i}\right)\right|\right)$.
5:     SUMSQ – REAL (KIND=nag_wp)Input/Output
On entry: the scaled sum of squares $\xi$. On the first call to F06KJF ${\mathbf{SUMSQ}}=1.0$.
Constraint: ${\mathbf{SUMSQ}}\ge 1$.
On exit: the updated scaled sum of squares $\stackrel{~}{\xi }$, satisfying: $1\le \stackrel{~}{\xi }\le \xi +2n$.

None.

Not applicable.