hide long namesshow long names
hide short namesshow short names
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_zgeevx (f08np)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_lapack_zgeevx (f08np) computes the eigenvalues and, optionally, the left and/or right eigenvectors for an n by n complex nonsymmetric matrix A.
Optionally, it also computes a balancing transformation to improve the conditioning of the eigenvalues and eigenvectors, reciprocal condition numbers for the eigenvalues, and reciprocal condition numbers for the right eigenvectors.

Syntax

[a, w, vl, vr, ilo, ihi, scale, abnrm, rconde, rcondv, info] = f08np(balanc, jobvl, jobvr, sense, a, 'n', n)
[a, w, vl, vr, ilo, ihi, scale, abnrm, rconde, rcondv, info] = nag_lapack_zgeevx(balanc, jobvl, jobvr, sense, a, 'n', n)

Description

The right eigenvector vj of A satisfies
A vj = λj vj  
where λj is the jth eigenvalue of A. The left eigenvector uj of A satisfies
ujH A = λj ujH  
where ujH denotes the conjugate transpose of uj.
Balancing a matrix means permuting the rows and columns to make it more nearly upper triangular, and applying a diagonal similarity transformation DAD-1, where D is a diagonal matrix, with the aim of making its rows and columns closer in norm and the condition numbers of its eigenvalues and eigenvectors smaller. The computed reciprocal condition numbers correspond to the balanced matrix. Permuting rows and columns will not change the condition numbers (in exact arithmetic) but diagonal scaling will. For further explanation of balancing, see Section 4.8.1.2 of Anderson et al. (1999).
Following the optional balancing, 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:     balanc – string (length ≥ 1)
Indicates how the input matrix should be diagonally scaled and/or permuted to improve the conditioning of its eigenvalues.
balanc='N'
Do not diagonally scale or permute.
balanc='P'
Perform permutations to make the matrix more nearly upper triangular. Do not diagonally scale.
balanc='S'
Diagonally scale the matrix, i.e., replace A by DAD-1, where D is a diagonal matrix chosen to make the rows and columns of A more equal in norm. Do not permute.
balanc='B'
Both diagonally scale and permute A.
Computed reciprocal condition numbers will be for the matrix after balancing and/or permuting. Permuting does not change condition numbers (in exact arithmetic), but balancing does.
Constraint: balanc='N', 'P', 'S' or 'B'.
2:     jobvl – string (length ≥ 1)
If jobvl='N', the left eigenvectors of A are not computed.
If jobvl='V', the left eigenvectors of A are computed.
If sense='E' or 'B', jobvl must be set to jobvl='V'.
Constraint: jobvl='N' or 'V'.
3:     jobvr – string (length ≥ 1)
If jobvr='N', the right eigenvectors of A are not computed.
If jobvr='V', the right eigenvectors of A are computed.
If sense='E' or 'B', jobvr must be set to jobvr='V'.
Constraint: jobvr='N' or 'V'.
4:     sense – string (length ≥ 1)
Determines which reciprocal condition numbers are computed.
sense='N'
None are computed.
sense='E'
Computed for eigenvalues only.
sense='V'
Computed for right eigenvectors only.
sense='B'
Computed for eigenvalues and right eigenvectors.
If sense='E' or 'B', both left and right eigenvectors must also be computed (jobvl='V' and jobvr='V').
Constraint: sense='N', 'E', 'V' or 'B'.
5:     alda: – complex array
The first dimension of the array a must be at least max1,n.
The second dimension of the array a must be at least max1,n.
The n by n matrix A.

Optional Input Parameters

1:     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: n0.

Output Parameters

1:     alda: – complex array
The first dimension of the array a will be max1,n.
The second dimension of the array a will be max1,n.
a has been overwritten. If jobvl='V' or jobvr='V', A contains the Schur form of the balanced version of the matrix A.
2:     w: – complex array
The dimension of the array w will be max1,n
Contains the computed eigenvalues.
3:     vlldvl: – complex array
The first dimension, ldvl, of the array vl will be
  • if jobvl='V', ldvl= max1,n ;
  • otherwise ldvl=1.
The second dimension of the array vl will be max1,n if jobvl='V' and 1 otherwise.
If jobvl='V', the left eigenvectors uj are stored one after another in the columns of vl, in the same order as their corresponding eigenvalues; that is uj=vl:j, the jth column of vl.
If jobvl='N', vl is not referenced.
4:     vrldvr: – complex array
The first dimension, ldvr, of the array vr will be
  • if jobvr='V', ldvr= max1,n ;
  • otherwise ldvr=1.
