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_dtrevc (f08qk)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_lapack_dtrevc (f08qk) computes selected left and/or right eigenvectors of a real upper quasi-triangular matrix.

Syntax

[select, vl, vr, m, info] = f08qk(job, howmny, select, t, vl, vr, mm, 'n', n)
[select, vl, vr, m, info] = nag_lapack_dtrevc(job, howmny, select, t, vl, vr, mm, 'n', n)

Description

nag_lapack_dtrevc (f08qk) computes left and/or right eigenvectors of a real upper quasi-triangular matrix T in canonical Schur form. Such a matrix arises from the Schur factorization of a real general matrix, as computed by nag_lapack_dhseqr (f08pe), for example.
The right eigenvector x, and the left eigenvector y, corresponding to an eigenvalue λ, are defined by:
Tx = λx   and   yHT = λyH or ​ TTy = λ-y .  
Note that even though T is real, λ, x and y may be complex. If x is an eigenvector corresponding to a complex eigenvalue λ, then the complex conjugate vector x- is the eigenvector corresponding to the complex conjugate eigenvalue λ-.
The function can compute the eigenvectors corresponding to selected eigenvalues, or it can compute all the eigenvectors. In the latter case the eigenvectors may optionally be pre-multiplied by an input matrix Q. Normally Q is an orthogonal matrix from the Schur factorization of a matrix A as A=QTQT; if x is a (left or right) eigenvector of T, then Qx is an eigenvector of A.
The eigenvectors are computed by forward or backward substitution. They are scaled so that, for a real eigenvector x, maxxi=1, and for a complex eigenvector, max Re xi + Im xi =1.

References

Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore

Parameters

Compulsory Input Parameters

1:     job – string (length ≥ 1)
Indicates whether left and/or right eigenvectors are to be computed.
job='R'
Only right eigenvectors are computed.
job='L'
Only left eigenvectors are computed.
job='B'
Both left and right eigenvectors are computed.
Constraint: job='R', 'L' or 'B'.
2:     howmny – string (length ≥ 1)
Indicates how many eigenvectors are to be computed.
howmny='A'
All eigenvectors (as specified by job) are computed.
howmny='B'
All eigenvectors (as specified by job) are computed and then pre-multiplied by the matrix Q (which is overwritten).
howmny='S'
Selected eigenvectors (as specified by job and select) are computed.
Constraint: howmny='A', 'B' or 'S'.
3:     select: – logical array
The dimension of the array select must be at least max1,n if howmny='S', and at least 1 otherwise
Specifies which eigenvectors are to be computed if howmny='S'. To obtain the real eigenvector corresponding to the real eigenvalue λj, selectj must be set true. To select the complex eigenvector corresponding to a complex conjugate pair of eigenvalues λj and λj+1, selectj and/or selectj+1 must be set true; the eigenvector corresponding to the first eigenvalue in the pair is computed.
4:     tldt: – double array
The first dimension of the array t must be at least max1,n.
The second dimension of the array t must be at least max1,n.
The n by n upper quasi-triangular matrix T in canonical Schur form, as returned by nag_lapack_dhseqr (f08pe).
5:     vlldvl: – double array
The first dimension, ldvl, of the array vl must satisfy
  • if job='L' or 'B', ldvln;
  • if job='R', ldvl1.
The second dimension of the array vl must be at least max1,mm if job='L' or 'B' and at least 1 if job='R'.
If howmny='B' and job='L' or 'B', vl must contain an n by n matrix Q (usually the matrix of Schur vectors returned by nag_lapack_dhseqr (f08pe)).
If howmny='A' or 'S', vl need not be set.
6:     vrldvr: – double array
The first dimension, ldvr, of the array vr must satisfy
  • if job='R' or 'B', ldvrn;
  • if job='L', ldvr1.
The second dimension of the array vr must be at least max1,mm if job='R' or 'B' and at least 1 if job='L'.
If howmny='B' and job='R' or 'B', vr must contain an n by n matrix Q (usually the matrix of Schur vectors returned by nag_lapack_dhseqr (f08pe)).
If howmny='A' or 'S', vr need not be set.
7:     mm int64int32nag_int scalar
The number of columns in the arrays vl and/or vr. The precise number of columns required, m, is n if howmny='A' or 'B'; if howmny='S', m is obtained by counting 1 for each selected real eigenvector and 2 for each selected complex eigenvector (see select), in which case 0mn.
Constraints:
  • if howmny='A' or 'B', mmn;
  • otherwise mmm.

Optional Input Parameters

1:     n int64int32nag_int scalar
Default: the first dimension of the array t and the second dimension of the array t. (An error is raised if these dimensions are not equal.)
n, the order of the matrix T.
Constraint: n0.

Output Parameters

