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

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_lapack_zunglq (f08aw)

## Purpose

nag_lapack_zunglq (f08aw) generates all or part of the complex unitary matrix $Q$ from an $LQ$ factorization computed by nag_lapack_zgelqf (f08av).

## Syntax

[a, info] = f08aw(a, tau, 'm', m, 'n', n, 'k', k)
[a, info] = nag_lapack_zunglq(a, tau, 'm', m, 'n', n, 'k', k)

## Description

nag_lapack_zunglq (f08aw) is intended to be used after a call to nag_lapack_zgelqf (f08av), which performs an $LQ$ factorization of a complex matrix $A$. The unitary matrix $Q$ is represented as a product of elementary reflectors.
This function may be used to generate $Q$ explicitly as a square matrix, or to form only its leading rows.
Usually $Q$ is determined from the $LQ$ factorization of a $p$ by $n$ matrix $A$ with $p\le n$. The whole of $Q$ may be computed by:
```[a, info] = f08aw(a, tau);
```
(note that the array a must have at least $n$ rows) or its leading $p$ rows by:
```[a, info] = f08aw(a(1:p,:), tau);
```
The rows of $Q$ returned by the last call form an orthonormal basis for the space spanned by the rows of $A$; thus nag_lapack_zgelqf (f08av) followed by nag_lapack_zunglq (f08aw) can be used to orthogonalize the rows of $A$.
The information returned by the $LQ$ factorization functions also yields the $LQ$ factorization of the leading $k$ rows of $A$, where $k. The unitary matrix arising from this factorization can be computed by:
```[a, info] = f08aw(a, tau);
```
or its leading $k$ rows by:
```[a, info] = f08aw(a(1:k,:), tau);
```

## 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{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{m}}\right)$.
The second dimension of the array a must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
Details of the vectors which define the elementary reflectors, as returned by nag_lapack_zgelqf (f08av).
2:     $\mathrm{tau}\left(:\right)$ – complex array
The dimension of the array tau must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{k}}\right)$
Further details of the elementary reflectors, as returned by nag_lapack_zgelqf (f08av).

### Optional Input Parameters

1:     $\mathrm{m}$int64int32nag_int scalar
Default: the first dimension of the array a.
$m$, the number of rows of the matrix $Q$.
Constraint: ${\mathbf{m}}\ge 0$.
2:     $\mathrm{n}$int64int32nag_int scalar
Default: the second dimension of the array a.
$n$, the number of columns of the matrix $Q$.
Constraint: ${\mathbf{n}}\ge {\mathbf{m}}$.
3:     $\mathrm{k}$int64int32nag_int scalar
Default: the dimension of the array tau.
$k$, the number of elementary reflectors whose product defines the matrix $Q$.
Constraint: ${\mathbf{m}}\ge {\mathbf{k}}\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{m}}\right)$.
The second dimension of the array a will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
The $m$ by $n$ matrix $Q$.
2:     $\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: m, 2: n, 3: k, 4: a, 5: lda, 6: tau, 7: work, 8: lwork, 9: 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$ differs from an exactly unitary matrix by a matrix $E$ such that
 $E2 = Oε ,$
where $\epsilon$ is the machine precision.

## Further Comments

The total number of real floating-point operations is approximately $16mnk-8\left(m+n\right){k}^{2}+\frac{16}{3}{k}^{3}$; when $m=k$, the number is approximately $\frac{8}{3}{m}^{2}\left(3n-m\right)$.
The real analogue of this function is nag_lapack_dorglq (f08aj).

## Example

This example forms the leading $4$ rows of the unitary matrix $Q$ from the $LQ$ factorization of the matrix $A$, where
 $A = 0.28-0.36i 0.50-0.86i -0.77-0.48i 1.58+0.66i -0.50-1.10i -1.21+0.76i -0.32-0.24i -0.27-1.15i 0.36-0.51i -0.07+1.33i -0.75+0.47i -0.08+1.01i .$
The rows of $Q$ form an orthonormal basis for the space spanned by the rows of $A$.
```function f08aw_example

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

a = [ 0.28 - 0.36i,  0.50 - 0.86i, -0.77 - 0.48i,  1.58 + 0.66i;
-0.50 - 1.10i, -1.21 + 0.76i, -0.32 - 0.24i, -0.27 - 1.15i;
0.36 - 0.51i, -0.07 + 1.33i, -0.75 + 0.47i, -0.08 + 1.01i];

% Compute the LQ factorization of A
[lq, tau, info] = f08av(a);

% Form Q from LQ
[q, info] = f08aw(lq, tau);

disp('Unitary Matrix Q:');
disp(q);

```
```f08aw example results

Unitary Matrix Q:
-0.1258 + 0.1618i  -0.2247 + 0.3864i   0.3460 + 0.2157i  -0.7099 - 0.2966i
-0.1163 - 0.6380i  -0.3240 + 0.4272i  -0.1995 - 0.5009i  -0.0323 - 0.0162i
-0.4607 + 0.1090i   0.2171 - 0.4062i   0.2733 - 0.6106i  -0.0994 - 0.3261i

```

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015