NAG C Library Function Document

nag_dtrevc (f08qkc)

1
Purpose

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

2
Specification

#include <nag.h>
#include <nagf08.h>
void  nag_dtrevc (Nag_OrderType order, Nag_SideType side, Nag_HowManyType how_many, Nag_Boolean select[], Integer n, const double t[], Integer pdt, double vl[], Integer pdvl, double vr[], Integer pdvr, Integer mm, Integer *m, NagError *fail)

3
Description

nag_dtrevc (f08qkc) 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_dhseqr (f08pec), 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.

4
References

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

5
Arguments

1:     order Nag_OrderTypeInput
On entry: the order argument specifies the two-dimensional storage scheme being used, i.e., row-major ordering or column-major ordering. C language defined storage is specified by order=Nag_RowMajor. See Section 3.3.1.3 in How to Use the NAG Library and its Documentation for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2:     side Nag_SideTypeInput
On entry: indicates whether left and/or right eigenvectors are to be computed.
side=Nag_RightSide
Only right eigenvectors are computed.
side=Nag_LeftSide
Only left eigenvectors are computed.
side=Nag_BothSides
Both left and right eigenvectors are computed.
Constraint: side=Nag_RightSide, Nag_LeftSide or Nag_BothSides.
3:     how_many Nag_HowManyTypeInput
On entry: indicates how many eigenvectors are to be computed.
how_many=Nag_ComputeAll
All eigenvectors (as specified by side) are computed.
how_many=Nag_BackTransform
All eigenvectors (as specified by side) are computed and then pre-multiplied by the matrix Q (which is overwritten).
how_many=Nag_ComputeSelected
Selected eigenvectors (as specified by side and select) are computed.
Constraint: how_many=Nag_ComputeAll, Nag_BackTransform or Nag_ComputeSelected.
4:     select[dim] Nag_BooleanInput/Output
Note: the dimension, dim, of the array select must be at least
  • n when how_many=Nag_ComputeSelected;
  • otherwise select may be NULL.
On entry: specifies which eigenvectors are to be computed if how_many=Nag_ComputeSelected. To obtain the real eigenvector corresponding to the real eigenvalue λj, select[j-1] must be set Nag_TRUE. To select the complex eigenvector corresponding to a complex conjugate pair of eigenvalues λj and λj+1, select[j-1] and/or select[j] must be set Nag_TRUE; the eigenvector corresponding to the first eigenvalue in the pair is computed.
On exit: if a complex eigenvector was selected as specified above, select[j-1] is set to Nag_TRUE and select[j] to Nag_FALSE.
If how_many=Nag_ComputeAll or Nag_BackTransform, select is not referenced and may be NULL.
5:     n IntegerInput
On entry: n, the order of the matrix T.
Constraint: n0.
6:     t[dim] const doubleInput
Note: the dimension, dim, of the array t must be at least pdt×n.
The i,jth element of the matrix T is stored in
  • t[j-1×pdt+i-1] when order=Nag_ColMajor;
  • t[i-1×pdt+j-1] when order=Nag_RowMajor.
On entry: the n by n upper quasi-triangular matrix T in canonical Schur form, as returned by nag_dhseqr (f08pec).
7:     pdt IntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array t.
Constraint: pdt max1,n .
8:     vl[dim] doubleInput/Output
Note: the dimension, dim, of the array vl must be at least
  • pdvl×mm when side=Nag_LeftSide or Nag_BothSides and order=Nag_ColMajor;
  • n×pdvl when side=Nag_LeftSide or Nag_BothSides and order=Nag_RowMajor;
  • otherwise vl may be NULL.
The i,jth element of the matrix is stored in
  • vl[j-1×pdvl+i-1] when order=Nag_ColMajor;
  • vl[i-1×pdvl+j-1] when order=Nag_RowMajor.
On entry: if how_many=Nag_BackTransform and side=Nag_LeftSide or Nag_BothSides, vl must contain an n by n matrix Q (usually the matrix of Schur vectors returned by nag_dhseqr (f08pec)).
If how_many=Nag_ComputeAll or Nag_ComputeSelected, vl need not be set.
On exit: if side=Nag_LeftSide or Nag_BothSides, vl contains the computed left eigenvectors (as specified by how_many and select). The eigenvectors are stored consecutively in the rows or columns of the array, in the same order as their eigenvalues. Corresponding to each real eigenvalue is a real eigenvector, occupying one row or column. Corresponding to each complex conjugate pair of eigenvalues, is a complex eigenvector occupying two rows or columns; the first row or column holds the real part and the second row or column holds the imaginary part.
If side=Nag_RightSide, vl is not referenced and may be NULL.
9:     pdvl IntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array vl.
Constraints:
  • if order=Nag_ColMajor,
    • if side=Nag_LeftSide or Nag_BothSides, pdvln;
    • if side=Nag_RightSide, vl may be NULL;
  • if order=Nag_RowMajor,
    • if side=Nag_LeftSide or Nag_BothSides, pdvlmm;
    • if side=Nag_RightSide, vl may be NULL.
