# NAG Library Routine Document

## 1Purpose

f08hsf (zhbtrd) reduces a complex Hermitian band matrix to tridiagonal form.

## 2Specification

Fortran Interface
 Subroutine f08hsf ( vect, uplo, n, kd, ab, ldab, d, e, q, ldq, work, info)
 Integer, Intent (In) :: n, kd, ldab, ldq Integer, Intent (Out) :: info Real (Kind=nag_wp), Intent (Out) :: d(n), e(n-1) Complex (Kind=nag_wp), Intent (Inout) :: ab(ldab,*), q(ldq,*) Complex (Kind=nag_wp), Intent (Out) :: work(n) Character (1), Intent (In) :: vect, uplo
#include <nagmk26.h>
 void f08hsf_ (const char *vect, const char *uplo, const Integer *n, const Integer *kd, Complex ab[], const Integer *ldab, double d[], double e[], Complex q[], const Integer *ldq, Complex work[], Integer *info, const Charlen length_vect, const Charlen length_uplo)
The routine may be called by its LAPACK name zhbtrd.

## 3Description

f08hsf (zhbtrd) reduces a Hermitian band matrix $A$ to real symmetric tridiagonal form $T$ by a unitary similarity transformation:
 $T = QH A Q .$
The unitary matrix $Q$ is determined as a product of Givens rotation matrices, and may be formed explicitly by the routine if required.
The routine uses a vectorizable form of the reduction, due to Kaufman (1984).

## 4References

Kaufman L (1984) Banded eigenvalue solvers on vector machines ACM Trans. Math. Software 10 73–86
Parlett B N (1998) The Symmetric Eigenvalue Problem SIAM, Philadelphia

## 5Arguments

