# NAG Library Routine Document

## 1Purpose

f06hrf generates a complex elementary reflection.

## 2Specification

Fortran Interface
 Subroutine f06hrf ( n, x, incx, tol,
 Integer, Intent (In) :: n, incx Real (Kind=nag_wp), Intent (In) :: tol Complex (Kind=nag_wp), Intent (Inout) :: alpha, x(*) Complex (Kind=nag_wp), Intent (Out) :: theta
#include nagmk26.h
 void f06hrf_ ( const Integer *n, Complex *alpha, Complex x[], const Integer *incx, const double *tol, Complex *theta)

## 3Description

f06hrf generates details of a complex elementary reflection (Householder matrix), $P$, such that
 $P α x = β 0$
where $P$ is unitary, $\alpha$ is a complex scalar, $\beta$ is a real scalar, and $x$ is an $n$-element complex vector.
$P$ is given in the form
 $P=I-γ ζ z ζ zH ,$
where $z$ is an $n$-element complex vector, $\gamma$ is a complex scalar such that $\mathrm{Re}\left(\gamma \right)=1$, and $\zeta$ is a real scalar. $\gamma$ and $\zeta$ are returned in a single complex value $\theta =\left(\zeta ,\mathrm{Im}\left(\gamma \right)\right)$. Thus $\zeta =\mathrm{Re}\left(\theta \right)$ and $\gamma =\left(1,\mathrm{Im}\left(\theta \right)\right)$.
If $x$ is such that
 $maxRexi,Imxi≤maxtol,εmaxReα,Imα,$
where $\epsilon$ is the machine precision and $\mathit{tol}$ is a user-supplied tolerance, then:
• either $\theta$ is set to $0$, in which case $P$ can be taken to be the unit matrix;
• or $\theta$ is set so that $\mathrm{Re}\left(\theta \right)\le 0$ and $\theta \ne 0$, in which case
 $P= θ 0 0 I .$
Otherwise $1\le \mathrm{Re}\left(\theta \right)\le \sqrt{2}$.
None.

## 5Arguments

1:     $\mathbf{n}$ – IntegerInput
On entry: $n$, the number of elements in $x$ and $z$.
2:     $\mathbf{alpha}$ – Complex (Kind=nag_wp)Input/Output
On entry: the scalar $\alpha$.
On exit: the scalar $\beta$.
3:     $\mathbf{x}\left(*\right)$ – Complex (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)×{\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.
On exit: the referenced elements are overwritten by details of the complex elementary reflection.
4:     $\mathbf{incx}$ – IntegerInput
On entry: the increment in the subscripts of x between successive elements of $x$.
Constraint: ${\mathbf{incx}}>0$.
5:     $\mathbf{tol}$ – Real (Kind=nag_wp)Input
On entry: the value $\mathit{tol}$.
6:     $\mathbf{theta}$ – Complex (Kind=nag_wp)Output
On exit: the scalar $\theta$.

None.

Not applicable.

## 8Parallelism and Performance

f06hrf 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.