nag_dtgevc (f08ykc) (PDF version)
f08 Chapter Contents
f08 Chapter Introduction
NAG C Library Manual

NAG Library Function Document

nag_dtgevc (f08ykc)

+ Contents

    1  Purpose
    7  Accuracy

1  Purpose

nag_dtgevc (f08ykc) computes some or all of the right and/or left generalized eigenvectors of a pair of real matrices A,B which are in generalized real Schur form.

2  Specification

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

3  Description

nag_dtgevc (f08ykc) computes some or all of the right and/or left generalized eigenvectors of the matrix pair A,B which is assumed to be in generalized upper Schur form. If the matrix pair A,B is not in the generalized upper Schur form, then nag_dhgeqz (f08xec) should be called before invoking nag_dtgevc (f08ykc).
The right generalized eigenvector x and the left generalized eigenvector y of A,B corresponding to a generalized eigenvalue λ are defined by
A-λBx=0
and
yH A-λ B=0.
If a generalized eigenvalue is determined as 0/0, which is due to zero diagonal elements at the same locations in both A and B, a unit vector is returned as the corresponding eigenvector.
Note that the generalized eigenvalues are computed using nag_dhgeqz (f08xec) but nag_dtgevc (f08ykc) does not explicitly require the generalized eigenvalues to compute eigenvectors. The ordering of the eigenvectors is based on the ordering of the eigenvalues as computed by nag_dtgevc (f08ykc).
If all eigenvectors are requested, the function may either return the matrices X and/or Y of right or left eigenvectors of A,B, or the products ZX and/or QY, where Z and Q are two matrices supplied by you. Usually, Q and Z are chosen as the orthogonal matrices returned by nag_dhgeqz (f08xec). Equivalently, Q and Z are the left and right Schur vectors of the matrix pair supplied to nag_dhgeqz (f08xec). In that case, QY and ZX are the left and right generalized eigenvectors, respectively, of the matrix pair supplied to nag_dhgeqz (f08xec).
A must be block upper triangular; with 1 by 1 and 2 by 2 diagonal blocks. Corresponding to each 2 by 2 diagonal block is a complex conjugate pair of eigenvalues and eigenvectors; only one eigenvector of the pair is computed, namely the one corresponding to the eigenvalue with positive imaginary part. Each 1 by 1 block gives a real generalized eigenvalue and a corresponding eigenvector.

4  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
Golub G H and Van Loan C F (1996) Matrix Computations (3rd Edition) Johns Hopkins University Press, Baltimore
Moler C B and Stewart G W (1973) An algorithm for generalized matrix eigenproblems SIAM J. Numer. Anal. 10 241–256
Stewart G W and Sun J-G (1990) Matrix Perturbation Theory Academic Press, London

5  Arguments

1:     orderNag_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.2.1.3 in the Essential Introduction for a more detailed explanation of the use of this argument.
Constraint: order=Nag_RowMajor or Nag_ColMajor.
2:     sideNag_SideTypeInput
On entry: specifies the required sets of generalized eigenvectors.
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_BothSides, Nag_LeftSide or Nag_RightSide.
3:     how_manyNag_HowManyTypeInput
On entry: specifies further details of the required generalized eigenvectors.
how_many=Nag_ComputeAll
All right and/or left eigenvectors are computed.
how_many=Nag_BackTransform
All right and/or left eigenvectors are computed; they are backtransformed using the input matrices supplied in arrays vr and/or vl.
how_many=Nag_ComputeSelected
Selected right and/or left eigenvectors, defined by the array select, are computed.
Constraint: how_many=Nag_ComputeAll, Nag_BackTransform or Nag_ComputeSelected.
4:     select[dim]const Nag_BooleanInput
Note: the dimension, dim, of the array select must be at least
  • max1,n when how_many=Nag_ComputeSelected;
  • 1 otherwise.
On entry: specifies the eigenvectors to be computed if how_many=Nag_ComputeSelected. To select the generalized eigenvector corresponding to the jth generalized eigenvalue, the jth element of select should be set to Nag_TRUE; if the eigenvalue corresponds to a complex conjugate pair, then real and imaginary parts of eigenvectors corresponding to the complex conjugate eigenvalue pair will be computed.
Constraint: select[j]=Nag_TRUE, for j=0,1,,n-1.
5:     nIntegerInput
On entry: n, the order of the matrices A and B.
Constraint: n0.
6:     a[dim]const doubleInput
Note: the dimension, dim, of the array a must be at least max1,pda×n.
The i,jth element of the matrix A is stored in
  • a[j-1×pda+i-1] when order=Nag_ColMajor;
  • a[i-1×pda+j-1] when order=Nag_RowMajor.
