Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_lapack_zhetrd (f08fs)

## Purpose

nag_lapack_zhetrd (f08fs) reduces a complex Hermitian matrix to tridiagonal form.

## Syntax

[a, d, e, tau, info] = f08fs(uplo, a, 'n', n)
[a, d, e, tau, info] = nag_lapack_zhetrd(uplo, a, 'n', n)

## Description

nag_lapack_zhetrd (f08fs) reduces a complex Hermitian matrix $A$ to real symmetric tridiagonal form $T$ by a unitary similarity transformation: $A=QT{Q}^{\mathrm{H}}$.
The matrix $Q$ is not formed explicitly but is represented as a product of $n-1$ elementary reflectors (see the F08 Chapter Introduction for details). Functions are provided to work with $Q$ in this representation (see Further Comments).

## References

Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore

## Parameters

### Compulsory Input Parameters

1:     $\mathrm{uplo}$ – string (length ≥ 1)
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'}$.
2:     $\mathrm{a}\left(\mathit{lda},:\right)$ – complex array
The first dimension of the array a must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
The second dimension of the array a must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
The $n$ by $n$ Hermitian matrix $A$.
• If ${\mathbf{uplo}}=\text{'U'}$, the upper triangular part of $a$ must be stored and the elements of the array below the diagonal are not referenced.
• If ${\mathbf{uplo}}=\text{'L'}$, the lower triangular part of $a$ must be stored and the elements of the array above the diagonal are not referenced.

### Optional Input Parameters

1:     $\mathrm{n}$int64int32nag_int scalar
Default: the first dimension of the array a and the second dimension of the array a.
$n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.

### Output Parameters

1:     $\mathrm{a}\left(\mathit{lda},:\right)$ – complex array
The first dimension of the array a will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
The second dimension of the array a will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
a stores the tridiagonal matrix $T$ and details of the unitary matrix $Q$ as specified by uplo.
2:     $\mathrm{d}\left(:\right)$ – double array
The dimension of the array d will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The diagonal elements of the tridiagonal matrix $T$.
3:     $\mathrm{e}\left(:\right)$ – double array
The dimension of the array e will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}-1\right)$
The off-diagonal elements of the tridiagonal matrix $T$.
4:     $\mathrm{tau}\left(:\right)$ – complex array
The dimension of the array tau will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}-1\right)$
Further details of the unitary matrix $Q$.
5:     $\mathrm{info}$int64int32nag_int scalar
${\mathbf{info}}=0$ unless the function detects an error (see Error Indicators and Warnings).

## Error Indicators and Warnings

${\mathbf{info}}=-i$
If ${\mathbf{info}}=-i$, parameter $i$ had an illegal value on entry. The parameters are numbered as follows:
1: uplo, 2: n, 3: a, 4: lda, 5: d, 6: e, 7: tau, 8: work, 9: lwork, 10: info.
It is possible that info refers to a parameter that is omitted from the MATLAB interface. This usually indicates that an error in one of the other input parameters has caused an incorrect value to be inferred.

## Accuracy

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 total number of real floating-point operations is approximately $\frac{16}{3}{n}^{3}$.
To form the unitary matrix $Q$ nag_lapack_zhetrd (f08fs) may be followed by a call to nag_lapack_zungtr (f08ft):
```[a, info] = f08ft(uplo, a, tau);
```
To apply $Q$ to an $n$ by $p$ complex matrix $C$ nag_lapack_zhetrd (f08fs) may be followed by a call to nag_lapack_zunmtr (f08fu). For example,
```[c, info] = f08fu('Left', uplo, 'No Transpose', a, tau, c);
```
forms the matrix product $QC$.
The real analogue of this function is nag_lapack_dsytrd (f08fe).

## Example

This example reduces the matrix $A$ to tridiagonal form, where
 $A = -2.28+0.00i 1.78-2.03i 2.26+0.10i -0.12+2.53i 1.78+2.03i -1.12+0.00i 0.01+0.43i -1.07+0.86i 2.26-0.10i 0.01-0.43i -0.37+0.00i 2.31-0.92i -0.12-2.53i -1.07-0.86i 2.31+0.92i -0.73+0.00i .$
```function f08fs_example

fprintf('f08fs example results\n\n');

% A --> QTQ^H, for tridiagonal T
uplo = 'L';
a = [-2.28 + 0.00i,  0.00 + 0i,     0    + 0i,     0    + 0i;
1.78 + 2.03i, -1.12 + 0i,     0    + 0i,     0    + 0i;
2.26 - 0.10i,  0.01 - 0.43i, -0.37 + 0i,     0    + 0i;
-0.12 - 2.53i, -1.07 - 0.86i,  2.31 + 0.92i, -0.73 + 0i];

[QT, d, e, tau, info] = f08fs(uplo, a);

disp('Main diagonal of T:');
disp (d');
disp('Off diagonal of T (absolute values):');
disp (abs(e)');

```
```f08fs example results

Main diagonal of T:
-2.2800   -0.1285   -0.1666   -1.9249

Off diagonal of T (absolute values):
4.3385    2.0226    1.8023

```