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_zunmhr (f08nu)

Purpose

nag_lapack_zunmhr (f08nu) multiplies an arbitrary complex matrix C$C$ by the complex unitary matrix Q$Q$ which was determined by nag_lapack_zgehrd (f08ns) when reducing a complex general matrix to Hessenberg form.

Syntax

[c, info] = f08nu(side, trans, ilo, ihi, a, tau, c, 'm', m, 'n', n)
[c, info] = nag_lapack_zunmhr(side, trans, ilo, ihi, a, tau, c, 'm', m, 'n', n)

Description

nag_lapack_zunmhr (f08nu) is intended to be used following a call to nag_lapack_zgehrd (f08ns), which reduces a complex general matrix A$A$ to upper Hessenberg form H$H$ by a unitary similarity transformation: A = QHQH$A=QH{Q}^{\mathrm{H}}$. nag_lapack_zgehrd (f08ns) represents the matrix Q$Q$ as a product of ihiilo${i}_{\mathrm{hi}}-{i}_{\mathrm{lo}}$ elementary reflectors. Here ilo${i}_{\mathrm{lo}}$ and ihi${i}_{\mathrm{hi}}$ are values determined by nag_lapack_zgebal (f08nv) when balancing the matrix; if the matrix has not been balanced, ilo = 1${i}_{\mathrm{lo}}=1$ and ihi = n${i}_{\mathrm{hi}}=n$.
This function may be used to form one of the matrix products
 QC , QHC , CQ ​ or ​ CQH , $QC , QHC , CQ ​ or ​ CQH ,$
overwriting the result on C$C$ (which may be any complex rectangular matrix).
A common application of this function is to transform a matrix V$V$ of eigenvectors of H$H$ to the matrix QV$\mathit{QV}$ of eigenvectors of A$A$.

References

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

Parameters

Compulsory Input Parameters

1:     side – string (length ≥ 1)
Indicates how Q$Q$ or QH${Q}^{\mathrm{H}}$ is to be applied to C$C$.
side = 'L'${\mathbf{side}}=\text{'L'}$
Q$Q$ or QH${Q}^{\mathrm{H}}$ is applied to C$C$ from the left.
side = 'R'${\mathbf{side}}=\text{'R'}$
Q$Q$ or QH${Q}^{\mathrm{H}}$ is applied to C$C$ from the right.
Constraint: side = 'L'${\mathbf{side}}=\text{'L'}$ or 'R'$\text{'R'}$.
2:     trans – string (length ≥ 1)
Indicates whether Q$Q$ or QH${Q}^{\mathrm{H}}$ is to be applied to C$C$.
trans = 'N'${\mathbf{trans}}=\text{'N'}$
Q$Q$ is applied to C$C$.
trans = 'C'${\mathbf{trans}}=\text{'C'}$
QH${Q}^{\mathrm{H}}$ is applied to C$C$.
Constraint: trans = 'N'${\mathbf{trans}}=\text{'N'}$ or 'C'$\text{'C'}$.
3:     ilo – int64int32nag_int scalar
4:     ihi – int64int32nag_int scalar
These must be the same parameters ilo and ihi, respectively, as supplied to nag_lapack_zgehrd (f08ns).
Constraints:
• if side = 'L'${\mathbf{side}}=\text{'L'}$ and m > 0${\mathbf{m}}>0$, 1 ilo ihi m $1\le {\mathbf{ilo}}\le {\mathbf{ihi}}\le {\mathbf{m}}$;
• if side = 'L'${\mathbf{side}}=\text{'L'}$ and m = 0${\mathbf{m}}=0$, ilo = 1${\mathbf{ilo}}=1$ and ihi = 0${\mathbf{ihi}}=0$;
• if side = 'R'${\mathbf{side}}=\text{'R'}$ and n > 0${\mathbf{n}}>0$, 1 ilo ihi n $1\le {\mathbf{ilo}}\le {\mathbf{ihi}}\le {\mathbf{n}}$;
• if side = 'R'${\mathbf{side}}=\text{'R'}$ and n = 0${\mathbf{n}}=0$, ilo = 1${\mathbf{ilo}}=1$ and ihi = 0${\mathbf{ihi}}=0$.
5:     a(lda, : $:$) – complex array
The first dimension, lda, of the array a must satisfy
• if side = 'L'${\mathbf{side}}=\text{'L'}$, lda max (1,m) $\mathit{lda}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$;
• if side = 'R'${\mathbf{side}}=\text{'R'}$, lda max (1,n) $\mathit{lda}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
The second dimension of the array must be at least max (1,m)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$ if side = 'L'${\mathbf{side}}=\text{'L'}$ and at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$ if side = 'R'${\mathbf{side}}=\text{'R'}$
Details of the vectors which define the elementary reflectors, as returned by nag_lapack_zgehrd (f08ns).
6:     tau( : $:$) – complex array
Note: the dimension of the array tau must be at least max (1,m1)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}-1\right)$ if side = 'L'${\mathbf{side}}=\text{'L'}$ and at least max (1,n1)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}-1\right)$ if side = 'R'${\mathbf{side}}=\text{'R'}$.
Further details of the elementary reflectors, as returned by nag_lapack_zgehrd (f08ns).
7:     c(ldc, : $:$) – complex array
The first dimension of the array c must be at least max (1,m)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$
The second dimension of the array must be at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
The m$m$ by n$n$ matrix C$C$.

Optional Input Parameters

