Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

# NAG Toolbox: nag_lapack_zgeev (f08nn)

## Purpose

nag_lapack_zgeev (f08nn) computes the eigenvalues and, optionally, the left and/or right eigenvectors for an $n$ by $n$ complex nonsymmetric matrix $A$.

## Syntax

[a, w, vl, vr, info] = f08nn(jobvl, jobvr, a, 'n', n)
[a, w, vl, vr, info] = nag_lapack_zgeev(jobvl, jobvr, a, 'n', n)

## Description

The right eigenvector ${v}_{j}$ of $A$ satisfies
 $A vj = λj vj$
where ${\lambda }_{j}$ is the $j$th eigenvalue of $A$. The left eigenvector ${u}_{j}$ of $A$ satisfies
 $ujH A = λj ujH$
where ${u}_{j}^{\mathrm{H}}$ denotes the conjugate transpose of ${u}_{j}$.
The matrix $A$ is first reduced to upper Hessenberg form by means of unitary similarity transformations, and the $QR$ algorithm is then used to further reduce the matrix to upper triangular Schur form, $T$, from which the eigenvalues are computed. Optionally, the eigenvectors of $T$ are also computed and backtransformed to those of $A$.

## References

Anderson E, Bai Z, Bischof C, Blackford S, Demmel J, Dongarra J J, Du Croz J J, Greenbaum A, Hammarling S, McKenney A and Sorensen D (1999) LAPACK Users' Guide (3rd Edition) SIAM, Philadelphia http://www.netlib.org/lapack/lug
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore

## Parameters

### Compulsory Input Parameters

1:     $\mathrm{jobvl}$ – string (length ≥ 1)
If ${\mathbf{jobvl}}=\text{'N'}$, the left eigenvectors of $A$ are not computed.
If ${\mathbf{jobvl}}=\text{'V'}$, the left eigenvectors of $A$ are computed.
Constraint: ${\mathbf{jobvl}}=\text{'N'}$ or $\text{'V'}$.
2:     $\mathrm{jobvr}$ – string (length ≥ 1)
If ${\mathbf{jobvr}}=\text{'N'}$, the right eigenvectors of $A$ are not computed.
If ${\mathbf{jobvr}}=\text{'V'}$, the right eigenvectors of $A$ are computed.
Constraint: ${\mathbf{jobvr}}=\text{'N'}$ or $\text{'V'}$.
3:     $\mathrm{a}\left(\mathit{lda},:\right)$ – complex array
The first dimension of the array a must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
The second dimension of the array a must be at least $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
The $n$ by $n$ matrix $A$.

### Optional Input Parameters

1:     $\mathrm{n}$int64int32nag_int scalar
Default: the first dimension of the array a and the second dimension of the array a. (An error is raised if these dimensions are not equal.)
$n$, the order of the matrix $A$.
Constraint: ${\mathbf{n}}\ge 0$.

### Output Parameters

1:     $\mathrm{a}\left(\mathit{lda},:\right)$ – complex array
The first dimension of the array a will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
The second dimension of the array a will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$.
2:     $\mathrm{w}\left(:\right)$ – complex array
The dimension of the array w will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$
Contains the computed eigenvalues.
3:     $\mathrm{vl}\left(\mathit{ldvl},:\right)$ – complex array
The first dimension, $\mathit{ldvl}$, of the array vl will be
• if ${\mathbf{jobvl}}=\text{'V'}$, $\mathit{ldvl}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• otherwise $\mathit{ldvl}=1$.
The second dimension of the array vl will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$ if ${\mathbf{jobvl}}=\text{'V'}$ and $1$ otherwise.
If ${\mathbf{jobvl}}=\text{'V'}$, the left eigenvectors ${u}_{j}$ are stored one after another in the columns of vl, in the same order as their corresponding eigenvalues; that is ${u}_{j}={\mathbf{vl}}\left(:,j\right)$, the $j$th column of vl.
If ${\mathbf{jobvl}}=\text{'N'}$, vl is not referenced.
4:     $\mathrm{vr}\left(\mathit{ldvr},:\right)$ – complex array
The first dimension, $\mathit{ldvr}$, of the array vr will be
• if ${\mathbf{jobvr}}=\text{'V'}$, $\mathit{ldvr}=\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$;
• otherwise $\mathit{ldvr}=1$.
The second dimension of the array vr will be $\mathrm{max}\phantom{\rule{0.125em}{0ex}}\left(1,{\mathbf{n}}\right)$ if ${\mathbf{jobvr}}=\text{'V'}$ and $1$ otherwise.
If ${\mathbf{jobvr}}=\text{'V'}$, the right eigenvectors ${v}_{j}$ are stored one after another in the columns of vr, in the same order as their corresponding eigenvalues; that is ${v}_{j}={\mathbf{vr}}\left(:,j\right)$, the $j$th column of vr.
If ${\mathbf{jobvr}}=\text{'N'}$, vr is not referenced.
5:     $\mathrm{info}$int64int32nag_int scalar
${\mathbf{info}}=0$ unless the function detects an error (see Error Indicators and Warnings).

