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_dormbr (f08kg)

## Purpose

nag_lapack_dormbr (f08kg) multiplies an arbitrary real m$m$ by n$n$ matrix C$C$ by one of the real orthogonal matrices Q$Q$ or P$P$ which were determined by nag_lapack_dgebrd (f08ke) when reducing a real matrix to bidiagonal form.

## Syntax

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

## Description

nag_lapack_dormbr (f08kg) is intended to be used after a call to nag_lapack_dgebrd (f08ke), which reduces a real rectangular matrix A$A$ to bidiagonal form B$B$ by an orthogonal transformation: A = QBPT$A=QB{P}^{\mathrm{T}}$. nag_lapack_dgebrd (f08ke) represents the matrices Q$Q$ and PT${P}^{\mathrm{T}}$ as products of elementary reflectors.
This function may be used to form one of the matrix products
 QC , QTC , CQ , CQT , PC , PTC , CP ​ or ​ CPT , $QC , QTC , CQ , CQT , PC , PTC , CP ​ or ​ CPT ,$
overwriting the result on C$C$ (which may be any real 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 PT${P}^{\mathrm{T}}$: 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 QT${Q}^{\mathrm{T}}$ or P$P$ or PT${P}^{\mathrm{T}}$ is to be applied to C$C$.
vect = 'Q'${\mathbf{vect}}=\text{'Q'}$
Q$Q$ or QT${Q}^{\mathrm{T}}$ is applied to C$C$.
vect = 'P'${\mathbf{vect}}=\text{'P'}$
P$P$ or PT${P}^{\mathrm{T}}$ 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 QT${Q}^{\mathrm{T}}$ or P$P$ or PT${P}^{\mathrm{T}}$ is to be applied to C$C$.
side = 'L'${\mathbf{side}}=\text{'L'}$
Q$Q$ or QT${Q}^{\mathrm{T}}$ or P$P$ or PT${P}^{\mathrm{T}}$ is applied to C$C$ from the left.
side = 'R'${\mathbf{side}}=\text{'R'}$
Q$Q$ or QT${Q}^{\mathrm{T}}$ or P$P$ or PT${P}^{\mathrm{T}}$ 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 QT${Q}^{\mathrm{T}}$ or PT${P}^{\mathrm{T}}$ is to be applied to C$C$.
trans = 'N'${\mathbf{trans}}=\text{'N'}$
Q$Q$ or P$P$ is applied to C$C$.
trans = 'T'${\mathbf{trans}}=\text{'T'}$
QT${Q}^{\mathrm{T}}$ or PT${P}^{\mathrm{T}}$ is applied to C$C$.
Constraint: trans = 'N'${\mathbf{trans}}=\text{'N'}$ or 'T'$\text{'T'}$.
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, : $:$) – double 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_dgebrd (f08ke).
6:     tau( : $:$) – double 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_dgebrd (f08ke) 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, : $:$) – double 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, : $:$) – double 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 QTC${Q}^{\mathrm{T}}C$ or CQ$CQ$ or CTQ${C}^{\mathrm{T}}Q$ or PC$PC$ or PTC${P}^{\mathrm{T}}C$ or CP$CP$ or CTP${C}^{\mathrm{T}}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 floating point operations is approximately
• if side = 'L'${\mathbf{side}}=\text{'L'}$ and mk$m\ge k$, 2nk(2mk)$2nk\left(2m-k\right)$;
• if side = 'R'${\mathbf{side}}=\text{'R'}$ and nk$n\ge k$, 2mk(2nk)$2mk\left(2n-k\right)$;
• if side = 'L'${\mathbf{side}}=\text{'L'}$ and m < k$m, 2m2n$2{m}^{2}n$;
• if side = 'R'${\mathbf{side}}=\text{'R'}$ and n < k$n, 2mn2$2m{n}^{2}$,
where k$k$ is the value of the parameter k
The complex analogue of this function is nag_lapack_zunmbr (f08ku).

## Example

```function nag_lapack_dormbr_example
vect = 'Q';
side = 'Right';
trans = 'No transpose';
k = int64(4);
a = [3.61767881382524, 1.258711404710556, -0.4667885339706592, -0.4109505449290541;
0, -2.416055340423328, -1.526154889941117, -0.2094556505641229;
0, 0.02040919619839952, 1.921310963709999, 1.189466677019391;
0, -0.3216264186905484, 0.1342281666124217, -1.426501541730861];
tau = [0;
1.811823817941776;
1.964603347174235;
0];
c = [-0.1575595925823212, 0.6743815182091041, -0.4571499642152959, 0.4488516451198497;
-0.5334912520769823, -0.3861089893314064, 0.2582527260774866, 0.3898174378676559;
0.6357667770865594, -0.2928230899594127, 0.01653842638455846, 0.1929529167768124;
-0.5334912520769823, -0.1691547055376643, -0.08342735451416805, -0.2349873193632054;
0.04146305067955822, -0.1593027920340203, 0.1474783037934707, 0.7436407646419895;
-0.005528406757274429, -0.5063529996817608, -0.83386806304906, 0.03351284255316388];
[cOut, info] = nag_lapack_dormbr(vect, side, trans, k, a, tau, c)
```
```

cOut =

-0.1576   -0.2690    0.2612    0.8513
-0.5335    0.5311   -0.2922    0.0184
0.6358    0.3495   -0.0250   -0.0210
-0.5335    0.0035    0.1537   -0.2592
0.0415    0.5572   -0.2917    0.4523
-0.0055    0.4614    0.8585   -0.0532

info =

0

```
```function f08kg_example
vect = 'Q';
side = 'Right';
trans = 'No transpose';
k = int64(4);
a = [3.61767881382524, 1.258711404710556, -0.4667885339706592, -0.4109505449290541;
0, -2.416055340423328, -1.526154889941117, -0.2094556505641229;
0, 0.02040919619839952, 1.921310963709999, 1.189466677019391;
0, -0.3216264186905484, 0.1342281666124217, -1.426501541730861];
tau = [0;
1.811823817941776;
1.964603347174235;
0];
c = [-0.1575595925823212, 0.6743815182091041, -0.4571499642152959, 0.4488516451198497;
-0.5334912520769823, -0.3861089893314064, 0.2582527260774866, 0.3898174378676559;
0.6357667770865594, -0.2928230899594127, 0.01653842638455846, 0.1929529167768124;
-0.5334912520769823, -0.1691547055376643, -0.08342735451416805, -0.2349873193632054;
0.04146305067955822, -0.1593027920340203, 0.1474783037934707, 0.7436407646419895;
-0.005528406757274429, -0.5063529996817608, -0.83386806304906, 0.03351284255316388];
[cOut, info] = f08kg(vect, side, trans, k, a, tau, c)
```
```

cOut =

-0.1576   -0.2690    0.2612    0.8513
-0.5335    0.5311   -0.2922    0.0184
0.6358    0.3495   -0.0250   -0.0210
-0.5335    0.0035    0.1537   -0.2592
0.0415    0.5572   -0.2917    0.4523
-0.0055    0.4614    0.8585   -0.0532

info =

0

```