1:     m – int64int32nag_int scalar
Default: The first dimension of the array c.
m$m$, the number of rows of the matrix C$C$; m$m$ is also the order of Q$Q$ if side = 'L'${\mathbf{side}}=\text{'L'}$.
Constraint: m0${\mathbf{m}}\ge 0$.
2:     n – int64int32nag_int scalar
Default: The second dimension of the array c.
n$n$, the number of columns of the matrix C$C$; n$n$ is also the order of Q$Q$ if side = 'R'${\mathbf{side}}=\text{'R'}$.
Constraint: n0${\mathbf{n}}\ge 0$.

Input Parameters Omitted from the MATLAB Interface

lda ldc work lwork

Output Parameters

1:     c(ldc, : $:$) – complex array
The first dimension of the array c will be max (1,m)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$
The second dimension of the array will be max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
ldcmax (1,m)$\mathit{ldc}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$.
c stores QC$QC$ or QHC${Q}^{\mathrm{H}}C$ or CQ$CQ$ or CQH$C{Q}^{\mathrm{H}}$ as specified by side and trans.
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: side, 2: trans, 3: m, 4: n, 5: ilo, 6: ihi, 7: a, 8: lda, 9: tau, 10: c, 11: ldc, 12: work, 13: lwork, 14: 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 result differs from the exact result by a matrix E$E$ such that
 ‖E‖2 = O(ε) ‖C‖2 , $‖E‖2 = O(ε) ‖C‖2 ,$
where ε$\epsilon$ is the machine precision.

The total number of real floating point operations is approximately 8nq2$8n{q}^{2}$ if side = 'L'${\mathbf{side}}=\text{'L'}$ and 8mq2$8m{q}^{2}$ if side = 'R'${\mathbf{side}}=\text{'R'}$, where q = ihiilo$q={i}_{\mathrm{hi}}-{i}_{\mathrm{lo}}$.
The real analogue of this function is nag_lapack_dormhr (f08ng).

Example

```function nag_lapack_zunmhr_example
side = 'Left';
trans = 'No transpose';
ilo = int64(1);
ihi = int64(4);
a = [ -3.97 - 5.04i, -1.131805187339771 - 2.56930489882744i, ...
-4.602742437533554 - 0.142631904083292i, -1.424912289366528 + 1.732983703342187i;
-5.479653273702635 + 0i, 1.858472820765587 - 1.55018070644029i, ...
4.414465526917012 - 0.7638237115550983i, -0.4805261336990153 - 1.197599997332747i;
0.6932222118146283 - 0.4828752762602551i, ...
6.267276818064224 + 0i, -0.4503809403345012 - 0.02898183259817966i, ...
-1.346684450078734 + 1.65792489538873i;
-0.2112946907920694 + 0.0864412259893682i, ...
0.1242146188766495 - 0.2289276049796828i, -3.499985837393258 + 0i, ...
2.561908119568915 - 3.370837460961531i];
tau = [ 1.062047721455606 - 0.2737399475982613i;
1.805921371640585 + 0.3479067029848286i;
1.181823471041003 + 0.9833311880432766i];
c = [ 1 - 6.374287734989295e-17i, 0.2613040867512706 + 0.5283875825457147i;
0.3338962373760938 - 0.3906135999457942i, -0.6020569110082319 + 0.2903496482826593i;
0.08840188787511427 + 0.3310704781636432i, 1 + 1.120737926335775e-17i;
0.07925597470461895 + 0.1017388061223024i, 0.3074174862711929 + 0.2185870109734625i];
[cOut, info] = nag_lapack_zunmhr(side, trans, ilo, ihi, a, tau, c)
```
```

cOut =

1.0000 - 0.0000i   0.2613 + 0.5284i
-0.0210 + 0.3590i   0.6485 + 0.4683i
0.1035 + 0.3683i  -0.0323 - 0.8516i
-0.0664 - 0.3436i  -0.4521 + 0.1368i

info =

0

```
```function f08nu_example
side = 'Left';
trans = 'No transpose';
ilo = int64(1);
ihi = int64(4);
a = [ -3.97 - 5.04i, -1.131805187339771 - 2.56930489882744i, ...
-4.602742437533554 - 0.142631904083292i, -1.424912289366528 + 1.732983703342187i;
-5.479653273702635 + 0i, 1.858472820765587 - 1.55018070644029i, ...
4.414465526917012 - 0.7638237115550983i, -0.4805261336990153 - 1.197599997332747i;
0.6932222118146283 - 0.4828752762602551i, ...
6.267276818064224 + 0i, -0.4503809403345012 - 0.02898183259817966i, ...
-1.346684450078734 + 1.65792489538873i;
-0.2112946907920694 + 0.0864412259893682i, ...
0.1242146188766495 - 0.2289276049796828i, -3.499985837393258 + 0i, ...
2.561908119568915 - 3.370837460961531i];
tau = [ 1.062047721455606 - 0.2737399475982613i;
1.805921371640585 + 0.3479067029848286i;
1.181823471041003 + 0.9833311880432766i];
c = [ 1 - 6.374287734989295e-17i, 0.2613040867512706 + 0.5283875825457147i;
0.3338962373760938 - 0.3906135999457942i, -0.6020569110082319 + 0.2903496482826593i;
0.08840188787511427 + 0.3310704781636432i, 1 + 1.120737926335775e-17i;
0.07925597470461895 + 0.1017388061223024i, 0.3074174862711929 + 0.2185870109734625i];
[cOut, info] = f08nu(side, trans, ilo, ihi, a, tau, c)
```
```

cOut =

1.0000 - 0.0000i   0.2613 + 0.5284i
-0.0210 + 0.3590i   0.6485 + 0.4683i
0.1035 + 0.3683i  -0.0323 - 0.8516i
-0.0664 - 0.3436i  -0.4521 + 0.1368i

info =

0

```