## Error Indicators and Warnings

Cases prefixed with W are classified as warnings and do not generate an error of type NAG:error_n. See nag_issue_warnings.

${\mathbf{info}}=-i$
If ${\mathbf{info}}=-i$, parameter $i$ had an illegal value on entry. The parameters are numbered as follows:
1: jobvl, 2: jobvr, 3: n, 4: a, 5: lda, 6: w, 7: vl, 8: ldvl, 9: vr, 10: ldvr, 11: work, 12: lwork, 13: rwork, 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.
W  ${\mathbf{info}}>0$
If ${\mathbf{info}}=i$, the $QR$ algorithm failed to compute all the eigenvalues, and no eigenvectors have been computed; elements $i+1:{\mathbf{n}}$ of w contain eigenvalues which have converged.

## Accuracy

The computed eigenvalues and eigenvectors are exact for a nearby matrix $\left(A+E\right)$, where
 $E2 = Oε A2 ,$
and $\epsilon$ is the machine precision. See Section 4.8 of Anderson et al. (1999) for further details.

Each eigenvector is normalized to have Euclidean norm equal to unity and the element of largest absolute value real.
The total number of floating-point operations is proportional to ${n}^{3}$.
The real analogue of this function is nag_lapack_dgeev (f08na).

## Example

This example finds all the eigenvalues and right eigenvectors of the matrix
 $A = -3.97-5.04i -4.11+3.70i -0.34+1.01i 1.29-0.86i 0.34-1.50i 1.52-0.43i 1.88-5.38i 3.36+0.65i 3.31-3.85i 2.50+3.45i 0.88-1.08i 0.64-1.48i -1.10+0.82i 1.81-1.59i 3.25+1.33i 1.57-3.44i .$
Note that the block size (NB) of $64$ assumed in this example is not realistic for such a small problem, but should be suitable for large problems.
```function f08nn_example

fprintf('f08nn example results\n\n');

% Complex matrix A
n = 4;
a = [-3.97 - 5.04i, -4.11 + 3.70i, -0.34 + 1.01i,  1.29 - 0.86i;
0.34 - 1.50i,  1.52 - 0.43i,  1.88 - 5.38i,  3.36 + 0.65i;
3.31 - 3.85i,  2.50 + 3.45i,  0.88 - 1.08i,  0.64 - 1.48i;
-1.10 + 0.82i,  1.81 - 1.59i,  3.25 + 1.33i,  1.57 - 3.44i];

% Eigenvalues and right eigenvectors of A
jobvl = 'No left vectors';
jobvr = 'Vectors (right)';
[~, w, ~, z, info] = f08nn( ...
jobvl, jobvr, a);

% Normalize eigenvectors: largest elements are real
for i = 1:n
[~,k] = max(abs(real(z(:,i)))+abs(imag(z(:,i))));
z(:,i) = z(:,i)*conj(z(k,i))/abs(z(k,i));
end

disp('Eigenvalues');
disp(w);
disp('Eigenvectors');
disp(z);

```
```f08nn example results

Eigenvalues
-6.0004 - 6.9998i
-5.0000 + 2.0060i
7.9982 - 0.9964i
3.0023 - 3.9998i

Eigenvectors
0.8457 + 0.0000i   0.3745 + 0.1979i   0.1254 + 0.2923i  -0.0356 - 0.1782i
-0.0177 + 0.3036i   0.5748 + 0.0000i   0.3855 - 0.5752i   0.1264 + 0.2666i
0.0875 + 0.3115i  -0.3771 - 0.4825i   0.5971 + 0.0000i   0.0129 - 0.2966i
-0.0561 - 0.2906i  -0.2058 + 0.2699i   0.1272 - 0.2162i   0.8898 + 0.0000i

```

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015