10:   vr[dim] doubleInput/Output
Note: the dimension, dim, of the array vr must be at least
  • pdvr×mm when side=Nag_RightSide or Nag_BothSides and order=Nag_ColMajor;
  • n×pdvr when side=Nag_RightSide or Nag_BothSides and order=Nag_RowMajor;
  • otherwise vr may be NULL.
The i,jth element of the matrix is stored in
  • vr[j-1×pdvr+i-1] when order=Nag_ColMajor;
  • vr[i-1×pdvr+j-1] when order=Nag_RowMajor.
On entry: if how_many=Nag_BackTransform and side=Nag_RightSide or Nag_BothSides, vr must contain an n by n matrix Q (usually the matrix of Schur vectors returned by nag_dhseqr (f08pec)).
If how_many=Nag_ComputeAll or Nag_ComputeSelected, vr need not be set.
On exit: if side=Nag_RightSide or Nag_BothSides, vr contains the computed right eigenvectors (as specified by how_many and select). The eigenvectors are stored consecutively in the rows or columns of the array, in the same order as their eigenvalues. Corresponding to each real eigenvalue is a real eigenvector, occupying one row or column. Corresponding to each complex conjugate pair of eigenvalues, is a complex eigenvector occupying two rows or columns; the first row or column holds the real part and the second row or column holds the imaginary part.
If side=Nag_LeftSide, vr is not referenced and may be NULL.
11:   pdvr IntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array vr.
Constraints:
  • if order=Nag_ColMajor,
    • if side=Nag_RightSide or Nag_BothSides, pdvrn;
    • if side=Nag_LeftSide, vr may be NULL;
  • if order=Nag_RowMajor,
    • if side=Nag_RightSide or Nag_BothSides, pdvrmm;
    • if side=Nag_LeftSide, vr may be NULL.
12:   mm IntegerInput
On entry: the number of rows or columns in the arrays vl and/or vr. The precise number of rows or columns required (depending on the value of order), m, is n if how_many=Nag_ComputeAll or Nag_BackTransform; if how_many=Nag_ComputeSelected, 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 how_many=Nag_ComputeAll or Nag_BackTransform, mmn;
  • otherwise mmm.
13:   m Integer *Output
On exit: m, the number of rows or columns of vl and/or vr actually used to store the computed eigenvectors. If how_many=Nag_ComputeAll or Nag_BackTransform, m is set to n.
14:   fail NagError *Input/Output
The NAG error argument (see Section 3.7 in How to Use the NAG Library and its Documentation).

6
Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
See Section 2.3.1.2 in How to Use the NAG Library and its Documentation for further information.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_ENUM_INT_2
On entry, how_many=value, mm=value and n=value.
Constraint: if how_many=Nag_ComputeAll or Nag_BackTransform, mmn;
otherwise mmm.
On entry, side=value, pdvl=value, mm=value.
Constraint: if side=Nag_LeftSide or Nag_BothSides, pdvlmm.
On entry, side=value, pdvl=value and n=value.
Constraint: if side=Nag_LeftSide or Nag_BothSides, pdvln.
On entry, side=value, pdvr=value, mm=value.
Constraint: if side=Nag_RightSide or Nag_BothSides, pdvrmm.
On entry, side=value, pdvr=value and n=value.
Constraint: if side=Nag_RightSide or Nag_BothSides, pdvrn.
NE_INT
On entry, n=value.
Constraint: n0.
On entry, pdt=value.
Constraint: pdt>0.
On entry, pdvl=value.
Constraint: pdvl>0.
On entry, pdvr=value.
Constraint: pdvr>0.
NE_INT_2
On entry, pdt=value and n=value.
Constraint: pdt max1,n .
NE_INTERNAL_ERROR
An internal error has occurred in this function. Check the function call and any array sizes. If the call is correct then please contact NAG for assistance.
See Section 2.7.6 in How to Use the NAG Library and its Documentation for further information.
NE_NO_LICENCE
Your licence key may have expired or may not have been installed correctly.
See Section 2.7.5 in How to Use the NAG Library and its Documentation for further information.

7
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_dtrsna (f08qlc).

8
Parallelism and Performance

nag_dtrevc (f08qkc) 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 function. Please also consult the Users' Note for your implementation for any additional implementation-specific information.

9
Further Comments

For a description of canonical Schur form, see the document for nag_dhseqr (f08pec).
The complex analogue of this function is nag_ztrevc (f08qxc).

10
Example

See Section 10 in nag_dgebal (f08nhc).