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_zupgtr (f08gt)

## Purpose

nag_lapack_zupgtr (f08gt) generates the complex unitary matrix Q$Q$, which was determined by nag_lapack_zhptrd (f08gs) when reducing a Hermitian matrix to tridiagonal form.

## Syntax

[q, info] = f08gt(uplo, n, ap, tau)
[q, info] = nag_lapack_zupgtr(uplo, n, ap, tau)

## Description

nag_lapack_zupgtr (f08gt) is intended to be used after a call to nag_lapack_zhptrd (f08gs), which reduces a complex Hermitian matrix A$A$ to real symmetric tridiagonal form T$T$ by a unitary similarity transformation: A = QTQH$A=QT{Q}^{\mathrm{H}}$. nag_lapack_zhptrd (f08gs) represents the unitary matrix Q$Q$ as a product of n1$n-1$ elementary reflectors.
This function may be used to generate Q$Q$ explicitly as a square matrix.

## References

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

## Parameters

### Compulsory Input Parameters

1:     uplo – string (length ≥ 1)
This must be the same parameter uplo as supplied to nag_lapack_zhptrd (f08gs).
Constraint: uplo = 'U'${\mathbf{uplo}}=\text{'U'}$ or 'L'$\text{'L'}$.
2:     n – int64int32nag_int scalar
n$n$, the order of the matrix Q$Q$.
Constraint: n0${\mathbf{n}}\ge 0$.
3:     ap( : $:$) – complex array
Note: the dimension of the array ap must be at least max (1,n × (n + 1) / 2)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}×\left({\mathbf{n}}+1\right)/2\right)$.
Details of the vectors which define the elementary reflectors, as returned by nag_lapack_zhptrd (f08gs).
4:     tau( : $:$) – complex array
Note: the dimension of the array tau must be at least max (1,n1)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}-1\right)$.
Further details of the elementary reflectors, as returned by nag_lapack_zhptrd (f08gs).

None.

ldq work

### Output Parameters

1:     q(ldq, : $:$) – complex array
The first dimension of the array q will be max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The second dimension of the array will be max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
ldqmax (1,n)$\mathit{ldq}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
The n$n$ by n$n$ unitary matrix Q$Q$.
2:     info – int64int32nag_int scalar
info = 0${\mathbf{info}}=0$ unless the function detects an error (see Section [Error Indicators and Warnings]).

## Error Indicators and Warnings

info = i${\mathbf{info}}=-i$
If info = i${\mathbf{info}}=-i$, parameter i$i$ had an illegal value on entry. The parameters are numbered as follows:
1: uplo, 2: n, 3: ap, 4: tau, 5: q, 6: ldq, 7: work, 8: 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 matrix Q$Q$ differs from an exactly unitary matrix by a matrix E$E$ such that
 ‖E‖2 = O(ε) , $‖E‖2 = O(ε) ,$
where ε$\epsilon$ is the machine precision.

The total number of real floating point operations is approximately (16/3)n3$\frac{16}{3}{n}^{3}$.
The real analogue of this function is nag_lapack_dopgtr (f08gf).

## Example

```function nag_lapack_zupgtr_example
uplo = 'L';
n = int64(4);
ap = [complex(-2.28);
-4.33845594653213 + 0i;
0.3278606760921924 - 0.1251226092264437i;
-0.1412565637506947 - 0.366636483973957i;
-0.1284569816493291 + 0i;
-2.022594578622617 + 0i;
-0.308321908008089 + 0.1763226364726777i;
-0.1665932537524081 + 0i;
-1.802322978338735 + 0i;
-1.924949764598263 + 0i];
tau = [ 1.410284216766754 + 0.4679084045148932i;
1.302420369434775 + 0.7853320742529579i;
1.093973715923082 - 0.9955746786231597i];
[q, info] = nag_lapack_zupgtr(uplo, n, ap, tau)
```
```

q =

1.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i
0.0000 + 0.0000i  -0.4103 - 0.4679i   0.0689 + 0.1780i   0.6583 + 0.3781i
0.0000 + 0.0000i  -0.5209 + 0.0230i  -0.2576 - 0.7356i  -0.2313 + 0.2592i
0.0000 + 0.0000i   0.0277 + 0.5832i   0.5956 - 0.0379i   0.0657 + 0.5465i

info =

0

```
```function f08gt_example
uplo = 'L';
n = int64(4);
ap = [complex(-2.28);
-4.33845594653213 + 0i;
0.3278606760921924 - 0.1251226092264437i;
-0.1412565637506947 - 0.366636483973957i;
-0.1284569816493291 + 0i;
-2.022594578622617 + 0i;
-0.308321908008089 + 0.1763226364726777i;
-0.1665932537524081 + 0i;
-1.802322978338735 + 0i;
-1.924949764598263 + 0i];
tau = [ 1.410284216766754 + 0.4679084045148932i;
1.302420369434775 + 0.7853320742529579i;
1.093973715923082 - 0.9955746786231597i];
[q, info] = f08gt(uplo, n, ap, tau)
```
```

q =

1.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i   0.0000 + 0.0000i
0.0000 + 0.0000i  -0.4103 - 0.4679i   0.0689 + 0.1780i   0.6583 + 0.3781i
0.0000 + 0.0000i  -0.5209 + 0.0230i  -0.2576 - 0.7356i  -0.2313 + 0.2592i
0.0000 + 0.0000i   0.0277 + 0.5832i   0.5956 - 0.0379i   0.0657 + 0.5465i

info =

0

```