# NAG Library Routine Document

## 1Purpose

f08nwf (zgebak) transforms eigenvectors of a balanced matrix to those of the original complex general matrix.

## 2Specification

Fortran Interface
 Subroutine f08nwf ( job, side, n, ilo, ihi, m, v, ldv, info)
 Integer, Intent (In) :: n, ilo, ihi, m, ldv Integer, Intent (Out) :: info Real (Kind=nag_wp), Intent (In) :: scale(*) Complex (Kind=nag_wp), Intent (Inout) :: v(ldv,*) Character (1), Intent (In) :: job, side
#include nagmk26.h
 void f08nwf_ (const char *job, const char *side, const Integer *n, const Integer *ilo, const Integer *ihi, const double scal[], const Integer *m, Complex v[], const Integer *ldv, Integer *info, const Charlen length_job, const Charlen length_side)
The routine may be called by its LAPACK name zgebak.

## 3Description

f08nwf (zgebak) is intended to be used after a complex general matrix $A$ has been balanced by f08nvf (zgebal), and eigenvectors of the balanced matrix ${A}_{22}^{\prime \prime }$ have subsequently been computed.
For a description of balancing, see the document for f08nvf (zgebal). The balanced matrix ${A}^{\prime \prime }$ is obtained as ${A}^{\prime \prime }=DPA{P}^{\mathrm{T}}{D}^{-1}$, where $P$ is a permutation matrix and $D$ is a diagonal scaling matrix. This routine transforms left or right eigenvectors as follows:
• if $x$ is a right eigenvector of ${A}^{\prime \prime }$, ${P}^{\mathrm{T}}{D}^{-1}x$ is a right eigenvector of $A$;
• if $y$ is a left eigenvector of ${A}^{\prime \prime }$, ${P}^{\mathrm{T}}Dy$ is a left eigenvector of $A$.
None.

## 5Arguments

1:     $\mathbf{job}$ – Character(1)Input
On entry: this must be the same argument job as supplied to f08nvf (zgebal).
Constraint: ${\mathbf{job}}=\text{'N'}$, $\text{'P'}$, $\text{'S'}$ or $\text{'B'}$.
2:     $\mathbf{side}$ – Character(1)Input
On entry: indicates whether left or right eigenvectors are to be transformed.
${\mathbf{side}}=\text{'L'}$
The left eigenvectors are transformed.
${\mathbf{side}}=\text{'R'}$
The right eigenvectors are transformed.
Constraint: ${\mathbf{side}}=\text{'L'}$ or $\text{'R'}$.
3:     $\mathbf{n}$ – IntegerInput
On entry: $n$, the number of rows of the matrix of eigenvectors.
Constraint: ${\mathbf{n}}\ge 0$.
4:     $\mathbf{ilo}$ – IntegerInput
5:     $\mathbf{ihi}$ – IntegerInput
On entry: the values ${i}_{\mathrm{lo}}$ and ${i}_{\mathrm{hi}}$, as returned by f08nvf (zgebal).
Constraints:
• if ${\mathbf{n}}>0$, $1\le {\mathbf{ilo}}\le {\mathbf{ihi}}\le {\mathbf{n}}$;
• if ${\mathbf{n}}=0$, ${\mathbf{ilo}}=1$ and ${\mathbf{ihi}}=0$.
6:     $\mathbf{scale}\left(*\right)$ – Real (Kind=nag_wp) arrayInput
Note: the dimension of the array scale must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
On entry: details of the permutations and/or the scaling factors used to balance the original complex general matrix, as returned by f08nvf (zgebal).
7:     $\mathbf{m}$ – IntegerInput
On entry: $m$, the number of columns of the matrix of eigenvectors.
Constraint: ${\mathbf{m}}\ge 0$.
8:     $\mathbf{v}\left({\mathbf{ldv}},*\right)$ – Complex (Kind=nag_wp) arrayInput/Output
Note: the second dimension of the array v must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{m}}\right)$.
On entry: the matrix of left or right eigenvectors to be transformed.
On exit: the transformed eigenvectors.
9:     $\mathbf{ldv}$ – IntegerInput
On entry: the first dimension of the array v as declared in the (sub)program from which f08nwf (zgebak) is called.
Constraint: ${\mathbf{ldv}}\ge \mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
10:   $\mathbf{info}$ – IntegerOutput
On exit: ${\mathbf{info}}=0$ unless the routine detects an error (see Section 6).

## 6Error Indicators and Warnings

${\mathbf{info}}<0$
If ${\mathbf{info}}=-i$, argument $i$ had an illegal value. An explanatory message is output, and execution of the program is terminated.

## 7Accuracy

The errors are negligible.

## 8Parallelism and Performance

f08nwf (zgebak) makes calls to BLAS and/or LAPACK routines, which may be threaded within the vendor library used by this implementation. Consult the documentation for the vendor library for further information.
Please consult the X06 Chapter Introduction for information on how to control and interrogate the OpenMP environment used within this routine. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

The total number of real floating-point operations is approximately proportional to $nm$.