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_zunmbr (f08ku)

## Purpose

nag_lapack_zunmbr (f08ku) multiplies an arbitrary complex m$m$ by n$n$ matrix C$C$ by one of the complex unitary matrices Q$Q$ or P$P$ which were determined by nag_lapack_zgebrd (f08ks) when reducing a complex matrix to bidiagonal form.

## Syntax

[c, info] = f08ku(vect, side, trans, k, a, tau, c, 'm', m, 'n', n)
[c, info] = nag_lapack_zunmbr(vect, side, trans, k, a, tau, c, 'm', m, 'n', n)

## Description

nag_lapack_zunmbr (f08ku) is intended to be used after a call to nag_lapack_zgebrd (f08ks), which reduces a complex rectangular matrix A$A$ to real bidiagonal form B$B$ by a unitary transformation: A = QBPH$A=QB{P}^{\mathrm{H}}$. nag_lapack_zgebrd (f08ks) represents the matrices Q$Q$ and PH${P}^{\mathrm{H}}$ as products of elementary reflectors.
This function may be used to form one of the matrix products
 QC , QHC , CQ , CQH , PC , PHC , CP ​ or ​ CPH , $QC , QHC , CQ , CQH , PC , PHC , CP ​ or ​ CPH ,$
overwriting the result on C$C$ (which may be any complex rectangular matrix).

## References

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

## Parameters

Note: in the descriptions below, r$\mathit{r}$ denotes the order of Q$Q$ or PH${P}^{\mathrm{H}}$: if side = 'L'${\mathbf{side}}=\text{'L'}$, r = m$\mathit{r}={\mathbf{m}}$ and if side = 'R'${\mathbf{side}}=\text{'R'}$, r = n$\mathit{r}={\mathbf{n}}$.

### Compulsory Input Parameters

1:     vect – string (length ≥ 1)
Indicates whether Q$Q$ or QH${Q}^{\mathrm{H}}$ or P$P$ or PH${P}^{\mathrm{H}}$ is to be applied to C$C$.
vect = 'Q'${\mathbf{vect}}=\text{'Q'}$
Q$Q$ or QH${Q}^{\mathrm{H}}$ is applied to C$C$.
vect = 'P'${\mathbf{vect}}=\text{'P'}$
P$P$ or PH${P}^{\mathrm{H}}$ is applied to C$C$.
Constraint: vect = 'Q'${\mathbf{vect}}=\text{'Q'}$ or 'P'$\text{'P'}$.
2:     side – string (length ≥ 1)
Indicates how Q$Q$ or QH${Q}^{\mathrm{H}}$ or P$P$ or PH${P}^{\mathrm{H}}$ is to be applied to C$C$.
side = 'L'${\mathbf{side}}=\text{'L'}$
Q$Q$ or QH${Q}^{\mathrm{H}}$ or P$P$ or PH${P}^{\mathrm{H}}$ is applied to C$C$ from the left.
side = 'R'${\mathbf{side}}=\text{'R'}$
Q$Q$ or QH${Q}^{\mathrm{H}}$ or P$P$ or PH${P}^{\mathrm{H}}$ is applied to C$C$ from the right.
Constraint: side = 'L'${\mathbf{side}}=\text{'L'}$ or 'R'$\text{'R'}$.
3:     trans – string (length ≥ 1)
Indicates whether Q$Q$ or P$P$ or QH${Q}^{\mathrm{H}}$ or PH${P}^{\mathrm{H}}$ is to be applied to C$C$.
trans = 'N'${\mathbf{trans}}=\text{'N'}$
Q$Q$ or P$P$ is applied to C$C$.
trans = 'C'${\mathbf{trans}}=\text{'C'}$
QH${Q}^{\mathrm{H}}$ or PH${P}^{\mathrm{H}}$ is applied to C$C$.
Constraint: trans = 'N'${\mathbf{trans}}=\text{'N'}$ or 'C'$\text{'C'}$.
4:     k – int64int32nag_int scalar
If vect = 'Q'${\mathbf{vect}}=\text{'Q'}$, the number of columns in the original matrix A$A$.
If vect = 'P'${\mathbf{vect}}=\text{'P'}$, the number of rows in the original matrix A$A$.
Constraint: k0${\mathbf{k}}\ge 0$.
5:     a(lda, : $:$) – complex array
The first dimension, lda, of the array a must satisfy
• if vect = 'Q'${\mathbf{vect}}=\text{'Q'}$, lda max (1,r) $\mathit{lda}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,\mathit{r}\right)$;
• if vect = 'P'${\mathbf{vect}}=\text{'P'}$, lda max (1,min (r,k)) $\mathit{lda}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(\mathit{r},{\mathbf{k}}\right)\right)$.
The second dimension of the array must be at least max (1,min (r,k)) $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(\mathit{r},{\mathbf{k}}\right)\right)$ if vect = 'Q'${\mathbf{vect}}=\text{'Q'}$ and at least max (1,r)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,\mathit{r}\right)$ if vect = 'P'${\mathbf{vect}}=\text{'P'}$
Details of the vectors which define the elementary reflectors, as returned by nag_lapack_zgebrd (f08ks).
6:     tau( : $:$) – complex array
Note: the dimension of the array tau must be at least max (1,min (r,k))$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,\mathrm{min}\phantom{\rule{0.125em}{0ex}}\left(\mathit{r},{\mathbf{k}}\right)\right)$.
Further details of the elementary reflectors, as returned by nag_lapack_zgebrd (f08ks) in its parameter tauq if vect = 'Q'${\mathbf{vect}}=\text{'Q'}$, or in its parameter taup if vect = 'P'${\mathbf{vect}}=\text{'P'}$.
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 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$.
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$.
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 CHQ${C}^{\mathrm{H}}Q$ or PC$PC$ or PHC${P}^{\mathrm{H}}C$ or CP$CP$ or CHP${C}^{\mathrm{H}}P$ as specified by vect, 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: vect, 2: side, 3: trans, 4: m, 5: n, 6: k, 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
• if side = 'L'${\mathbf{side}}=\text{'L'}$ and mk$m\ge k$, 8nk(2mk)$8nk\left(2m-k\right)$;
• if side = 'R'${\mathbf{side}}=\text{'R'}$ and nk$n\ge k$, 8mk(2nk)$8mk\left(2n-k\right)$;
• if side = 'L'${\mathbf{side}}=\text{'L'}$ and m < k$m, 8m2n$8{m}^{2}n$;
• if side = 'R'${\mathbf{side}}=\text{'R'}$ and n < k$n, 8mn2$8m{n}^{2}$,
where k$k$ is the value of the parameter k
The real analogue of this function is nag_lapack_dormbr (f08kg).