1:     $\mathbf{vect}$ – Character(1)Input
On entry: indicates whether $Q$ is to be returned.
${\mathbf{vect}}=\text{'V'}$
$Q$ is returned.
${\mathbf{vect}}=\text{'U'}$
$Q$ is updated (and the array q must contain a matrix on entry).
${\mathbf{vect}}=\text{'N'}$
$Q$ is not required.
Constraint: ${\mathbf{vect}}=\text{'V'}$, $\text{'U'}$ or $\text{'N'}$.
2:     $\mathbf{uplo}$ – Character(1)Input
On entry: indicates whether the upper or lower triangular part of $A$ is stored.
${\mathbf{uplo}}=\text{'U'}$
The upper triangular part of $A$ is stored.
${\mathbf{uplo}}=\text{'L'}$
The lower triangular part of $A$ is stored.
Constraint: ${\mathbf{uplo}}=\text{'U'}$ or $\text{'L'}$.
3:     $\mathbf{n}$ – IntegerInput
On entry: $n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.
4:     $\mathbf{kd}$ – IntegerInput
On entry: if ${\mathbf{uplo}}=\text{'U'}$, the number of superdiagonals, ${k}_{d}$, of the matrix $A$.
If ${\mathbf{uplo}}=\text{'L'}$, the number of subdiagonals, ${k}_{d}$, of the matrix $A$.
Constraint: ${\mathbf{kd}}\ge 0$.
5:     $\mathbf{ab}\left({\mathbf{ldab}},*\right)$ – Complex (Kind=nag_wp) arrayInput/Output
Note: the second dimension of the array ab must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: the upper or lower triangle of the $n$ by $n$ Hermitian band matrix $A$.
The matrix is stored in rows $1$ to ${k}_{d}+1$, more precisely,
• if ${\mathbf{uplo}}=\text{'U'}$, the elements of the upper triangle of $A$ within the band must be stored with element ${A}_{ij}$ in ${\mathbf{ab}}\left({k}_{d}+1+i-j,j\right)\text{​ for ​}\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,j-{k}_{d}\right)\le i\le j$;
• if ${\mathbf{uplo}}=\text{'L'}$, the elements of the lower triangle of $A$ within the band must be stored with element ${A}_{ij}$ in ${\mathbf{ab}}\left(1+i-j,j\right)\text{​ for ​}j\le i\le \mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(n,j+{k}_{d}\right)\text{.}$
On exit: ab is overwritten by values generated during the reduction to tridiagonal form.
The first superdiagonal or subdiagonal and the diagonal of the tridiagonal matrix $T$ are returned in ab using the same storage format as described above.
6:     $\mathbf{ldab}$ – IntegerInput
On entry: the first dimension of the array ab as declared in the (sub)program from which f08hsf (zhbtrd) is called.
Constraint: ${\mathbf{ldab}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{kd}}+1\right)$.
7:     $\mathbf{d}\left({\mathbf{n}}\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: the diagonal elements of the tridiagonal matrix $T$.
8:     $\mathbf{e}\left({\mathbf{n}}-1\right)$ – Real (Kind=nag_wp) arrayOutput
On exit: the off-diagonal elements of the tridiagonal matrix $T$.
9:     $\mathbf{q}\left({\mathbf{ldq}},*\right)$ – Complex (Kind=nag_wp) arrayInput/Output
Note: the second dimension of the array q must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$ if ${\mathbf{vect}}=\text{'V'}$ or $\text{'U'}$ and at least $1$ if ${\mathbf{vect}}=\text{'N'}$.
On entry: if ${\mathbf{vect}}=\text{'U'}$, q must contain the matrix formed in a previous stage of the reduction (for example, the reduction of a banded Hermitian-definite generalized eigenproblem); otherwise q need not be set.
On exit: if ${\mathbf{vect}}=\text{'V'}$ or $\text{'U'}$, the $n$ by $n$ matrix $Q$.
If ${\mathbf{vect}}=\text{'N'}$, q is not referenced.
10:   $\mathbf{ldq}$ – IntegerInput
On entry: the first dimension of the array q as declared in the (sub)program from which f08hsf (zhbtrd) is called.
Constraints:
• if ${\mathbf{vect}}=\text{'V'}$ or $\text{'U'}$, ${\mathbf{ldq}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• if ${\mathbf{vect}}=\text{'N'}$, ${\mathbf{ldq}}\ge 1$.
11:   $\mathbf{work}\left({\mathbf{n}}\right)$ – Complex (Kind=nag_wp) arrayWorkspace
12:   $\mathbf{info}$ – IntegerOutput
On exit: ${\mathbf{info}}=0$ unless the routine detects an error (see Section 6).

## 6Error Indicators and Warnings

${\mathbf{info}}<0$
If ${\mathbf{info}}=-i$, argument $i$ had an illegal value. An explanatory message is output, and execution of the program is terminated.

## 7Accuracy

The computed tridiagonal matrix $T$ is exactly similar to a nearby matrix $\left(A+E\right)$, where
 $E2≤ c n ε A2 ,$
$c\left(n\right)$ is a modestly increasing function of $n$, and $\epsilon$ is the machine precision.
The elements of $T$ themselves may be sensitive to small perturbations in $A$ or to rounding errors in the computation, but this does not affect the stability of the eigenvalues and eigenvectors.
The computed matrix $Q$ differs from an exactly unitary matrix by a matrix $E$ such that
 $E2 = Oε ,$
where $\epsilon$ is the machine precision.

## 8Parallelism and Performance

f08hsf (zhbtrd) is threaded by NAG for parallel execution in multithreaded implementations of the NAG Library.
f08hsf (zhbtrd) 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.

The total number of real floating-point operations is approximately $20{n}^{2}k$ if ${\mathbf{vect}}=\text{'N'}$ with $10{n}^{3}\left(k-1\right)/k$ additional operations if ${\mathbf{vect}}=\text{'V'}$.
The real analogue of this routine is f08hef (dsbtrd).

## 10Example

This example computes all the eigenvalues and eigenvectors of the matrix $A$, where
 $A = -3.13+0.00i 1.94-2.10i -3.40+0.25i 0.00+0.00i 1.94+2.10i -1.91+0.00i -0.82-0.89i -0.67+0.34i -3.40-0.25i -0.82+0.89i -2.87+0.00i -2.10-0.16i 0.00+0.00i -0.67-0.34i -2.10+0.16i 0.50+0.00i .$
Here $A$ is Hermitian and is treated as a band matrix. The program first calls f08hsf (zhbtrd) to reduce $A$ to tridiagonal form $T$, and to form the unitary matrix $Q$; the results are then passed to f08jsf (zsteqr) which computes the eigenvalues and eigenvectors of $A$.

### 10.1Program Text

Program Text (f08hsfe.f90)

### 10.2Program Data

Program Data (f08hsfe.d)

### 10.3Program Results

Program Results (f08hsfe.r)