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_dgebak (f08nj)

## Purpose

nag_lapack_dgebak (f08nj) transforms eigenvectors of a balanced matrix to those of the original real nonsymmetric matrix.

## Syntax

[v, info] = f08nj(job, side, ilo, ihi, scale, v, 'n', n, 'm', m)
[v, info] = nag_lapack_dgebak(job, side, ilo, ihi, scale, v, 'n', n, 'm', m)

## Description

nag_lapack_dgebak (f08nj) is intended to be used after a real nonsymmetric matrix A$A$ has been balanced by nag_lapack_dgebal (f08nh), and eigenvectors of the balanced matrix A22${A}_{22}^{\prime \prime }$ have subsequently been computed.
For a description of balancing, see the document for nag_lapack_dgebal (f08nh). The balanced matrix A${A}^{\prime \prime }$ is obtained as A = DPAPTD1${A}^{\prime \prime }=DPA{P}^{\mathrm{T}}{D}^{-1}$, where P$P$ is a permutation matrix and D$D$ is a diagonal scaling matrix. This function transforms left or right eigenvectors as follows:
• if x$x$ is a right eigenvector of A${A}^{\prime \prime }$, PTD1x${P}^{\mathrm{T}}{D}^{-1}x$ is a right eigenvector of A$A$;
• if y$y$ is a left eigenvector of A${A}^{\prime \prime }$, PTDy${P}^{\mathrm{T}}Dy$ is a left eigenvector of A$A$.

None.

## Parameters

### Compulsory Input Parameters

1:     job – string (length ≥ 1)
This must be the same parameter job as supplied to nag_lapack_dgebal (f08nh).
Constraint: job = 'N'${\mathbf{job}}=\text{'N'}$, 'P'$\text{'P'}$, 'S'$\text{'S'}$ or 'B'$\text{'B'}$.
2:     side – string (length ≥ 1)
Indicates whether left or right eigenvectors are to be transformed.
side = 'L'${\mathbf{side}}=\text{'L'}$
The left eigenvectors are transformed.
side = 'R'${\mathbf{side}}=\text{'R'}$
The right eigenvectors are transformed.
Constraint: side = 'L'${\mathbf{side}}=\text{'L'}$ or 'R'$\text{'R'}$.
3:     ilo – int64int32nag_int scalar
4:     ihi – int64int32nag_int scalar
The values ilo${i}_{\mathrm{lo}}$ and ihi${i}_{\mathrm{hi}}$, as returned by nag_lapack_dgebal (f08nh).
Constraints:
• if n > 0${\mathbf{n}}>0$, 1 ilo ihi n $1\le {\mathbf{ilo}}\le {\mathbf{ihi}}\le {\mathbf{n}}$;
• if n = 0${\mathbf{n}}=0$, ilo = 1${\mathbf{ilo}}=1$ and ihi = 0${\mathbf{ihi}}=0$.
5:     scale( : $:$) – double array
Note: the dimension of the array scale must be at least max (1,n)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
Details of the permutations and/or the scaling factors used to balance the original real nonsymmetric matrix, as returned by nag_lapack_dgebal (f08nh).
6:     v(ldv, : $:$) – double array
The first dimension of the array v must be at least max (1,n)$\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)$
The matrix of left or right eigenvectors to be transformed.

### Optional Input Parameters

1:     n – int64int32nag_int scalar
Default: The first dimension of the array v.
n$n$, the number of rows of the matrix of eigenvectors.
Constraint: n0${\mathbf{n}}\ge 0$.
2:     m – int64int32nag_int scalar
Default: The second dimension of the array v.
m$m$, the number of columns of the matrix of eigenvectors.
Constraint: m0${\mathbf{m}}\ge 0$.

ldv

### Output Parameters

1:     v(ldv, : $:$) – double array
The first dimension of the array v 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,m)$\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$
ldv max (1,n) $\mathit{ldv}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
The transformed eigenvectors.
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: job, 2: side, 3: n, 4: ilo, 5: ihi, 6: scale, 7: m, 8: v, 9: ldv, 10: 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 errors are negligible.

The total number of floating point operations is approximately proportional to nm$nm$.
The complex analogue of this function is nag_lapack_zgebak (f08nw).

## Example

```function nag_lapack_dgebak_example
job = 'Both';
side = 'Right';
ilo = int64(2);
ihi = int64(4);
scale = [3;
8;
8;
1];
v = [1, -0.4314180584465899, -1, -1;
0, 1, -0.247654150974541, 0.08591655381643525;
0, -0.4910063736255747, -0.146105421622948, -0.4768657196218895;
0, -0.8751224464247366, -0.1307439268438695, 0.236243720668051];
[vOut, info] = nag_lapack_dgebak(job, side, ilo, ihi, scale, v)
```
```

vOut =

0   -3.9281   -1.1688   -3.8149
0    8.0000   -1.9812    0.6873
1.0000   -0.4314   -1.0000   -1.0000
0   -0.8751   -0.1307    0.2362

info =

0

```
```function f08nj_example
job = 'Both';
side = 'Right';
ilo = int64(2);
ihi = int64(4);
scale = [3;
8;
8;
1];
v = [1, -0.4314180584465899, -1, -1;
0, 1, -0.247654150974541, 0.08591655381643525;
0, -0.4910063736255747, -0.146105421622948, -0.4768657196218895;
0, -0.8751224464247366, -0.1307439268438695, 0.236243720668051];
[vOut, info] = f08nj(job, side, ilo, ihi, scale, v)
```
```

vOut =

0   -3.9281   -1.1688   -3.8149
0    8.0000   -1.9812    0.6873
1.0000   -0.4314   -1.0000   -1.0000
0   -0.8751   -0.1307    0.2362

info =

0

```