## Example

```function nag_lapack_zunmbr_example
vect = 'Q';
side = 'Right';
trans = 'No transpose';
k = int64(4);
a = [complex(-3.087005021051958),  2.112571007455839 + 0i, ...
0.05433411079440312 + 0.4543118496773522i,  0.375743827925403 + 0.1070087304094524i;
0 + 0i,  -2.066039276679068 + 0i, ...
-1.262810106655224 + 0i,  0.02827717828732752 + 0.1650056103049374i;
0 + 0i,  -0.2804787991136917 - 0.4124461074713915i, ...
-1.873128891125712 + 0i,  1.612633872800391 + 0i;
0 + 0i,  0.2103472372638732 - 0.4460760994276616i, ...
-0.5708419424841372 + 0.06437446295221612i,  -2.002182866206992 + 0i];
tau = [0;
1.098198238126112 + 0.5158162160396563i;
1.455158088337053 - 0.2659229774958434i;
1.989879752802885 - 0.1419086853962756i];
c = [ -0.3109810296560065 + 0.2623902437722555i, ...
-0.3175341445023601 + 0.4834967063433271i,  0.4966143187964562 - 0.2996834399081108i, ...
-0.007195817944538043 - 0.3717893210480535i;
0.3174598011071733 - 0.6413983736655133i, ...
-0.2061862718385913 + 0.1576964755255177i,  -0.07925902434510126 - 0.3093749483233558i, ...
-0.02816166060051156 - 0.1491467515264786i;
-0.2008419149861708 + 0.1490117433768365i, ...
0.4891881009599058 - 0.09002535062431442i,  0.035745707605966 - 0.02190382125352534i, ...
0.5624615849142621 - 0.07099355406423355i;
0.1198572718465858 - 0.1230966575721692i, ...
0.2566010661168247 - 0.3055384784364648i,  0.4488646004434153 - 0.2140825016792581i, ...
-0.1651301691537539 + 0.1799762380267428i;
-0.2688690152234222 - 0.1652086720047534i, ...
0.1696708265434812 - 0.2490702105456178i,  -0.04956098112958145 + 0.1157544723073297i, ...
-0.48852018643744 - 0.4540377976759434i;
-0.3498536583630073 + 0.09070280031633525i, ...
-0.049104334058638 - 0.3133356336974162i,  -0.1256478989223875 - 0.5299605073526112i, ...
0.1039065872268565 + 0.04496306210314513i];
[cOut, info] = nag_lapack_zunmbr(vect, side, trans, k, a, tau, c)
```
```

cOut =

-0.3110 + 0.2624i   0.6521 + 0.5532i   0.0427 + 0.0361i  -0.2634 - 0.0741i
0.3175 - 0.6414i   0.3488 + 0.0721i   0.2287 + 0.0069i   0.1101 - 0.0326i
-0.2008 + 0.1490i  -0.3103 + 0.0230i   0.1855 - 0.1817i  -0.2956 + 0.5648i
0.1199 - 0.1231i  -0.0046 - 0.0005i  -0.3305 + 0.4821i  -0.0675 + 0.3464i
-0.2689 - 0.1652i   0.1794 - 0.0586i  -0.5235 - 0.2580i   0.3927 + 0.1450i
-0.3499 + 0.0907i   0.0829 - 0.0506i   0.3202 + 0.3038i   0.3174 + 0.3241i

info =

0

```
```function f08ku_example
vect = 'Q';
side = 'Right';
trans = 'No transpose';
k = int64(4);
a = [complex(-3.087005021051958),  2.112571007455839 + 0i, ...
0.05433411079440312 + 0.4543118496773522i,  0.375743827925403 + 0.1070087304094524i;
0 + 0i,  -2.066039276679068 + 0i, ...
-1.262810106655224 + 0i,  0.02827717828732752 + 0.1650056103049374i;
0 + 0i,  -0.2804787991136917 - 0.4124461074713915i, ...
-1.873128891125712 + 0i,  1.612633872800391 + 0i;
0 + 0i,  0.2103472372638732 - 0.4460760994276616i, ...
-0.5708419424841372 + 0.06437446295221612i,  -2.002182866206992 + 0i];
tau = [0;
1.098198238126112 + 0.5158162160396563i;
1.455158088337053 - 0.2659229774958434i;
1.989879752802885 - 0.1419086853962756i];
c = [ -0.3109810296560065 + 0.2623902437722555i, ...
-0.3175341445023601 + 0.4834967063433271i,  0.4966143187964562 - 0.2996834399081108i, ...
-0.007195817944538043 - 0.3717893210480535i;
0.3174598011071733 - 0.6413983736655133i, ...
-0.2061862718385913 + 0.1576964755255177i,  -0.07925902434510126 - 0.3093749483233558i, ...
-0.02816166060051156 - 0.1491467515264786i;
-0.2008419149861708 + 0.1490117433768365i, ...
0.4891881009599058 - 0.09002535062431442i,  0.035745707605966 - 0.02190382125352534i, ...
0.5624615849142621 - 0.07099355406423355i;
0.1198572718465858 - 0.1230966575721692i, ...
0.2566010661168247 - 0.3055384784364648i,  0.4488646004434153 - 0.2140825016792581i, ...
-0.1651301691537539 + 0.1799762380267428i;
-0.2688690152234222 - 0.1652086720047534i, ...
0.1696708265434812 - 0.2490702105456178i,  -0.04956098112958145 + 0.1157544723073297i, ...
-0.48852018643744 - 0.4540377976759434i;
-0.3498536583630073 + 0.09070280031633525i, ...
-0.049104334058638 - 0.3133356336974162i,  -0.1256478989223875 - 0.5299605073526112i, ...
0.1039065872268565 + 0.04496306210314513i];
[cOut, info] = f08ku(vect, side, trans, k, a, tau, c)
```
```

cOut =

-0.3110 + 0.2624i   0.6521 + 0.5532i   0.0427 + 0.0361i  -0.2634 - 0.0741i
0.3175 - 0.6414i   0.3488 + 0.0721i   0.2287 + 0.0069i   0.1101 - 0.0326i
-0.2008 + 0.1490i  -0.3103 + 0.0230i   0.1855 - 0.1817i  -0.2956 + 0.5648i
0.1199 - 0.1231i  -0.0046 - 0.0005i  -0.3305 + 0.4821i  -0.0675 + 0.3464i
-0.2689 - 0.1652i   0.1794 - 0.0586i  -0.5235 - 0.2580i   0.3927 + 0.1450i
-0.3499 + 0.0907i   0.0829 - 0.0506i   0.3202 + 0.3038i   0.3174 + 0.3241i

info =

0

```