On entry: the matrix pair A,B must be in the generalized Schur form. Usually, this is the matrix A returned by nag_dhgeqz (f08xec).
7:     pdaIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array a.
Constraint: pdamax1,n.
8:     b[dim]const doubleInput
Note: the dimension, dim, of the array b must be at least max1,pdb×n.
The i,jth element of the matrix B is stored in
  • b[j-1×pdb+i-1] when order=Nag_ColMajor;
  • b[i-1×pdb+j-1] when order=Nag_RowMajor.
On entry: the matrix pair A,B must be in the generalized Schur form. If A has a 2 by 2 diagonal block then the corresponding 2 by 2 block of B must be diagonal with positive elements. Usually, this is the matrix B returned by nag_dhgeqz (f08xec).
9:     pdbIntegerInput
On entry: the stride separating row or column elements (depending on the value of order) in the array b.
Constraint: pdbmax1,n.
10:   vl[dim]doubleInput/Output
Note: the dimension, dim, of the array vl must be at least
  • max1,pdvl×mm when side=Nag_LeftSide or Nag_BothSides and order=Nag_ColMajor;
  • max1,n×pdvl when side=Nag_LeftSide or Nag_BothSides and order=Nag_RowMajor;
  • 1 when side=Nag_RightSide.
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 be initialized to an n by n matrix Q. Usually, this is the orthogonal matrix Q of left Schur vectors returned by nag_dhgeqz (f08xec).
On exit: if side=Nag_LeftSide or Nag_BothSides, vl contains:
  • if how_many=Nag_ComputeAll, the matrix Y of left eigenvectors of A,B;
  • if how_many=Nag_BackTransform, the matrix QY;
  • if how_many=Nag_ComputeSelected, the left eigenvectors of A,B specified by select, stored consecutively in the rows or columns (depending on the value of order) of the array vl, in the same order as their corresponding eigenvalues.
A complex eigenvector corresponding to a complex eigenvalue is stored in two consecutive rows or columns, the first holding the real part, and the second the imaginary part.
11:   pdvlIntegerInput
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, pdvl max1,n ;
    • if side=Nag_RightSide, pdvl1;
  • if order=Nag_RowMajor,
    • if side=Nag_LeftSide or Nag_BothSides, pdvlmax1,mm;
    • if side=Nag_RightSide, pdvl1.
12:   vr[dim]doubleInput/Output
Note: the dimension, dim, of the array vr must be at least
  • max1,pdvr×mm when side=Nag_RightSide or Nag_BothSides and order=Nag_ColMajor;
  • max1,n×pdvr when side=Nag_RightSide or Nag_BothSides and order=Nag_RowMajor;
  • 1 when side=Nag_LeftSide.
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 be initialized to an n by n matrix Z. Usually, this is the orthogonal matrix Z of right Schur vectors returned by nag_dhgeqz (f08xec).
On exit: if side=Nag_RightSide or Nag_BothSides, vr contains:
  • if how_many=Nag_ComputeAll, the matrix X of right eigenvectors of A,B;
  • if how_many=Nag_BackTransform, the matrix ZX;
  • if how_many=Nag_ComputeSelected, the right eigenvectors of A,B specified by select, stored consecutively in the rows or columns (depending on the value of order) of the array vr, in the same order as their corresponding eigenvalues.
A complex eigenvector corresponding to a complex eigenvalue is stored in two consecutive rows or columns, the first holding the real part, and the second the imaginary part.
13:   pdvrIntegerInput
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, pdvr max1,n ;
    • if side=Nag_LeftSide, pdvr1;
  • if order=Nag_RowMajor,
    • if side=Nag_RightSide or Nag_BothSides, pdvrmax1,mm;
    • if side=Nag_LeftSide, pdvr1.
14:   mmIntegerInput
On entry: the number of columns in the arrays vl and/or vr.
Constraints:
  • if how_many=Nag_ComputeAll or Nag_BackTransform, mmn;
  • if how_many=Nag_ComputeSelected, mm must not be less than the number of requested eigenvectors.
15:   mInteger *Output
On exit: the number of columns in the arrays vl and/or vr actually used to store the eigenvectors. If how_many=Nag_ComputeAll or Nag_BackTransform, m is set to n. Each selected real eigenvector occupies one row or column and each selected complex eigenvector occupies two rows or columns.
16:   failNagError *Input/Output
The NAG error argument (see Section 3.6 in the Essential Introduction).