The second dimension of the array vr will be max1,n if jobvr='V' and 1 otherwise.
If jobvr='V', the right eigenvectors vj are stored one after another in the columns of vr, in the same order as their corresponding eigenvalues; that is vj=vr:j, the jth column of vr.
If jobvr='N', vr is not referenced.
5:     ilo int64int32nag_int scalar
6:     ihi int64int32nag_int scalar
ilo and ihi are integer values determined when A was balanced. The balanced A has aij=0 if i>j and j=1,2,,ilo-1 or i=ihi+1,,n.
7:     scale: – double array
The dimension of the array scale will be max1,n
Details of the permutations and scaling factors applied when balancing A.
If pj is the index of the row and column interchanged with row and column j, and dj is the scaling factor applied to row and column j, then
  • scalej=pj, for j=1,2,,ilo-1;
  • scalej=dj, for j=ilo,,ihi;
  • scalej=pj, for j=ihi+1,,n.
The order in which the interchanges are made is n to ihi+1, then 1 to ilo-1.
8:     abnrm – double scalar
The 1-norm of the balanced matrix (the maximum of the sum of absolute values of elements of any column).
9:     rconde: – double array
The dimension of the array rconde will be max1,n
rcondej is the reciprocal condition number of the jth eigenvalue.
10:   rcondv: – double array
The dimension of the array rcondv will be max1,n
rcondvj is the reciprocal condition number of the jth right eigenvector.
11:   info int64int32nag_int scalar
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.

   info=-i
If info=-i, parameter i had an illegal value on entry. The parameters are numbered as follows:
1: balanc, 2: jobvl, 3: jobvr, 4: sense, 5: n, 6: a, 7: lda, 8: w, 9: vl, 10: ldvl, 11: vr, 12: ldvr, 13: ilo, 14: ihi, 15: scale, 16: abnrm, 17: rconde, 18: rcondv, 19: work, 20: lwork, 21: rwork, 22: 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  info>0
If info=i, the QR algorithm failed to compute all the eigenvalues, and no eigenvectors or condition numbers have been computed; elements 1:ilo-1 and i+1:n of w contain eigenvalues which have converged.

Accuracy

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

Further Comments

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 n3.
The real analogue of this function is nag_lapack_dgeevx (f08nb).

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 ,  
together with estimates of the condition number and forward error bounds for each eigenvalue and eigenvector. The option to balance the matrix is used. In order to compute the condition numbers of the eigenvalues, the left eigenvectors also have to be computed, but they are not printed out in this example.
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 f08np_example


fprintf('f08np 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 left and right eigenvectors of A after matrix balancing
balanc = 'Balance';
jobvl = 'Vectors (left)';
jobvr = 'Vectors (right)';
sense = 'Both reciprocal condition numbers';
[a, w, vl, vr, ilo, ihi, scale, abnrm, rconde, rcondv, info] = ...
f08np( ...
       balanc, jobvl, jobvr, sense, a);

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

disp('Eigenvalues');
fprintf('\n        Eigenvalue                  rcond\n\n');
for j=1:n
  fprintf('%3d',j);
  if imag(w(j))<0
    fprintf('%15.4e - %10.4ei%10.4f\n',real(w(j)),abs(imag(w(j))),rconde(j));
  else
    fprintf('%15.4e + %10.4ei%10.4f\n',real(w(j)),imag(w(j)),rconde(j));
  end
end

fprintf('\nRight Eigenvectors\n\n');
fprintf('        Eigenvector                 rcond\n');
for j = 1:n
  fprintf('\n%3d',j);
  for l = 1:n
    if (l>1)
      fprintf('%3s', ' ');
    end
    if imag(vr(l,k))>0
      fprintf('%15.4e + %10.4ei', real(vr(l,k)), imag(vr(l,k)));
    else
      fprintf('%15.4e - %10.4ei', real(vr(l,k)), abs(imag(vr(l,k))));
    end
    if l==1
      fprintf('%10.4f', rcondv(j));
    end
    fprintf('\n');
  end
end


f08np example results

Eigenvalues

        Eigenvalue                  rcond

  1    -6.0004e+00 - 6.9998e+00i    0.9932
  2    -5.0000e+00 + 2.0060e+00i    0.9964
  3     7.9982e+00 - 9.9637e-01i    0.9814
  4     3.0023e+00 - 3.9998e+00i    0.9779

Right Eigenvectors

        Eigenvector                 rcond

  1    -3.5614e-02 - 1.7822e-01i    8.4011
        1.2637e-01 + 2.6663e-01i
        1.2933e-02 - 2.9657e-01i
        8.8982e-01 - 0.0000e+00i

  2    -3.5614e-02 - 1.7822e-01i    8.0214
        1.2637e-01 + 2.6663e-01i
        1.2933e-02 - 2.9657e-01i
        8.8982e-01 - 0.0000e+00i

  3    -3.5614e-02 - 1.7822e-01i    5.8292
        1.2637e-01 + 2.6663e-01i
        1.2933e-02 - 2.9657e-01i
        8.8982e-01 - 0.0000e+00i

  4    -3.5614e-02 - 1.7822e-01i    5.8292
        1.2637e-01 + 2.6663e-01i
        1.2933e-02 - 2.9657e-01i
        8.8982e-01 - 0.0000e+00i

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