1:     select: – logical array
The dimension of the array select will be max1,n if howmny='S' and 1 otherwise
If a complex eigenvector was selected as specified above, then selectj is set to true and selectj+1 to false.
If howmny='A' or 'B', select is not referenced.
2:     vlldvl: – double array
The first dimension, ldvl, of the array vl will be
  • if job='L' or 'B', ldvl=n;
  • if job='R', ldvl=1.
The second dimension of the array vl will be max1,mm if job='L' or 'B' and at least 1 if job='R'.
If job='L' or 'B', vl contains the computed left eigenvectors (as specified by howmny and select). The eigenvectors are stored consecutively in the columns of the array, in the same order as their eigenvalues. Corresponding to each real eigenvalue is a real eigenvector, occupying one column. Corresponding to each complex conjugate pair of eigenvalues, is a complex eigenvector occupying two columns; the first column holds the real part and the second column holds the imaginary part.
If job='R', vl is not referenced.
3:     vrldvr: – double array
The first dimension, ldvr, of the array vr will be
  • if job='R' or 'B', ldvr=n;
  • if job='L', ldvr=1.
The second dimension of the array vr will be max1,mm if job='R' or 'B' and at least 1 if job='L'.
If job='R' or 'B', vr contains the computed right eigenvectors (as specified by howmny and select). The eigenvectors are stored consecutively in the columns of the array, in the same order as their eigenvalues. Corresponding to each real eigenvalue is a real eigenvector, occupying one column. Corresponding to each complex conjugate pair of eigenvalues, is a complex eigenvector occupying two columns; the first column holds the real part and the second column holds the imaginary part.
If job='L', vr is not referenced.
4:     m int64int32nag_int scalar
m, the number of columns of vl and/or vr actually used to store the computed eigenvectors. If howmny='A' or 'B', m is set to n.
5:     info int64int32nag_int scalar
info=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

   info=-i
If info=-i, parameter i had an illegal value on entry. The parameters are numbered as follows:
1: job, 2: howmny, 3: select, 4: n, 5: t, 6: ldt, 7: vl, 8: ldvl, 9: vr, 10: ldvr, 11: mm, 12: m, 13: work, 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.
   info=-11
On entry, mm=_ and n=_.
Constraint: if howmny'S', mmn
else mmm, where m is obtained by counting 1 for each selected real eigenvector and 2 for each selected complex eigenvector.

Accuracy

If xi is an exact right eigenvector, and x~i is the corresponding computed eigenvector, then the angle θx~i,xi between them is bounded as follows:
θ x~i,xi c n ε T2 sepi  
where sepi is the reciprocal condition number of xi.
The condition number sepi may be computed by calling nag_lapack_dtrsna (f08ql).

Further Comments

For a description of canonical Schur form, see the document for nag_lapack_dhseqr (f08pe).
The complex analogue of this function is nag_lapack_ztrevc (f08qx).

Example

See Example in nag_lapack_dgebal (f08nh).
function f08qk_example


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

n = int64(4);
a = [ 5.14, 0.91,  0.00, -32.80;
      0.91, 0.20,  0.00,  34.50;
      1.90, 0.80, -0.40,  -3.00;
     -0.33, 0.35,  0.00,   0.66];

% Balance a
[a, ilo, ihi, scale, info] = f08nh( ...
                                    'Both', a);

% Reduce a to upper Hessenberg form
[H, tau, info] = f08ne( ...
                        ilo, ihi, a);

% Form Q
[Q, info] = f08nf( ...
                   ilo, ihi, H, tau);

% Calculate the eigenvalues and Schur factorisation of A
[H, wr, wi, Z, info] = f08pe( ...
                              'Schur Form', 'Vectors', ilo, ihi, H, Q);

w = wr + i*wi;
disp('Eigenvalues:');
disp(w);

% Calculate the eigenvectors of A
[select, ~, VR, m, info] = ...
f08qk( ...
       'Right', 'Backtransform', false, H, zeros(1), Z, n);

% Back scale to get eigenvectors of A
[VR, info] = f08nj( ...
                    'Both', 'Right', ilo, ihi, scale, VR);

% Normalize eigenvectors: largest element positive
for j = 1:n
  [~,k] = max(abs(VR(:,j)));
  VR(:,j) =VR(:,j)/norm(VR(:,j));
  if VR(k,j) < 0;
    VR(:,j) = -VR(:,j);
  end
end                            

disp('Eigenvectors:');
disp(VR);


f08qk example results

Eigenvalues:
   -0.4000
   -4.0208
    3.0136
    7.0072

Eigenvectors:
         0   -0.4381    0.4654    0.9513
         0    0.8923    0.7888   -0.1714
    1.0000   -0.0481    0.3981    0.2494
         0   -0.0976    0.0521   -0.0589


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