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_dopgtr (f08gf)

## Purpose

nag_lapack_dopgtr (f08gf) generates the real orthogonal matrix Q$Q$, which was determined by nag_lapack_dsptrd (f08ge) when reducing a symmetric matrix to tridiagonal form.

## Syntax

[q, info] = f08gf(uplo, n, ap, tau)
[q, info] = nag_lapack_dopgtr(uplo, n, ap, tau)

## Description

nag_lapack_dopgtr (f08gf) is intended to be used after a call to nag_lapack_dsptrd (f08ge), which reduces a real symmetric matrix A$A$ to symmetric tridiagonal form T$T$ by an orthogonal similarity transformation: A = QTQT$A=QT{Q}^{\mathrm{T}}$. nag_lapack_dsptrd (f08ge) represents the orthogonal 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_dsptrd (f08ge).
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( : $:$) – double 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_dsptrd (f08ge).
4:     tau( : $:$) – double 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_dsptrd (f08ge).

None.

ldq work

### Output Parameters

1:     q(ldq, : $:$) – double 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$ orthogonal 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 orthogonal matrix by a matrix E$E$ such that
 ‖E‖2 = O(ε) , $‖E‖2 = O(ε) ,$
where ε$\epsilon$ is the machine precision.

The total number of floating point operations is approximately (4/3)n3$\frac{4}{3}{n}^{3}$.
The complex analogue of this function is nag_lapack_zupgtr (f08gt).

## Example

```function nag_lapack_dopgtr_example
uplo = 'L';
n = int64(4);
ap = [2.07;
-5.825753170191817;
0.4331793442217867;
-0.1186086299654892;
1.474093708197552;
2.624045178795586;
0.8062881532775791;
-0.6491595075457843;
0.9162727563219193;
-1.694934200651768];
tau = [1.664291789738249;
1.212047324162142;
0];
[q, info] = nag_lapack_dopgtr(uplo, n, ap, tau)
```
```

q =

1.0000         0         0         0
0   -0.6643   -0.0400    0.7464
0   -0.7209   -0.2294   -0.6539
0    0.1974   -0.9725    0.1235

info =

0

```
```function f08gf_example
uplo = 'L';
n = int64(4);
ap = [2.07;
-5.825753170191817;
0.4331793442217867;
-0.1186086299654892;
1.474093708197552;
2.624045178795586;
0.8062881532775791;
-0.6491595075457843;
0.9162727563219193;
-1.694934200651768];
tau = [1.664291789738249;
1.212047324162142;
0];
[q, info] = f08gf(uplo, n, ap, tau)
```
```

q =

1.0000         0         0         0
0   -0.6643   -0.0400    0.7464
0   -0.7209   -0.2294   -0.6539
0    0.1974   -0.9725    0.1235

info =

0

```