6  Error Indicators and Warnings

NE_ALLOC_FAIL
Dynamic memory allocation failed.
NE_BAD_PARAM
On entry, argument value had an illegal value.
NE_CONSTRAINT
On entry, select[j]=value.
Constraint: select[j]=Nag_TRUE, for j=0,1,,n-1
NE_ENUM_INT_2
On entry, how_many=value, n=value and mm=value.
Constraint: if how_many=Nag_ComputeAll or Nag_BackTransform, mmn;
if how_many=Nag_ComputeSelected, mm must not be less than the number of requested eigenvectors.
On entry, side=value, pdvl=value, mm=value.
Constraint: if side=Nag_LeftSide or Nag_BothSides, pdvlmax1,mm;
if side=Nag_RightSide, pdvl1.
On entry, side=value, pdvl=value and n=value.
Constraint: if side=Nag_LeftSide or Nag_BothSides, pdvl max1,n ;
if side=Nag_RightSide, pdvl1.
On entry, side=value, pdvr=value, mm=value.
Constraint: if side=Nag_RightSide or Nag_BothSides, pdvrmax1,mm;
if side=Nag_LeftSide, pdvr1.
On entry, side=value, pdvr=value and n=value.
Constraint: if side=Nag_RightSide or Nag_BothSides, pdvr max1,n ;
if side=Nag_LeftSide, pdvr1.
NE_INT
On entry, n=value.
Constraint: n0.
On entry, pda=value.
Constraint: pda>0.
On entry, pdb=value.
Constraint: pdb>0.
On entry, pdvl=value.
Constraint: pdvl>0.
On entry, pdvr=value.
Constraint: pdvr>0.
NE_INT_2
On entry, pda=value and n=value.
Constraint: pdamax1,n.
On entry, pdb=value and n=value.
Constraint: pdbmax1,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.
NE_NOT_COMPLEX
The 2 by 2 block value:value+1 does not have complex eigenvalues.

7  Accuracy

It is beyond the scope of this manual to summarize the accuracy of the solution of the generalized eigenvalue problem. Interested readers should consult Section 4.11 of the LAPACK Users' Guide (see Anderson et al. (1999)) and Chapter 6 of Stewart and Sun (1990).

8  Further Comments

nag_dtgevc (f08ykc) is the sixth step in the solution of the real generalized eigenvalue problem and is called after nag_dhgeqz (f08xec).
The complex analogue of this function is nag_ztgevc (f08yxc).

9  Example

This example computes the α and β arguments, which defines the generalized eigenvalues and the corresponding left and right eigenvectors, of the matrix pair A,B given by
A = 1.0 1.0 1.0 1.0 1.0 2.0 4.0 8.0 16.0 32.0 3.0 9.0 27.0 81.0 243.0 4.0 16.0 64.0 256.0 1024.0 5.0 25.0 125.0 625.0 3125.0   and   B= 1.0 2.0 3.0 4.0 5.0 1.0 4.0 9.0 16.0 25.0 1.0 8.0 27.0 64.0 125.0 1.0 16.0 81.0 256.0 625.0 1.0 32.0 243.0 1024.0 3125.0 .
To compute generalized eigenvalues, it is required to call five functions: nag_dggbal (f08whc) to balance the matrix, nag_dgeqrf (f08aec) to perform the QR factorization of B, nag_dormqr (f08agc) to apply Q to A, nag_dgghrd (f08wec) to reduce the matrix pair to the generalized Hessenberg form and nag_dhgeqz (f08xec) to compute the eigenvalues via the QZ algorithm.
The computation of generalized eigenvectors is done by calling nag_dtgevc (f08ykc) to compute the eigenvectors of the balanced matrix pair. The function nag_dggbak (f08wjc) is called to backward transform the eigenvectors to the user-supplied matrix pair. If both left and right eigenvectors are required then nag_dggbak (f08wjc) must be called twice.

9.1  Program Text

Program Text (f08ykce.c)

9.2  Program Data

Program Data (f08ykce.d)

9.3  Program Results

Program Results (f08ykce.r)


nag_dtgevc (f08ykc) (PDF version)
f08 Chapter Contents
f08 Chapter Introduction
NAG C Library Manual

© The Numerical Algorithms Group Ltd, Oxford, UK. 2012